vscode-dbt-power-user
vscode-dbt-power-user copied to clipboard
Wrong working directory when running dbt build
Expected behavior
the dbt command should be run in the actual dbt project directory (where the profile is).
Actual behavior
currently it runs in the workspace root and relative paths to a duckdb-file are wrong.
Steps To Reproduce
click to build a dbt model
Log output/Screenshots
11:02:35 Running with dbt=1.7.4
11:02:35 Registered adapter: duckdb=1.7.0
11:02:36 Found 31 models, 24 sources, 0 exposures, 0 metrics, 506 macros, 0 groups, 0 semantic models
11:02:36
11:02:36
11:02:36 Finished running in 0 hours 0 minutes and 0.04 seconds (0.04s).
11:02:36 Encountered an error:
Runtime Error
IO Error: Cannot open file "/workspaces/automation-data/../cmdb.duckdb": Permission denied
Operating System
Ubuntu 22.04
dbt version
1.7.4
dbt Adapter
duckdb
dbt Power User version
30.1
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
looks like the dbt project directory should be set here instead of the workspace root:
https://github.com/AltimateAI/vscode-dbt-power-user/blob/81feeeff48a451c18155cc3c5ce1875366bb7942/src/dbt_client/dbtIntegration.ts#L80
this used to run for a couple of days the last week or so but is broken again since a couple of days.
@OneCyrus could you please let us know which version was previously working and which version you are currently using?
@anandgupta42 i just tried to identify the broken versions and the PRs which changed the behavior.
... latest doesn't work 0.31.6 - doesn't work (PR #895 likely braked it again) 0.31.5 - works 0.31.4 - works (PR #880 likely fixed the issue) 0.31.3 - doesn't work ... before it didn't work
@OneCyrus Thank you for the detailed analysis. We appreciate your patience and effort. We have identified that we don't have sufficient test coverage for duckdb, and it is the only database that relies on file-based storage. We will work on debugging this issue today and will get back to you as soon as possible.
Thank you again for your help.
Also, do you have the steps to reproduce the issue or a sample project that we can use to debug?
i'll see if i can create a sample project. the main issue is that the duckdb file is referenced relative to the project.
basically the following config is sensitive to the working directory. as we have a shared duckdb for multiple projects we need relative paths. this works perfectly fine with the dbt commandline when executing in the dbt project folder. also triggering from dagster works as well.
workplace:
target: local
outputs:
local:
type: duckdb
path: ../cmdb.duckdb
schema: workplace
@anandgupta42 : We need to make a decision to set the CWD to the project directory, the issue why we removed that is quite an exotic one.
@mdesmet any decision yet? this blocks us from materializing dbt models with the extension
Actually the CWD is set to the workspace root. Maybe you can just adapt you relative paths to accommodate for that?