dbt-databricks icon indicating copy to clipboard operation
dbt-databricks copied to clipboard

fix: don't reconcile constraints on incremental runs when contract is unenforced

Open sd-db opened this issue 5 months ago • 1 comments

What

Gate constraint reconciliation in apply_config_changeset on contract.enforced. With the contract off, constraints are now a no-op (matching V1).

Why

On contract.enforced: false the model contributes no constraints (the #1342 guard), so the diff is all-unset and existing constraints were dropped via ALTER TABLE … DROP CONSTRAINT … CASCADE (taking dependent FKs) on the next incremental run.

Tests

TestIncrementalContractOffPreservesConstraints: enforce → flip off → re-run incrementally → PK survives (checked via information_schema). Fails on main, passes here. Contract-on reconciliation (TestIncrementalConstraintsColumnsEqual) unaffected.

Checklist

  • [x] I have run this code in development and it appears to resolve the stated issue
  • [x] This PR includes tests, or tests are not required/relevant for this PR
  • [x] I have updated the CHANGELOG.md

sd-db avatar Jun 24 '26 14:06 sd-db

Coverage report

This PR does not seem to contain any modification to coverable code.

github-actions avatar Jun 24 '26 14:06 github-actions