Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CT-2401] [Bug] Adding a new column to a model with an enforced contract should not be a breaking change #7332

Closed
Tracked by #6747
jtcohen6 opened this issue Apr 12, 2023 · 0 comments · Fixed by #7333
Assignees
Labels
bug Something isn't working

Comments

@jtcohen6
Copy link
Contributor

Reported in #7065 (comment)

Reproduction case

-- models/sometable.sql
select 1 as id
models:
  - name: sometable
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: number
      - name: order_name
        data_type: varchar

Run:

$ mkdir state
$ dbt ls
$ mv target/manifest.json state/

Change the yaml to:

models:
  - name: sometable
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: number
      - name: order_name
        data_type: varchar
      - name: categories
        data_type: varchar
$ dbt ls -s state:modified --state state/
10:38:49  Running with dbt=1.5.0-b5
10:38:50  Found 2 models, 0 tests, 0 snapshots, 1 analysis, 536 macros, 0 operations, 1 seed file, 0 sources, 0 exposures, 0 metrics, 0 groups
10:38:50  Encountered an error:
Contract Error in model sometable (models/sometable.sql)
  There is a breaking change in the model contract because column definitions have changed; you may need to create a new version. See: https://docs.getdbt.com/docs/collaborate/publish/model-versions

Also

Let's rename ModelContractError to ModelContractBreakingChangeError, to better disambiguate it from ContractError (when the model's contract fails at build time).

@jtcohen6 jtcohen6 added bug Something isn't working Team:Language labels Apr 12, 2023
@jtcohen6 jtcohen6 changed the title Adding a new column to a model with an enforced contract is not a breaking change [Bug] Adding a new column to a model with an enforced contract should not be a breaking change Apr 12, 2023
@github-actions github-actions bot changed the title [Bug] Adding a new column to a model with an enforced contract should not be a breaking change [CT-2401] Adding a new column to a model with an enforced contract is not a breaking change Apr 12, 2023
@jtcohen6 jtcohen6 changed the title [CT-2401] Adding a new column to a model with an enforced contract is not a breaking change [CT-2401] [Bug] Adding a new column to a model with an enforced contract should not be a breaking change Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant