-
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
[CT-2127] [Bug] Running dbt commands before deps results in dbt_packages folder creation at invocation location #6985
Comments
This Friday, the execution team will be talking about the future of core as a library and how we want to abstract certain functionality moving forward. The concept of changing directories and file systems will likely come up, so we will revisit this issue after we have discussed this in more detail! |
@stu-k "Paths are tricky" is definitely a fair topic for larger discussion. I do see this bug as being narrower in scope, and something that we could resolve without requiring us to first have full answer to the much broader question of, "How should It sounds like the Execution team will revisit this issue in a future BLG. If we decide that we shouldn't resolve this specific bug, except in the context of that much larger initiative, then we should close it. |
Glad this is already an open issue 🥇 We use the dbt Runner extensively and are currently forced to do some unstable infra gymnastics to work around this bug. cc @tanghyd |
@classicus-eth Glad you caught the bug report. This isn't high priority for us, so if you're motivated to fix it, we'd be happy to review an external contribution! |
Also running into this bug: when running I'm experimenting this with dbt 1.7.3. I was about to create a new issue before I found this one. I'd like to insist on a more general point : when running dbt from another location than the project dir, it seems silly to me that dbt paths are evaluated relative to the current working dir, instead of the project dir. In other words, when running |
Is this a new bug in dbt-core?
Current Behavior
On a
dbt run
issued through thedbtRunner.invoke
, dbt is attempting to create an empty defaultdbt_packages
directory at the location from which the command is being run, instead of at the project root.Expected Behavior
Any creation of a
dbt_packages
dir should default to the project rootSteps To Reproduce
This behavior was observed through use of the
dbtRunner
class in 1.5.0+, though it likely existed prior.dbtRunner
:dbt_packages
dir at the root of wherever this was invoked (if you have packages you needed to install, the error will be thrown but this dir will still be created)deps
first and then arun
dbt_packages
creation at the project root, no duplicate dir at the location of invocationRelevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres, snowflake
Additional Context
Everywhere that
packages_installation_path
is referenced in core, the value of that path is justdbt_packages
. I checked that value on parse, run, deps — that value remains the same.The absolute value of that path is what changes. Initially, and with any actions taken before doing a deps, the absolute value points to where I’m running it-- ~/dbt-core/dbt_packages. After running a deps and in all subsequent runs, the abspath points to the project-- ~/jaffle_shop/dbt_packages
This is the function call responsible for that change. That function calls an
os.chdir
, and we never change back (understandably). This function is not called for a run, so if deps is not called, this line on theCompiler
object is creating an empty dir at ~/dbt-server/dbt_packages .The text was updated successfully, but these errors were encountered: