Skip to content
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

[dagster-dbt] Add Profiles Directory to prepare_manifest #26928

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bkimjin
Copy link

@bkimjin bkimjin commented Jan 7, 2025

Summary & Motivation

Every time I ran dagster dev, there were errors on load, even though access to Dagster was fine. Upon research, it appears that Dagster is not using the environment variable DBT_PROFILES_DIR when preparing the manifest.

How I Tested These Changes

Fed the profiles_dir argument with the os environment variable, and ran dagster dev. Below is the log without the fix (modified some string values):

dagster dev
2025-01-07 15:22:33 -0800 - dagster - INFO - Launching Dagster services...
2025-01-07 15:22:35 -0800 - dagster.builtin - WARNING - An error was encountered when creating a handle to the dbt adapter in Dagster.
Traceback (most recent call last):
  File "/[email protected]/lib/python3.10/site-packages/dagster_dbt/core/resource.py", line 677, in cli
    adapter = self._initialize_adapter(cli_vars)
  File "/[email protected]/lib/python3.10/site-packages/dagster_dbt/core/resource.py", line 366, in _initialize_adapter
    profile = load_profile(self.project_dir, cli_vars, self.profile, self.target)
  File "/[email protected]/lib/python3.10/site-packages/dbt/config/runtime.py", line 71, in load_profile
    profile = Profile.render(
  File "/[email protected]/lib/python3.10/site-packages/dbt/config/profile.py", line 403, in render
    return cls.from_raw_profiles(
  File "/[email protected]/lib/python3.10/site-packages/dbt/config/profile.py", line 360, in from_raw_profiles
    raise DbtProjectError("Could not find profile named '{}'".format(profile_name))
dbt.exceptions.DbtProjectError: Runtime Error
  Could not find profile named 'custom_profile_name'
2025-01-07 15:22:43 -0800 - dagster.daemon - INFO - Instance is configured with the following daemons: ['AssetDaemon', 'BackfillDaemon', 'SchedulerDaemon', 'SensorDaemon']
2025-01-07 15:22:43 -0800 - dagster-webserver - INFO - Serving dagster-webserver on http://127.0.0.1:3000 in process 4397

And here's the output with the fix:

dagster dev
2025-01-07 15:21:40 -0800 - dagster - INFO - Launching Dagster services...
2025-01-07 15:21:52 -0800 - dagster.daemon - INFO - Instance is configured with the following daemons: ['AssetDaemon', 'BackfillDaemon', 'SchedulerDaemon', 'SensorDaemon']
2025-01-07 15:21:55 -0800 - dagster-webserver - INFO - Serving dagster-webserver on http://127.0.0.1:3000 in process 3339

Changelog

  • Add profiles directory in preparing manifest to reduce profile not found error

Copy link
Contributor

@maximearmstrong maximearmstrong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bkimjin - thanks for your contribution. In terms of design, this change will require more that supporting the DBT_PROFILES_DIR env var in _prepare_manifest.

This issue is related to this problem.

I will work on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants