dbt-labs / dbt-labs/docs.getdbt.com

Document workaround for making intentional breaking changes to model with enforced contract

Open
#3,752 0 comments 0 reactions 0 assignees View on GitHub
content improvement
Dominant language
JavaScript
Stars
215
Forks
1.2k
Avg merge
1d 15h
Merged PRs (30d)
130

Description

### Contributions

- [X] I have read the contribution docs, and understand what's expected of me.

### Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/reference/resource-configs/contract#detecting-breaking-changes

### What part(s) of the page would you like to see updated?

https://github.com/dbt-labs/dbt-core/issues/7824#issuecomment-1583357247

Available workarounds:
If the breaking contract changes are being made intentionally, an (unsafe!) option is to merge anyways on failing CI -- future CI runs will pass because the baseline state will include the breaking changes. But if that CI run would have failed on something unrelated to contracts after the breaking change check, it would streamroll over a scenario that should have failed.

With what's currently available in dbt, a safer workaround would be to:

1. Make a breaking change and observe Breaking Change to Contract Error in CI
2. Determine that the breaking change is intentional and model versioning isn't necessary
3. Turn off contract enforcement for the model with breaking changes (by setting contract: {enforced: false} at the model-level) and running CI -- this way any failures unrelated to the breaking changes will be detected during CI
4. Turn contract enforcement back on, and run the model locally (without deferral) to ensure the new contract is validated
5. With contract enforcement still re-enabled, run CI and merge the changes despite the Breaking Change to Contract Error failure in CI

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.