Dbt project must be in the current working directory
See original GitHub issueRelated #597
The current implementation of the dbt templater assumes that the project root is the current working directory. It would be good to have a config to support:
- Having the project in another directory
- Having multiple dbt projects
for example:
dbt_project_roots = ./project_team_1,./project_team_2
This is actually quite painful right now with pre-commit, I tried on our project at Earnest which is in a sub-directory and had to write the following:
entry: |
python -c '
import os
import sys
import subprocess as sp
os.chdir("earnest_shared")
file_names = [
f.lstrip("earnest_shared/")
for f in sys.argv[1:]
]
return_code = sp.run(["sqlfluff", "lint"] + file_names).returncode
if return_code:
raise Exception("Some linting issues were found")'
cc. @NiallRees
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (3 by maintainers)
Top Results From Across the Web
"Missing dbt_project.yml file" error message - dbt Discourse
From your terminal, try running pwd (print working directory) – this will return your current directory. If the path it gives back isn't...
Read more >About dbt projects - dbt Developer Hub
During project initialization, dbt creates sample model files in your project directory to help you start developing quickly.
Read more >Connection profiles - dbt Developer Hub
A profile contains all the details required to connect to your data warehouse. dbt will search the current working directory for the profiles....
Read more >Debugging errors - dbt Developer Hub
Recent errors will be at the bottom of the file. dbt Cloud users: Use the ... fatal: Not a dbt project (or any...
Read more >Getting started with dbt Core - dbt Developer Hub
Open your project in your favorite code editor. · Create a new SQL file in the models directory, named models/customers.sql . · Paste...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@andyenkeboll-iex, yes PR #898 will implement support for --profile-dir. Just resolving a few issues in the PR.
I think this issue is resolved now that #898 is merged 👍