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

Fix #10988: Validate manifest has group_map during group_lookup init #10995

Merged
merged 3 commits into from
Nov 14, 2024
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/Fixes-20241113-171516.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Validate manifest has group_map during group_lookup init
time: 2024-11-13T17:15:16.176082Z
custom:
Author: aranke
Issue: "10988"
6 changes: 6 additions & 0 deletions core/dbt/task/group_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
if not manifest:
return

if not manifest.groups:
return

aranke marked this conversation as resolved.
Show resolved Hide resolved
if not hasattr(manifest, "group_map"):
manifest.build_group_map()

Check warning on line 18 in core/dbt/task/group_lookup.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/group_lookup.py#L18

Added line #L18 was not covered by tests

_every_group_name_to_group_map = {v.name: v for v in manifest.groups.values()}

for group_name, node_ids in manifest.group_map.items():
Expand Down
12 changes: 12 additions & 0 deletions tests/functional/logging/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,15 @@ def test_node_info_on_results(self, project, logs_dir):
run_result_warning_count += 1

assert run_result_warning_count == 1


class TestRunResultNoGroup:
@pytest.fixture(scope="class")
def models(self):
return {
"my_model.sql": "select 1 as id",
}

def test_node_info_on_results(self, project, logs_dir):
results = run_dbt(["--no-write-json", "run"])
assert len(results) == 1