Searching Data by Primary Key Combinations
The following sections explain how to search for events in an event table that match a single primary key or a combination of primary keys, and how to persist data and generate events in a manner that allows such search operations to be carried out.
At any given time, this search retrieves only one record because each combination of primary key values is unique to one event.
The following sections explain how data needs to be persisted, generated and queried for in order to perform this type of search.
Persisting attributes
In order to perform this search, you should select the Primary Key check box for attributes to be considered primary keys at the time of persisting data for the relevant event stream.
Generating data
- When there is only one attribute persisted as a primary key, the value specified for that attribute should be unique for each event.
- When there are two or more attributes persisted as primary keys, the value specified for an individual primary key does not have to be unique for each event. However, each event should have a unique combination of primary key values.
e.g., If an event stream has only one primary key named Transaction_ID
, a unique transaction ID should be specified for each event generated. If you generate multiple events with the same transaction ID, the only the last event generated with that transaction ID is persisted. However, if there are two primary keys named Transaction_ID
and Purchase_Batch_ID
, two or more events can have the same transaction ID as long as their purchase batch IDs are different to each other.
Searching for Data
Click on the relevant tab to search for events by primary keys using the DAS Management Console or via REST API.