Skip to content

Commit

Permalink
Add typing for _get_member_yaml
Browse files Browse the repository at this point in the history
return None on unknown ManifestNode
  • Loading branch information
VDFaller committed Mar 21, 2024
1 parent fd478d0 commit 0b24696
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dbt_osmosis/core/column_level_knowledge_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ def _build_node_ancestor_tree(
return family_tree


def _get_member_yaml(member):
def _get_member_yaml(member: ManifestNode) -> Optional[dict]:
"""Get the yaml for a member from the file in the manifest, only returns relevant section"""
if isinstance(member, SourceDefinition):
key = "tables"
elif isinstance(member, ModelNode):
key = "models"
elif isinstance(member, SeedNode):
key = "seeds"
else:
print(f"Unrecognized member type: {type(member)}")
return None

data = None
if key == "tables" and hasattr(member, "original_file_path") and member.original_file_path:
with Path(member.original_file_path).open("r") as f:
Expand Down

0 comments on commit 0b24696

Please sign in to comment.