PicnicSupermarket / dbt-score

Linter for dbt metadata
https://dbt-score.picnic.tech
MIT License
84 stars 7 forks source link

Allow specifying of "project-dir" #67

Open ybressler opened 3 months ago

ybressler commented 3 months ago

Want:

--project-dir cli argument.

Explanation:

Similar to dbt run --project-dir my-project/, I want to be able to parse and lint my project in a single command.

My current workaround is to run dbt parse ... then point to the manifest. But I'd rather have a single command.

matthieucan commented 3 months ago

Thanks for reporting and sharing your use-case! Out of curiosity, does dbt-score run in the same virtual environment as dbt? (alternatively, does dbt run in a virtual environment, or is it installed system-wide?)

dbt-score makes use of the environment variable DBT_PROJECT_DIR to look for the dbt project. However I'm afraid it only works if that variable is a relative path appended to the current working directory, but making it work with absolute paths should be very easy Ref: https://github.com/PicnicSupermarket/dbt-score/blob/master/src/dbt_score/dbt_utils.py#L59-L66

jochemvandooren commented 3 months ago

Also, just to check:

Have you tried running dbt-score lint --run-dbt-parse? It will actually try to run dbt parse, you will have to make sure your environment is setup correctly so it can find the dbt project though!

ybressler commented 3 months ago
matthieucan commented 3 months ago

Understood, thanks for the additional info. I think this feature definitely makes sense. Would you like to contribute it?