backport(1.11): emit column and model constraints instead of dropping them (#828) - #837
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 guardedALTER TABLE … ADD CONSTRAINTafter the swap, on every build path.PRIMARY KEY/UNIQUEdefault toNONCLUSTEREDso they coexist with theas_columnstoreindex;expression: clusteredoverrides. See the README's Constraints section anddocs/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 ofrender_column_constraint.tests/functional/adapter/dbt/test_constraints.py: the twoexpected_sqlfixtures keep 1.11's bracket-quoted column list and gain the hoistedcheckclauses.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