Column Invariants¶
Note
As per this comment, column invariants are old-style and users should use CHECK constraints:
Utilities for handling constraints. Right now this includes:
- Column-level invariants (including both NOT NULL constraints and an old style of CHECK constraint specified in the column metadata)
- Table-level CHECK constraints
Column Invariants are SQL expressions that are used to enforce data quality at column level (at write time using DeltaInvariantCheckerExec).
Column Invariants are associated with any top-level or nested columns. If with a nested column, all parent columns have to be non-nullable (by NotNull constraints).
Column invariants are column-level (not table-wide) yet use the same Check constraint as CHECK constraints. In other words, column invariants are single-column CHECK constraints (i.e., limited to a single column).
delta.invariants¶
Column invariants are stored in the table schema (of a table metadata) as JSON-encoded SQL expressions as delta.invariants metadata of a column.