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

[Bug] Setting model-level deprecation_date does not apply to model versions #11176

Open
2 tasks done
jtcohen6 opened this issue Dec 23, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working model_versions

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 23, 2024

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

If I set:

models:
  - name: my_model
    config:
      contract: {enforced: true}
    deprecation_date: "2024-12-21"
    columns: [...]
    versions:
      - v: 1

Then model.my_project.my_model.v1 has a deprecation_date of null:

% dbt ls -q -s my_model --output json --output-keys unique_id deprecation_date
{"unique_id": "model.testy.my_model.v1", "deprecation_date": null}

But if I move the deprecation_date property down to the model versions property:

models:
  - name: my_model
    config:
      contract: {enforced: true}
    columns: [...]
    versions:
      - v: 1
        deprecation_date: "2024-12-21"

Then:

% dbt ls -q -s my_model --output json --output-keys unique_id deprecation_date
{"unique_id": "model.testy.my_model.v1", "deprecation_date": "2024-12-21T00:00:00+01:00"}

This is confusing and unexpected behavior.

Specifically, this came up in the context of disabling/removing versioned contracted models (most recently #11161). That should raise an error unless the model has passed its deprecation date. Users were continuing to see the error, even after configuring a passed (past?) deprecation_date, because they were configuring it on the top-level model rather than the nested versions. (#version

Expected Behavior

Setting deprecation_date for the top-level model should apply that value as default for all versions, unless they set a different deprecation_date. (I believe this would be the effect if deprecation_date were a node-level config.)

Steps To Reproduce

  1. Create a model with a deprecation_date
  2. Configure versions on that model with a single version (v: 1)
  3. Suddenly the deprecation_date "disappears" on that model in dbt ls output / manifest

Relevant log output

No response

Environment

dbt: 1.10.0-a1 (main)

Which database adapter are you using with dbt?

No response

Additional Context

No response

@jtcohen6 jtcohen6 added bug Something isn't working model_versions labels Dec 23, 2024
Copy link
Contributor

Thank you for your bug report! Our team is will be out of the office for Christmas and our Global Week of Rest, from December 25, 2024, through January 3, 2025.

We will review your issue as soon as possible after returning.
Thank you for your understanding, and happy holidays! 🎄🎉

If you are a customer of dbt Cloud, please contact our Customer Support team via the dbt Cloud web interface or email [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working model_versions
Projects
None yet
Development

No branches or pull requests

1 participant