[Bug] dbt init
_always_ launches an interactive prompt when it finds a dbt project directory
#7594
Closed
2 tasks done
Is this a new bug in dbt-core?
Current Behavior
If the current working directory (or any parent directory) has a
dbt_project.yml
file, then the-s
or--skip-profile-setup
parameter is not respected fordbt init my_project
Expected Behavior
No interactive prompt for
dbt init
when the either-s
or--skip-profile-setup
parameter.Steps To Reproduce
Start with an empty folder with dbt 1.5.0 installed.
Create a minimal
dbt_project.yml
in the current working directory (it must have aprofile:
key):Run the following:
dbt init my_project --skip-profile-setup --profiles-dir .
Observe that it launches an interactive prompt:
Delete the
dbt_project.yml
file.Re-run a similar command as before:
dbt init my_project2 --skip-profile-setup --profiles-dir .
Observe that it does not launch an interactive prompt.
Relevant log output
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
We can see that
self.ask_for_adapter_choice()
is guarded byif not self.args.skip_profile_setup
here:dbt-core/core/dbt/task/init.py
Lines 301 to 304 in 05595f5
But it is not guarded here:
dbt-core/core/dbt/task/init.py
Line 276 in 05595f5
This can be solved a couple ways:
The text was updated successfully, but these errors were encountered: