Skip to main content
Skip table of contents

PRIMARY_KEY

Key constraints
Note that the supported behaviour with key constraints varies between database management systems. Check DBMS specific documentation.

Defining a PRIMARY_KEY for an entity creates a primary key in the target database.


See also:


Usage

Pick one or several attributes to form the key and give a name to the key.


Notes

Check Export SQL/Entity SQL after defining a PRIMARY_KEY to see generated DDL.

Agile Data Engine does not create primary keys in Azure Synapse SQL. Azure Synapse SQL only supports primary keys with NONCLUSTERED and NOT ENFORCED options, and use of primary keys may cause queries to return inaccurate results when there are duplicate entries. Please refer to Microsoft documentation for more details.


Examples

Defining a primary key for a table

Key definition:

DEFINITION
KEY NAME: PK_F_TRIP
KEY TYPE: PRIMARY_KEY
ATTRIBUTE 1: trip_wid

DDL generated by Agile Data Engine:

SQL
CREATE TABLE pub.F_TRIP (
  ...,
  CONSTRAINT PK_F_TRIP PRIMARY KEY (trip_wid)
);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.