Skip to content

Commit

Permalink
Fix #10988: Validate manifest has group_map during group_lookup init (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke authored Nov 14, 2024
1 parent 6e1f64f commit 2c43af8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
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 @@ def init(manifest: Optional[Manifest], selected_ids: AbstractSet[str]) -> None:
if not manifest:
return

if not manifest.groups:
return

if not hasattr(manifest, "group_map"):
manifest.build_group_map()

_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

0 comments on commit 2c43af8

Please sign in to comment.