vscode-dbt-power-user: dbt command does not found in multi-root workspace folder

Expected behavior

In our project, we use multi-root workspace.

The folder structure of this project is like this.

.
├── project.code-workspace
├── dbt
│  ├── dbt_project.yml
│  ├── pyproject.toml
│  ├── ...
├── other-workspace-folder
│  ├── ...

As a priority for resolving dbt command paths, we expect the following,

  1. If it is set, the settings of dbt-power-user extension.
  2. Python virtual environment on each workspace folder like dbt folder.
  3. Python virtual environment on workspace root.
  4. Global environment ($PATH)

Actual behavior

The path finding for dbt power user is as follows:

  1. If it is set, the settings of dbt-power-user extension.
  2. Python virtual environment on workspace root.

This python enviroment is determined the first time VSCode is opened, so moving workspace folders does not change the Python virtual environment settings.

Steps To Reproduce

  1. use multi-workspace.
  2. add sample workspace-folder and create dbt project on it.
  3. create python virtual environment on the sample workspace.
  4. set python virtual environment on the sample workspace. figure
  5. install dbt-core in the python virtual environment on the sample workspace.
  6. open sample/dbt_project.yml

Log output/Screenshots

https://private-user-images.githubusercontent.com/47286750/289367172-311f6d7f-f917-469a-8a9a-4f547416d3ba.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDIyNjEzOTEsIm5iZiI6MTcwMjI2MTA5MSwicGF0aCI6Ii80NzI4Njc1MC8yODkzNjcxNzItMzExZjZkN2YtZjkxNy00NjlhLThhOWEtNGY1NDc0MTZkM2JhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjExVDAyMTgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFjZTQ1MjYzOGExMDdhYzM4MjM1Zjk2NjNhMzI1NzA3MmYwZDRkMGIzMjFiNWRmOWY0MThiZjhlZjllY2U0N2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.S7E_pLOh74ScMYS_NFfMVzTlBsqXSUiaTFTZdnNSJ7Q

Operating System

Mac OS 14.1.1(23B81)

dbt version

1.7.3

dbt Adapter

1.7.0

dbt Power User version

v0.27.3

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

About this issue

  • Original URL
  • State: open
  • Created 7 months ago
  • Reactions: 3
  • Comments: 15 (12 by maintainers)

Most upvoted comments

I just wanted to add a small note regarding what was said previously :

When using multi-root workspace folders, if the first folder is a DBT project, then the extension seems to work fine for that project. So in your VS Code Project definition, re-ordering folders to put the DBT project as the first folder fixes things for the said DBT environment.

It’s a quite nice workaround unless you have other projects/plugins that are not multi-root compatible like DBT power user, or unless you have multiple DBT projects with different configs

@yassun7010 let us know if you need help making these changes