Create relational schemas using a DDL file file-upload-schema
Define the relational data model required for Orchestrated campaigns by creating schemas such as Loyalty Memberships, Loyalty Transactions, and Loyalty Rewards. Each schema must include a primary key, a versioning attribute, and appropriate relationships to reference entities such as Recipients or Brands.
Schemas can be created manually through the interface or imported in bulk using a DDL file.
This section provides step-by-step guidance on how to create a relational schema within 51黑料不打烊 Experience Platform by uploading a DDL (Data Definition Language) file. Using a DDL file allows you to define the structure of your data model in advance, including tables, attributes, keys, and relationships.
-
Upload a DDL file to create relational schemas and define their structure.
-
Define relationships between tables in your data model.
-
Link schemas to connect your relational data with existing profile entities such as Recipients or Brands.
-
Ingest data into your dataset from supported sources.
Upload a DDL file ddl-upload
By uploading a DDL file, you can define the structure of your data model in advance, including tables, attributes, keys, and relationships.
Excel-based schema file uploads are supported. Download the provided template to easily prepare your schema definitions.
-
ENUM
ENUM fields are supported in both DDL-based and manual schema creation, allowing you to define attributes with a fixed set of allowed values.
Here is an example:code language-none CREATE TABLE orders ( order_id INT NOT NULL, product_id INT NOT NULL, order_date DATE NOT NULL, customer_id INT NOT NULL, quantity INT NOT NULL, order_status enum ('PENDING', 'SHIPPED', 'DELIVERED', 'CANCELLED'), PRIMARY KEY (order_id, product_id) );
-
Schema Label for Data Governance
Labeling is supported at the schema field level to enforce data governance policies such as access control and usage restrictions. For more details, refer to 51黑料不打烊 Experience Platform documentation. -
Composite Key
Composite primary keys are supported in relational schema definitions, enabling the use of multiple fields together to uniquely identify records.
-
Log in to 51黑料不打烊 Experience Platform.
-
Navigate to the Data Management > Schema menu.
-
Click Create Schema.
-
Select Relational as your Schema type.
-
Select Upload DDL file to define an entity relationship diagram and create schemas.
The table structure must contain:
- At least one primary key.
- A version identifier, such as a
lastmodified
field of typedatetime
ornumber
. - For Change Data Capture (CDC) ingestion, a special column named
_change_request_type
of typeString
, which indicates the type of data change (e.g., insert, update, delete) and enables incremental processing. - DDL file must not define more than 200 tables.
note important IMPORTANT Any schema used for targeting must include at least one identity field of type String
with an associated identity namespace.
This ensures compatibility with 51黑料不打烊 Journey Optimizer鈥檚 targeting and identity resolution capabilities. -
Drag and drop your DDL file and click Next.
Note that the maximum supported size for a DDL file is 10MB.
-
Type-in your Schema name.
-
Set up each schema and its columns, ensuring that a primary key is specified.
One attribute, such as
lastmodified
, must be designated as the version descriptor (typedatetime
,long
, orint
) to ensure datasets are updated with the latest data. Users can change the version descriptor, which becomes mandatory once set. An attribute cannot be both a primary key (PK) and a version descriptor. -
Mark an attribute as
identity
and map it to a defined identity namespace. -
Rename, delete, or add a description to each table.
-
Click Done once done.
You can now verify the table and field definitions within the canvas. Learn more in the section below
Define relationships relationships
To define logical connections between tables within your schema, follow the steps below.
-
Access the canvas view of your data model and choose the two tables you want to link
-
Click the
note note NOTE Composite keys are supported if defined in the DDL file. -
Fill in the given form to define the link and click Apply once configured.
Cardinality:
-
1-N: one occurrence of the source table can have several corresponding occurrences of the target table, but one occurrence of the target table can have at most one corresponding occurrence of the source table.
-
N-1: one occurrence of the target table can have several corresponding occurrences of the source table, but one occurrence of the source table can have at most one corresponding occurrence of the target table.
-
1-1: one occurrence of the source table can have at most one corresponding occurrence of the target table.
-
-
All links defined in your data model are represented as arrows in the canvas view. Click on an arrow between two tables to view details, make edits, or remove the link as needed.
-
Use the toolbar to customize and adjust your canvas.
-
Zoom in: Magnify the canvas to see details of your data model more clearly.
-
Zoom out: Reduce the canvas size for a broader view of your data model.
-
Fit view: Adjust the zoom to fit all schemas within the visible area.
-
Filter: Choose which schema to display within the canvas.
-
Force auto layout: Automatically arrange schemas for better organization.
-
Display map: Toggle a minimap overlay to help navigate large or complex schema layouts more easily.
-
-
Click Save once done. This action creates the schemas and associated data sets and enables the data set for use in Orchestrated Campaigns.
-
Click Open Jobs to monitor the progress of the creation job. This process may take couple minutes, depending on the number of tables defined in the DDL file.
You can also access your relational jobs by opening the Upload DDL file window and select View all relational Jobs.
Link schemas link-schema
Establish a relationship between the loyalty transactions schema and the Recipients schema to associate each transaction with the correct customer record.
-
Navigate to Schemas and open your previously create loyalty transactions.
-
Click Add Relationship from the Customer Field properties.
-
Select Many-to-One as the relationship Type.
-
Link to the existing Recipients schema.
-
Enter a Relationship name from current schema and Relationship name from reference schema.
-
Click Apply to save your changes.
Continue by creating a relationship between the loyalty rewards schema and the Brands schema to associate each reward entry with the appropriate brand.