Constraints provide a way to ensure the quality of the data in the database. This section provides you with information on the constraints supported in Exasol. When using the migration scripts, you can choose to comment out the generated constraints, so they wont be executed when running the output of the script.
Primary keys are generated by the migration script. See the output below as an example:
By default, primary key constraints generated by the migration script are enabled and checked during DML.
The syntax to define a primary key in
-- Teradata Example
ALTER TABLE "ADVENTUREWORKSDW"."DIMACCOUNT" ADD CONSTRAINT PRIMARY KEY ("ACCOUNTKEY");
-- Exasol Example
ALTER TABLE "ADVENTUREWORKSDW"."DIMACCOUNT" ADD PRIMARY KEY ("ACCOUNTKEY");
Foreign keys are also generated by the migration script, but are left disabled. You can enable them later, after the creation of the foreign keys, if needed.
The Syntax to define a foreign key in Exasol is similar to
ALTER TABLE "ADVENTUREWORKSDW"."DIMGEOGRAPHY" ADD FOREIGN KEY ("SALESTERRITORYKEY") REFERENCES "ADVENTUREWORKSDW"."DIMSALESTERRITORY" DISABLE;
Constraints which are not supported in Exasol and cannot be migrated are:
- UNIQUE Constraints
- Column Constraints (CHECK Constraints)