-
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
[Bug] Environment variables take precedence over CLI flags that appear after the subcommand #10304
Comments
Thanks for reporting this @joellabes 🤩 See below for a simple way to reproduce your report -- even if there's no resources defined in a project. ReprexDBT_QUIET=0 dbt --quiet list
DBT_QUIET=0 dbt list --quiet
Woah! Different output 🤯 Observed precedence vs. documented precendeceOur documented order of precedence is:
❌ But the observed precedence distinguishes between flags before the subcommand vs. after the subcommand:
Affected versionsThe reprex above gives the same result for 1.7 and 1.8. Although this example won't work on 1.6 and 1.5, I'd guess those versions are affected as well. |
Acceptance criteria
|
Just to be clear - sounds like it's not actually related to whether or not you set the environment variable inline (i.e. |
Correct @graciegoheen -- I tested out "inline" environment variables vs. exporting environment variables, and they both behaved the same. But when I moved the CLI flag either before or after the subcommand, then I saw the precedence change. |
Brief historyThe dbt CLI started using the Then we introduced support supporting flags in any order, either before or after [1] [2]. This was released in dbt-core 1.7.0 and backported to 1.5 and 1.6. ✨ Finally, we updated our CLI documentation to specify that flags should be passed after subcommands. Passing them before is considered legacy functionality that may be removed in the future [3] [4]. |
Thanks for that information @dbeatty10 - if this is for legacy behavior, I'm not sure we should spend the effort fixing this |
It's actually the opposite! What we've described as legacy behavior is working as expected. But what we've said that people should do is not working as expected. |
Updated the ticket accordingly! |
Is this a new bug in dbt-core?
Current Behavior
As requested by @graciegoheen
The docs say
But the observed precedence distinguishes between flags before the subcommand vs. after the subcommand
Acceptance criteria
Steps To Reproduce
See Doug's comment below
The text was updated successfully, but these errors were encountered: