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

Enable deprecation: models-key-mismatch #3899

Closed
emmyoop opened this issue Sep 16, 2021 · 3 comments · Fixed by #3959
Closed

Enable deprecation: models-key-mismatch #3899

emmyoop opened this issue Sep 16, 2021 · 3 comments · Fixed by #3959
Assignees

Comments

@emmyoop
Copy link
Member

emmyoop commented Sep 16, 2021

models-key-mismatch

Introduced in: v0.16
In the last week, raised by: 34 projects (<1%)

This is a tricky one: We actually removed this deprecation warning in v0.20, when we removed the patch_nodes method. But the to-be-deprecated functionality is still supported.

https://github.com/dbt-labs/dbt/blob/745ae3e64ac03fedb19228b31252fea05eb0ed37/core/dbt/contracts/graph/manifest.py#L685-L691

I'd like to re-add the conditional check for whether a non-model (a seed, snapshot, etc) is specified under the models: key, and start raising a clear exception for this in v1.0. This may require some work with @gshank to find where this logic has moved in v0.20+.

Once done, we can also remove this from the list of active deprecations, since it's no longer referenced anywhere in the code!

Originally posted by @jtcohen6 in #2798 (comment)

@emmyoop emmyoop self-assigned this Sep 16, 2021
@emmyoop
Copy link
Member Author

emmyoop commented Sep 21, 2021

@gshank can you help point me to where this logic moved to in v0.20+?

@emmyoop emmyoop linked a pull request Sep 29, 2021 that will close this issue
4 tasks
@emmyoop
Copy link
Member Author

emmyoop commented Sep 29, 2021

@jtcohen6 This task was originally to raise an exception when a non-model is specified under the models: key. After talking with @gshank it turns out when that happens there is no unique_id on the patch. This is true for all refable entities. Should I raise an exception for all cases (models, seeds, snapshots) or just raise an exception for models and warn in other cases?

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 29, 2021

@emmyoop Some details and a quick reproduction case, based on what we discussed earlier:

Create a seed, seeds/my_seed.csv:

id
1

Then define properties for it under a models block:

# models/whatever.yml
version: 2
models:
  - name: my_seed
    description: "This is my very cool seed"

In previous versions of dbt (e.g. v0.19), we raised a deprecation warning for this:

* Deprecation Warning: "my_seed" is a seed node, but it is specified in the
models section of models/schema.yml.

To fix this warning, place the `my_seed` specification under the seeds key
instead.
This warning will become an error in a future release.

For backwards compatibility, though, we'd still apply the description to my_seed.

As of v0.20, we removed the deprecation warning, but continued with the previous backwards-compatible functionality, by applying the description to the seed. In effect, we un-deprecated the feature.

$ dbt ls -s my_seed --output json --output-keys name,description
{"name": "my_seed", "description": "This is my very cool seed"}

In v1.0, I'd like to:

  • stop applying the properties to resources of the wrong type (i.e. ignore my_seed under models)
  • raise a warning that we found a resource by that name, of the wrong type, and to please move it under the right key instead

@jtcohen6 jtcohen6 removed their assignment Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants