AltimateAI / vscode-dbt-power-user

This extension makes vscode seamlessly work with dbt™: Auto-complete, preview, column lineage, AI docs generation, health checks, cost estimation etc
https://www.altimate.ai
MIT License
460 stars 94 forks source link

Respect dbt's `model-paths` setting #420

Closed kostek-pl closed 1 month ago

kostek-pl commented 1 year ago

Expected behavior

In our company we have a slight different folder structure - the main difference is that we have separate folders for configurations and resources. It seems that this great extension doesn't honor such setup - when resources i.e. models are in a different folder than dbt project it stops working. I discovered that the problem is with relative paths in resource definition(of course dbt is working as expected)

example folder structure:

models/ ├─ example/ │ ├─ my_first_dbt_model.sql │ ├─ my_second_dbt_model.sql │ ├─ schema.yml sample_project/ ├─ analyses/ ├─ macros/ ├─ seeds/ ├─ snapshots/ ├─ tests/ ├─ dbt_project.yml ├─ README.md

in dbt_project.yml there is model-paths: ["../models"] instead of model-paths: ["models"] and it works from dbt perspective but for some reason vscode-dbt-power-user does not allow this - target is not generated and in model compilation version there is "Still loading dbt project, please try again later..." sentence.

Actual behavior

Extension doesn't work

Steps To Reproduce

This can be easily reproduced by setting up dbt initial project:

dbt init

Then move models folder outside of project folder

Last thing is to adjust models path in dbt_project.yml from model-paths: ["models"] to model-paths: ["../models"]

Log output/Screenshots

No response

Operating System

windows

dbt version

1.4.6

dbt Adapter

dbt-redshift

dbt Power User version

v0.12.2

Are you willing to submit PR?

mdesmet commented 11 months ago

@gaurpulkit:

  1. Figure out a way of getting the setting through the dbt_integration.py
  2. Ensure file watchers are setup correctly based on the found path
ryan-pip commented 3 months ago

I have the same problem. Would love to see this resolved. Happy to raise a PR if someone can point me roughly in the right part of the code to start

mdesmet commented 1 month ago

If the folder is outside of the vscode workspace this is not supported because of vscode security limitations. Otherwise this should work as expected in current version. Please reopne if not working.