-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DbtProject doesn't take profiles_dir and dbt_project.prepare_if_dev fails if DBT_PROFILES_DIR set in environment #26504
Comments
I believe I've run into the same issue when trying to add the The $ DBT_PROFILES_DIR=/Users/matt/dev/my_dbt_project/profiles/ poetry run dagster-dbt project scaffold --project-name my_dbt_project --dbt-project-dir ./src
Running with dagster-dbt version: 0.25.6.
Initializing Dagster project my_dbt_project in the current working directory for dbt project
directory /Users/matt/dev/my_dbt_project/src.
A profiles.yml file was not found in either /Users/matt/dev/my_dbt_project/src or
/Users/matt/.dbt. Please ensure that a valid profiles.yml exists in your environment. If I copy the $ poetry run dagster-dbt project scaffold --project-name my_dbt_project --dbt-project-dir ./src
Running with dagster-dbt version: 0.25.6.
Initializing Dagster project my_dbt_project in the current working directory for dbt project
directory /Users/matt/dev/my_dbt_project/src.
Using profiles.yml found in /Users/matt/dev/my_dbt_project/src/profiles.yml.
Your Dagster project has been initialized. To view your dbt project in Dagster, run the
following commands:
cd '/Users/matt/dev/my_dbt_project/my_dbt_project'
dagster dev |
A fix has been merged and will be included in the next release, see PR #27416. |
…-io#27416) ## Summary & Motivation Same as dagster-io#21108 but for `profiles_dir` and `profile`. In response to PR dagster-io#26928, fixes issue dagster-io#26504 ## How I Tested These Changes Additional tests with BK ## Changelog [dagster-dbt] Specifying a dbt profiles directory and profile is now supported in `DbtProject`.
What's the issue?
If
DBT_PROFILES_DIR
is set in your environment to a relative path in order to use a shared versioned one within your repository that usesenv_var
to avoid sharing secrets when you rundbt
commands directly, thendbt_project.prepare_if_dev
will fail.DbtCliResource
takesprofiles_dir
which you can set to a resolved absolute path when you declare theDbtCliResource
resource that everything else uses, butdbt_project.prepare_if_dev
instantiates its ownDbtCliResource
and only passesproject_dir
to it. This lets you overrideDBT_PROJECT_DIR
in the Dagster context but notDBT_PROFILES_DIR
, so the rawDBT_PROFILES_DIR
from your environment gets picked up and can't be overridden forDbtProject
's usage ofDbtCliResource
like it can for the rest of your project using your own configuredDbtCliResource
resource.DbtCliResource.run
changes directory into the dbt project directory before running with all other paths converted to absolute, but thenDBT_PROFILES_DIR
being set to something relative breaksdbt parse
What did you expect to happen?
DbtProject
should be configurable with a resolvedprofiles_dir
and passed toDbtCliResource
when invokedMaybe that's not the intended use of
DbtProject
as it's documented as only designed to capture information about the project itself and profiles could be considered not inherent to the project. ButDbtProject
making use ofDbtCliResource
and not being able to fully configure those uses like you can elsewhere seems problematic. I'm not sure what the best fix would be but I'm stuck with no path to makingDbtProject
's CLI calls work whenDBT_PROFILES_DIR
is set to something relative in my environment that works for runningdbt
directlyHow to reproduce?
No response
Dagster version
1.9.5
Deployment type
Local
Deployment details
No response
Additional information
No response
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
By submitting this issue, you agree to follow Dagster's Code of Conduct.
The text was updated successfully, but these errors were encountered: