-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE-388] Add group metadata info to
LogModelResult
and `LogTestRe…
…sult` (#10775)
- Loading branch information
Showing
13 changed files
with
433 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add group metadata info to LogModelResult and LogTestResult | ||
time: 2024-09-26T14:34:48.334703+01:00 | ||
custom: | ||
Author: aranke | ||
Issue: "10775" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from typing import AbstractSet, Dict, Optional, Union | ||
|
||
from dbt.contracts.graph.manifest import Manifest | ||
from dbt.contracts.graph.nodes import Group | ||
|
||
_node_id_to_group_name_map: Dict[str, str] = {} | ||
_group_name_to_group_map: Dict[str, Group] = {} | ||
|
||
|
||
def init(manifest: Optional[Manifest], selected_ids: AbstractSet[str]) -> None: | ||
if not manifest: | ||
return | ||
|
||
_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(): | ||
for node_id in node_ids: | ||
# only add node to lookup if it's selected | ||
if node_id in selected_ids: | ||
_node_id_to_group_name_map[node_id] = group_name | ||
|
||
# only add group to lookup if it's not already there and if node is selected | ||
if group_name not in _group_name_to_group_map: | ||
_group_name_to_group_map[group_name] = _every_group_name_to_group_map[ | ||
group_name | ||
] | ||
|
||
|
||
def get(node_id: str) -> Optional[Dict[str, Union[str, Dict[str, str]]]]: | ||
group_name = _node_id_to_group_name_map.get(node_id) | ||
|
||
if group_name is None: | ||
return None | ||
|
||
group = _group_name_to_group_map.get(group_name) | ||
|
||
if group is None: | ||
return None | ||
|
||
return group.to_logging_dict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.