Databricks Delta constraints: enforced checks vs informational keys
Constraints on Databricks
Databricks documentation of NOT NULL and CHECK enforced constraints versus informational primary, foreign, and unique keys on Delta Lake tables.
Based on
Constraints on Databricks | Databricks on AWS
The docs separate enforced constraints, which verify integrity before rows are added and fail the transaction on violation, from informational primary key, foreign key, and unique constraints that define field relationships but are not enforced. Both kinds require Delta Lake. Enforced forms are NOT NULL on columns and CHECK boolean expressions per row. Adding a constraint can upgrade the table writer protocol when the writer version is below 3, with possible impact on external Delta clients.
NOT NULL can be declared at CREATE TABLE or changed with ALTER TABLE ... ALTER COLUMN; Databricks checks existing rows before adding NOT NULL. Nested struct fields need a non-null parent; columns nested in array or map types do not accept NOT NULL. Pipeline expectations in Lakeflow are pointed to as a related data-quality concept.
Declared keys and checks are machine-readable statements of allowed shape and relationships—shared meaning for what a valid row is. Data engineering and governance teams can treat informational keys as contracts for joins and entity linkage even when the engine does not enforce them, while enforced constraints hard-gate integrity at write time across producers.
Put this to work on CoreModels
Related connectors and recipes
See all connectors →Take the next step
Try CoreModels, talk with our team, or explore more resources.