[Bug] Updating a data type detail (e.g. size) results in a breaking change on the contract #11186
Open
Description
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
We have a model materialized as a table with an enforced contract. If we change a column's data type from varchar(1)
to varchar(2)
, this change is detected as a breaking change.
Expected Behavior
As described in https://docs.getdbt.com/reference/resource-configs/contract#size-precision-and-scale it should not result in a breaking change.
Steps To Reproduce
- Create model with a varchar column and an enforced contract.
- Change the varchar size on that contract and run deferring to the previous state.
Relevant log output
Command failed
Breaking change to contract Error in model md_company_code (models/marts/business_partner/bukrs/md_company_code.sql)
While comparing to previous project state, dbt detected a breaking change to an enforced contract.
- Columns with data_type changes:
- nk_company_code (varchar(120) -> varchar(121))
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
Environment
dbt Cloud: Latest
Which database adapter are you using with dbt?
snowflake
Additional Context
It might be related to the following release:
- https://github.com/dbt-labs/dbt-core/releases/tag/v1.9.0
- Do not update varchar column definitions if a contract exists ([Bug] Incorrect column data type with incremental contracted model and varchar data_type #10362)
- [Bug] Incorrect column data type with incremental contracted model and varchar data_type #10362