Data Quality Constraints in Unity Catalog
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing Implementing Data Engineering Solutions Using Azure Databricks premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Three gates a bad row passes
- Enforced constraints: NOT NULL and CHECK
- Informational keys: PRIMARY KEY, FOREIGN KEY, UNIQUE
- Schema enforcement and handling drift
- Pipeline expectations: warn, drop, and fail
- Choosing a mechanism, and exam patterns
Data-quality mechanisms: what each does to a bad row
| Mechanism | Enforced? | Action on a bad row | Where it applies |
|---|---|---|---|
| NOT NULL / CHECK constraint | Yes | Reject the write (transaction fails) | Every writer of the Delta table |
| PRIMARY KEY / FOREIGN KEY / UNIQUE | No (informational) | Not checked | Advisory; optimizer only, with RELY |
| Schema & type enforcement | Yes (by default) | Reject the mismatched write | Every writer of the Delta table |
| Schema evolution (mergeSchema) | Opt-in | Add new column; conflicting type still fails | The write that enables it |
| expect (warn) | No | Keep the row, record metrics | Inside the Lakeflow pipeline |
| expect_or_drop | Yes (drop) | Drop the row, update continues | Inside the Lakeflow pipeline |
| expect_or_fail | Yes (fail) | Stop update, atomic rollback | Inside the Lakeflow pipeline |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
Also tested in
References
- Update table schemas with schema evolution
- Constraints on Azure Databricks
- Manage data quality with pipeline expectations
- ADD CONSTRAINT clause
- DECIMAL type
- MERGE INTO
- Query optimization using primary key and unique constraints
- Configure schema inference and evolution in Auto Loader
- Develop pipeline code with Python
- Pipeline event log