You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
dbt improperly ignores the --target CLI flag when environment variable DBT_TARGET is set.
$ export DBT_TARGET=nonvalid_target
$ dbt build --project-dir /dbt --target dev
12:31:08 Running with dbt=1.8.3
12:31:08 Encountered an error:
Runtime Error
The profile 'xxx' does not have a target named 'nonvalid_target'. The valid target names for this profile are:
- dev
- prod
Expected Behavior
According to the documentation regarding flags (link):
The most specific setting "wins." If you set the same flag in all three places, the CLI option will take precedence, followed by the environment variable, and finally, the value in dbt_project.yml.
So I would expect the --target CLI option to be used even though the env var is set.
Steps To Reproduce
Set environment variable DBT_TARGET
Invoke dbt, passing the --target option for a target different than the contents of DBT_TARGET
Weep when dbt ignores --target and uses instead the contents of DBT_TARGET
dbeatty10
changed the title
[Bug] env var DBT_TARGET violates the rule of specificity
[Regression] env var DBT_TARGET violates the rule of specificity
Jul 10, 2024
Is this a new bug in dbt-core?
Current Behavior
dbt improperly ignores the
--target
CLI flag when environment variableDBT_TARGET
is set.Expected Behavior
According to the documentation regarding flags (link):
So I would expect the
--target
CLI option to be used even though the env var is set.Steps To Reproduce
DBT_TARGET
--target
option for a target different than the contents ofDBT_TARGET
--target
and uses instead the contents ofDBT_TARGET
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: