-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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-3297] [Bug] --select
matches models with the same name from all installed packages
#8954
Comments
cc: @jtcohen6 @MichelleArk, as you were working on |
--select
matches models with the same name from all installed packages
Thanks for raising this @jaklan ! You listed (4) main expectations:
I think that we currently fulfill the middle two expectations and it's the first and last ones in which you were surprised by the current behavior. Met expectations2.
Indeed, this can be done currently in a variety of ways. Here's a sampling: dbt list -s package_a.my_model
dbt list -s "package_a.my_model"
dbt list -s 'package_a.my_model'
dbt list -s my_model,package:package_a
dbt list -s package:package_a,my_model 3.
This can also be done: dbt list -s "*.my_model"
dbt list -s '*.my_model' Unmet expectations1.
As you pointed out, this will list all the matching nodes: dbt list -s my_model
That's just the the way selection works; by default it will match across all the installed packages unless you specifically restrict it. #6891 would give a convention that would restrict selections to the current package. Either alternatively (or in conjunction), we could choose to create a global config that would allow a project-wide setting to restrict selections to the current package only. Something like 4.
A this point in time, we don't have plans to expand the scope to affect selection as well. The difference between access levels and ability to select a node:
SummaryI'm going to close this as "wont_fix" because it looks like dbt is currently behaving how we intend and expect. However, I'll leave it up to you if you want to pursue opening one or more feature requests if there's net-new functionality you are hoping to see (like #6891 or a new global config environment variable like |
@dbeatty10 thank you again for the detailed response!
|
a 4. expectation
One way to do this would be a new config within It could behave like this: When
When
Feature requests for further discussion
💡 Absolutely! Appreciate all your perspectives on this @jaklan. Feel free to create feature requests any time. Even when any idea has already been discussed previously, we're comfortable revisiting past decisions and either affirming them or updating our thinking. At this time, I'm not personally planning to submit a feature request for the Great ideas within #6891 (comment). We'll probably end up converting that comment into one or more stand-alone feature requests for further discussion. |
@dbeatty10 imho that's a very good proposal! I would definitely create a feature request based on that idea this week, I will link it here when ready. Ad #6891 - sure, please let me know if you need any help with that. |
Is this a new bug in dbt-core?
Current Behavior
When you have a model with the same name in both current project and packages installed as dependencies and you run e.g.
dbt compile -s some_model
-dbt
will compile all models with such name (== models from all packages).Access modifiers doesn't change the above behaviour - even if an installed package has
restrict-access
set toTrue
, such model can be defined as any ofprivate
,protected
,public
and the effect would be exactly the same.Expected Behavior
I would expect
dbt
to only select a model from the current project (namespace).-s "another_package.some_model"
.-s "*.some_model"
.Moreover, I believe it shouldn't be possible to select
private
andprotected
models from a package withrestrict-access: True
at all.Steps To Reproduce
package_a
withrestrict-access: True
model_a
inpackage_a
private
,protected
,public
- effect would be the samepackage_b
package_a
as a dependency inpackage_b
model_a
inpackage_b
dbt compile -s model_a
insidepackage_b
dbt
compilesmodel_a
from both packagesRelevant log output
No response
Environment
Which database adapter are you using with dbt?
redshift
Additional Context
No response
The text was updated successfully, but these errors were encountered: