Defining composite primary keys for object-centric data models
In an object-centric data model (OCDM), object and event types are uniquely identified by a primary key (PK), which enables relationships and joins across objects and events.
For source systems where uniqueness is defined by multiple attributes, OCDM supports composite primary keys. Composite primary keys allow you to define a primary key using more than one attribute directly in the data model. This removes the need to manually concatenate attributes in transformation logic and helps improve query performance.
Change from single ID attributes with string data type
Previously, all object and event types in the OCDM required a single ID attribute with a String data type. This attribute served as the PK, uniquely identifying each row and enabling joins across objects and events. For source systems with composite PK (multiple columns), users had to manually concatenate these columns into a single ID using SQL transformations.
You can now define the PK for objects and events in one of two ways:
Single ID attribute (legacy approach): Provide your own ID column as the PK, as before.
Composite PK: Select multiple attributes to form a composite PK. See: Using composite primary keys in OCDM.
When using a composite PK, you can choose to:
Automatically generate an ID in the Celonis Platform (recommended), or
Provide a custom ID via transformation logic.
This change decouples the PK from the ID attribute:
The PK can now consist of multiple attributes.
A unique ID attribute still exists, either user-defined or auto-generated from the composite PK.
Using composite primary keys in OCDM
This guide walks you through configuring composite primary keys (PKs) for objects and events in the object-centric data model (OCDM), including best practices and required updates.
Review the source system table for the object or event.
Identify the set of attributes that together uniquely identify each record.
For example:
Client_ID+Company_CodeVerify that:
None of the attributes are floating-point data types.
All attributes are stable and non-null.
Tip
Always use the auto-generated ID to ensure consistency and optimal performance.
Click Data Integration → Objects and Events and select the OCPM data pool you want to use.
Select an existing custom object or event type, or create a new one.
In the primary key configuration:
Select Composite Primary Key
Choose the relevant attributes from the list
Decide how the ID attribute should be handled:
Recommended: Select Auto-generate ID
Optional: Provide a custom ID column (not recommended unless required)
If the object or event previously had a manually defined ID:
Open the transformation for the object or event.
Remove:
ID concatenation logic
ID matching or casting logic
Ensure only the composite PK attributes are populated.
Save and validate the transformation.
Tip
Removing manual ID logic is required to gain the Prime Query Engine performance benefits.
Step 4.1 Object-to-Object (O2O) relationships
Open the relationship configuration.
For 1:N or M:N relationships:
Map the PK attributes of the source object
Map the corresponding FK attributes in the target object
Do not use the ID attribute if it is not the PK.
Step 4.2: Event-to-Object (E2O) relationships
Open the E2O relationship definition.
Map:
Event FK attributes → Object PK attributes
For “involves many” relationships:
Update transformation logic to reference PK attributes directly
Confirm that every FK attribute: Has the same data type as its corresponding PK attribute.
Ensure no floating-point columns are used in PKs or FKs
Trigger a data load.
After the load completes:
Verify that the auto-generated ID exists
Confirm it is available in PQL queries
Note
The generated ID is created after data load and cannot be used in transformations.
If you changed an existing PK:
Identify PQL expressions referencing:
RelationshipName_IDReplace them with: The actual FK columns used in the relationship.
Validate your Studio Views / dashboards.
If you changed an object’s PK, you must manually update the following:
Recreate 1:N O2O relationships with correct PK–FK mappings.
Update M:N O2O relationship transformations.
Recreate “involves one” E2O relationships.
Update “involves many” E2O transformations
If you changed an event’s PK, you must update all “involves many” E2O transformations referencing that event
Run sample PQL queries to:
Validate joins
Check cardinality
Monitor query performance on the Prime Query Engine.
Confirm:
IDs are consistent
No duplicate records exist
Before finalizing, ensure that:
The object or event is a custom type.
You do not require other types to reference the PK of this custom type. Composite PKs currently prohibit such relationships.