question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dbt project must be in the current working directory

See original GitHub issue

Related #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:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pvonglehncommented, May 20, 2021

Would also love to see config support for dbt’s --profile-dir argument. This might be easily added to @pvonglehn’s #898?

@andyenkeboll-iex, yes PR #898 will implement support for --profile-dir. Just resolving a few issues in the PR.

0reactions
alanmcruickshankcommented, Oct 8, 2021

I think this issue is resolved now that #898 is merged 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found