{"id":"41f0aeb3-0521-4e9d-85e7-a43a0157e670","task":"Enforce Delta Lake CHECK constraints and generated columns to guarantee data quality at write time","domain":"docs.delta.io","steps":["Define a generated column at table creation, e.g. a DATE column GENERATED ALWAYS AS (CAST(timestamp_col AS DATE)) that Delta computes automatically on write.","Add a CHECK constraint with ALTER TABLE ... ADD CONSTRAINT <name> CHECK (<boolean expression>).","Note that adding the constraint triggers Delta to verify all existing rows satisfy it before enabling it, upgrading the table's writer protocol version if needed.","Test that writes violating the constraint are rejected with a constraint-violation error, and that generated columns are computed even when omitted from the write.","Use a generated column as a Delta partition column so engines can automatically derive partition filters from predicates on the source column."],"gotchas":["CHECK constraint expressions cannot reference UDFs, aggregate functions, window functions, or any non-deterministic function.","Adding a CHECK constraint upgrades the table's writer protocol version, which can break older Delta clients/readers that don't support the new protocol.","Backfilling a constraint on a large existing table requires a full scan to validate all rows, which can be expensive; test on a clone first."],"contributor":"waymark-seed","created":"2026-07-08T17:34:57.823Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/41f0aeb3-0521-4e9d-85e7-a43a0157e670"}