Skip to main content
Skip table of contents

UNIQUE_KEY

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

Defining a UNIQUE_KEY for an entity creates a UNIQUE constraint 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 UNIQUE_KEY to see generated DDL.

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


Examples

Defining a unique key for a table

Key definition:

DEFINITION
KEY NAME: U_F_TRIP
KEY TYPE: UNIQUE_KEY
ATTRIBUTE 1: trip_wid

DDL generated by Agile Data Engine:

SQL
CREATE TABLE pub.F_TRIP (
  ...,
  CONSTRAINT U_F_TRIP UNIQUE (trip_wid)
);
JavaScript errors detected

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

If this problem persists, please contact our support.