You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Versioned models do not appropriately generate their contract checksums during parsing, if the contract enforcement config is defined in yaml (as opposed to in-file {{ config }}). Meaning that same_contract checks always return True for this type of versioned model.
Then select modified models. I expected to see a Breaking Change to Contract Error:
$ dbt -q ls -s state:modified --state state/
09:37:41 Encountered an error:
Breaking Change to Contract Error in model my_model (models/my_model.sql)
While comparing to previous project state, dbt detected a breaking change to an enforced contract.
Columns with data_type changes:
- id (integer -> text)
Consider making an additive (non-breaking) change instead, if possible.
Otherwise, create a new model version: https://docs.getdbt.com/docs/collaborate/govern/model-versions
Instead, it succeeds:
$ dbt -q ls -s state:modified --state state/
my_dbt_project.my_model.v1
This should raise a "Breaking Change" error that can be resolved by bumping the model version.
Potential resolutions
The problem is that a versioned model doesn't have its contract checksum appropriately generated, so this check succeeds (both are None):
github-actionsbot
changed the title
[Bug] Contract checksum not appropriately built for versioned models
[CT-2789] [Bug] Contract checksum not appropriately built for versioned models
Jul 5, 2023
Versioned models do not appropriately generate their contract checksums during parsing, if the
contract
enforcement config is defined in yaml (as opposed to in-file{{ config }}
). Meaning thatsame_contract
checks always returnTrue
for this type of versioned model.Repro case
Start with:
Generate a manifest and move it to a local folder:
Change to:
Then select modified models. I expected to see a Breaking Change to Contract Error:
Instead, it succeeds:
This should raise a "Breaking Change" error that can be resolved by bumping the model version.
Potential resolutions
The problem is that a versioned model doesn't have its contract checksum appropriately generated, so this check succeeds (both are
None
):dbt-core/core/dbt/contracts/graph/nodes.py
Lines 652 to 656 in 7fbfd53
Two potential fixes:
same_contract
,if not contract.checksum
, generate it: 879957abuild_contract_checksum()
for versioned models specifically, after configs are resolved: 434d491The text was updated successfully, but these errors were encountered: