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

Inconsistencies between --select "resource_type:test" and --resource-type test` #10753

Closed
dbeatty10 opened this issue Sep 22, 2024 · 1 comment
Labels
bug Something isn't working dbt tests Issues related to built-in dbt testing functionality duplicate This issue or pull request already exists node selection Functionality and syntax for selecting DAG nodes unit tests Issues related to built-in dbt unit testing functionality wontfix Not a bug or out of scope for dbt-core

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Sep 22, 2024

Originally posted by @seub in #10267 (comment):

Piggybacking, I noted similar bugs:

dbt ls --resource-type=test
dbt ls --select resource_type:test

The first command picks up unit tests, the second doesn't.

dbt ls --resource-type=model
dbt ls --select resource_type:model

The first command only picks up models, the second picks up models and tests.

Tested with dbt 1.8.3

@dbeatty10
Copy link
Contributor Author

Thanks for bringing up both of these examples @seub ! 🏆

Inconsistency 1

The inconsistency between these two was resolved by #10730 and will be available in dbt-core v1.9:

dbt ls --resource-type test
dbt ls --select resource_type:test

Inconsistency 2

The output of these two differs, but after digging into it actually looks like the behavior we expect:

dbt ls --resource-type model
dbt ls --select resource_type:model

Like you observed, the former only includes models whereas the latter includes all models plus their associated unit tests and data tests.

The reason is that the resource_type selection method applies before any indirect selection of associated unit tests and data tests. Then the --resource-type flag allows further filtering of all directly and indirectly selected nodes afterwards.

So this actually isn't an inconsistency after all, just a difference in how the resource_type and the --resource-type flag shape the final set of nodes to operate upon.

Summary

I'm going to close this as "not planned" since the 1st case was covered by #10727 and the 2nd case is expected behavior.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2024
@dbeatty10 dbeatty10 added bug Something isn't working duplicate This issue or pull request already exists wontfix Not a bug or out of scope for dbt-core node selection Functionality and syntax for selecting DAG nodes unit tests Issues related to built-in dbt unit testing functionality dbt tests Issues related to built-in dbt testing functionality labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dbt tests Issues related to built-in dbt testing functionality duplicate This issue or pull request already exists node selection Functionality and syntax for selecting DAG nodes unit tests Issues related to built-in dbt unit testing functionality wontfix Not a bug or out of scope for dbt-core
Projects
None yet
Development

No branches or pull requests

1 participant