dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.93k stars 1.63k forks source link

[CT-1001] some kind of bug when trying to initialize a project from initial container #5622

Open avnav0 opened 2 years ago

avnav0 commented 2 years ago

not sure if this is dbt-bigquery image related, but that's the one i was using:

root@mydomain:/home/user/_volumes/_postgres/_queries/dbt_test# podman run \
                -p 8085:8085 \
                -v /home/user/_volumes/_postgres/_queries/dbt_test/_mytest/:/usr/app/ \
                --mount type=bind,source=/home/user/_volumes/_postgres/_queries/dbt_test/_mytest/_profiles/,target=/root/.dbt/ \
                dbt-bigquery:1.2.latest \
                init __testproj

22:05:49  Running with dbt=1.2.0

Which database would you like to use?
[1] bigquery

(Don't see the one you want? https://docs.getdbt.com/docs/available-adapters)

Enter a number: 1
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/dbt/main.py", line 129, in main
    results, succeeded = handle_and_check(args)
  File "/usr/local/lib/python3.10/site-packages/dbt/main.py", line 192, in handle_and_check
    task, res = run_from_args(parsed)
  File "/usr/local/lib/python3.10/site-packages/dbt/main.py", line 239, in run_from_args
    results = task.run()
  File "/usr/local/lib/python3.10/site-packages/dbt/task/init.py", line 324, in run
    adapter = self.ask_for_adapter_choice()
  File "/usr/local/lib/python3.10/site-packages/dbt/task/init.py", line 254, in ask_for_adapter_choice
    numeric_choice = click.prompt(prompt_msg, type=click.INT)
  File "/usr/local/lib/python3.10/site-packages/click/termui.py", line 166, in prompt
    value = prompt_func(prompt)
  File "/usr/local/lib/python3.10/site-packages/click/termui.py", line 149, in prompt_func
    raise Abort() from None
click.exceptions.Abort
22:05:59  Encountered an error:

root@mydomain:/home/user/_volumes/_postgres/_queries/dbt_test# 1
-bash: 1: command not found

the _mytest and _profiles directories are completely empty...not sure if that's related?

jtcohen6 commented 2 years ago

@avnav88 Thanks for opening!

I don't know if we've ever tested running dbt init from one of our Docker containers. I wouldn't be surprised if this is an issue that's fairly unique to the way that the init task interacts with the file system (loading the starter project from within dbt-core, and profile_template.yml for the current project / adapter).

This isn't something we're likely to prioritize. I don't think it's very common to go through the full interactive CLI init setup when running dbt via Docker. If you want to skip profile creation, and just create the starter project, you could pass the -s/ --skip-profile-setup flag.