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-3319] [Bug] Running dbt.invoke(['deps']) changes the current working directory when using a DBT_PROJECT_DIR #8997
Comments
Good to get to hang with you at Coalesce in San Diego @jelstongreen 😎 Thanks for reporting this. We've had a few places where either the current working directory or relative paths throw a wrench into things, so I'll give this a look. |
I see what you are saying @jelstongreen 👍 When I tried it out a python script using programmatic invocations like you described, In contrast, all of the following leave the current working directory as-is (as expected):
Also in contrast, running the following without a python script within a CLI does not change the current working directory: pwd
dbt deps --project-dir project_a
pwd
|
Hey there @dbeatty10 thank you for taking a look and good news that you were able to reproduce. Is this likely to be fixed in an imminent release? |
I encountered the same issue and thoroughly investigated the code. I found directroy changes when initializing
I confirmed it works same as the behaviour of
I also confirmed that the same problem happens when executing If this is okay for you, I'll create a PR but what do you think about? I'm concerning about this will become breaking changes. |
@rariyama Thanks for taking a look! We're calling this a bug, because this directory switching after-effect of It feels like |
Hi @jtcohen6
I confirmed the directory change occurs only within with statement by making the above change. |
Is this a new bug in dbt-core?
Current Behavior
We use a nested directory structure like:
projects/
When using the env var
DBT_PROJECT_DIR
and invoking dbt using python runningdeps
the current working directory is modified to the be theDBT_PROJECT_DIR
which causes issues for the remaining python script.Expected Behavior
The working directory should not be affected by the invocation.
Steps To Reproduce
Use a multi project setup and invoke dbt deps using python whilst using the DBT_PROJECT_DIR env var.
Relevant log output
Environment
Which database adapter are you using with dbt?
spark
Additional Context
Databricks
The text was updated successfully, but these errors were encountered: