Skip to main content

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.

  1. Review the source system table for the object or event.

  2. Identify the set of attributes that together uniquely identify each record.

    For example: Client_ID + Company_Code

  3. Verify 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.

  1. Click Data IntegrationObjects and Events and select the OCPM data pool you want to use.

  2. Select an existing custom object or event type, or create a new one.

  3. In the primary key configuration:

    • Select Composite Primary Key

    • Choose the relevant attributes from the list

  4. 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:

  1. Open the transformation for the object or event.

  2. Remove:

    • ID concatenation logic

    • ID matching or casting logic

  3. Ensure only the composite PK attributes are populated.

  4. 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

  1. Open the relationship configuration.

  2. For 1:N or M:N relationships:

    • Map the PK attributes of the source object

    • Map the corresponding FK attributes in the target object

  3. Do not use the ID attribute if it is not the PK.

Step 4.2: Event-to-Object (E2O) relationships

  1. Open the E2O relationship definition.

  2. Map:

    • Event FK attributes → Object PK attributes

  3. For “involves many” relationships:

    • Update transformation logic to reference PK attributes directly

  1. Confirm that every FK attribute: Has the same data type as its corresponding PK attribute.

  2. Ensure no floating-point columns are used in PKs or FKs

  1. Trigger a data load.

  2. 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:

  1. Identify PQL expressions referencing: RelationshipName_ID

  2. Replace them with: The actual FK columns used in the relationship.

  3. 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

  1. Run sample PQL queries to:

    • Validate joins

    • Check cardinality

  2. Monitor query performance on the Prime Query Engine.

  3. 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.