Skip to content

CHECK Constraints

CHECK Constraints are named SQL expressions that are used to enforce data quality at table level (at write time).

CHECK constraints are registered (added) using the following high-level operator:

CHECK constraints are de-registered (dropped) using the following high-level operator:

DeltaCatalog is responsible to manage CHECK constraints of a delta table (using AddConstraint and DropConstraint).

Protocol

CHECK constraints require the Minimum Writer Version (of a delta table) to be at least 3.

delta.constraints

CHECK constraints are stored in the table configuration (of a table metadata) as delta.constraints.-keyed entries.

AlterTableCommands, DeltaCatalog and Delta Commands

At execution, AlterTableCommand (Spark SQL) is planned as a AlterTableExec (Spark SQL) that requests the active TableCatalog (Spark SQL) to alter a table.

That is when DeltaCatalog kicks in to alter a table as AlterTableAddConstraintDeltaCommand.