Skip to content

backport(1.11): emit column and model constraints instead of dropping them (#828) - #837

Merged
axellpadilla merged 1 commit into
release/v1.11from
backport/1.11-579-constraints
Sep 7, 2026
Merged

axellpadilla merged 1 commit into
release/v1.11from
backport/1.11-579-constraints

Conversation

@axellpadilla

Copy link
Copy Markdown
Collaborator

Backport of #828 (fixes #579) to release/v1.11, including the follow-up commits merged with it.

Constraints declared in a contract-enforced model's yaml now reach the database: column-level and unnamed model-level constraints render inline in the CREATE TABLE; named model-level ones are applied by a guarded ALTER TABLE … ADD CONSTRAINT after the swap, on every build path. PRIMARY KEY/UNIQUE default to NONCLUSTERED so they coexist with the as_columnstore index; expression: clustered overrides. See the README's Constraints section and docs/constraints.md.

Conflicts resolved against release/v1.11:

  • CHANGELOG.md: the two entries placed under v1.11.2.
  • dbt/adapters/sqlserver/sqlserver_adapter.py: replaced the 1.11 body of render_column_constraint.
  • tests/functional/adapter/dbt/test_constraints.py: the two expected_sql fixtures keep 1.11's bracket-quoted column list and gain the hoisted check clauses.

Validated on this branch with its own environment (uv sync, dbt-core 1.11): unit suite and the full functional suite at -n auto.

🤖 Generated with Claude Code

…raints

Backport of #828 (fixes #579) plus its follow-up
commits: constraints declared in a contract-enforced model's yaml now reach
the database. Column-level and unnamed model-level constraints render inline
in the CREATE TABLE; named model-level ones are applied by a guarded ALTER
TABLE ... ADD CONSTRAINT after the swap, on every build path.

Conflicts resolved against release/v1.11:
- CHANGELOG.md: entries placed under v1.11.2, with the dml-refresh entry's
  wording tweak from master.
- sqlserver_adapter.py: replaced the 1.11 render_column_constraint body.
- tests/functional/adapter/dbt/test_constraints.py: the two expected_sql
  fixtures keep 1.11's bracket-quoted column list and gain the hoisted checks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@axellpadilla
axellpadilla merged commit ee28308 into release/v1.11 Sep 7, 2026
1 check passed
@axellpadilla
axellpadilla deleted the backport/1.11-579-constraints branch September 7, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant