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

Improve error message for packages missing dbt_project.yml #6685

Merged
merged 3 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20230120-112921.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Improve error message for packages missing `dbt_project.yml`
time: 2023-01-20T11:29:21.509967-07:00
custom:
Author: dbeatty10
Issue: "6663"
9 changes: 6 additions & 3 deletions core/dbt/config/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
{error}
"""

MISSING_DBT_PROJECT_ERROR = """\
No dbt_project.yml found at expected path {path}
Verify that each entry within packages.yml (and their transitive dependencies) contains a file named dbt_project.yml
"""


@runtime_checkable
class IsFQNResource(Protocol):
Expand Down Expand Up @@ -163,9 +168,7 @@ def _raw_project_from(project_root: str) -> Dict[str, Any]:

# get the project.yml contents
if not path_exists(project_yaml_filepath):
raise DbtProjectError(
"no dbt_project.yml found at expected path {}".format(project_yaml_filepath)
)
raise DbtProjectError(MISSING_DBT_PROJECT_ERROR.format(path=project_yaml_filepath))

project_dict = _load_yaml(project_yaml_filepath)

Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ def test_no_project(self):
with self.assertRaises(dbt.exceptions.DbtProjectError) as exc:
dbt.config.Project.from_project_root(self.project_dir, renderer)

self.assertIn('no dbt_project.yml', str(exc.exception))
self.assertIn('No dbt_project.yml', str(exc.exception))

def test_invalid_version(self):
self.default_project_data['require-dbt-version'] = 'hello!'
Expand Down