Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
elic-eon committed Aug 13, 2024
1 parent 8c96449 commit 768f5ee
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions metaphor/unity_catalog/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ def _get_catalogs(self) -> List[str]:

catalog_names = []
for catalog in catalogs:
if catalog.name:
catalog_names.append(catalog.name)
if catalog.name is None:
continue

Check warning on line 239 in metaphor/unity_catalog/extractor.py

View check run for this annotation

Codecov / codecov/patch

metaphor/unity_catalog/extractor.py#L239

Added line #L239 was not covered by tests

catalog_names.append(catalog.name)
if not catalog.owner:
continue

Check warning on line 243 in metaphor/unity_catalog/extractor.py

View check run for this annotation

Codecov / codecov/patch

metaphor/unity_catalog/extractor.py#L243

Added line #L243 was not covered by tests

hierarchy = self._assert_hierarchy(catalog.name)
hierarchy = self._init_hierarchy(catalog.name)
hierarchy.system_contacts = SystemContacts(
contacts=[
SystemContact(
Expand All @@ -262,7 +264,7 @@ def _get_schemas(self, catalog: str) -> List[str]:
if not schema.owner:
continue

Check warning on line 265 in metaphor/unity_catalog/extractor.py

View check run for this annotation

Codecov / codecov/patch

metaphor/unity_catalog/extractor.py#L265

Added line #L265 was not covered by tests

hierarchy = self._assert_hierarchy(catalog, schema.name)
hierarchy = self._init_hierarchy(catalog, schema.name)
hierarchy.system_contacts = SystemContacts(
contacts=[
SystemContact(
Expand Down Expand Up @@ -492,7 +494,7 @@ def collect_query_logs(self) -> Iterator[QueryLog]:
):
yield query_log

def _assert_hierarchy(
def _init_hierarchy(
self,
catalog: str,
schema: Optional[str] = None,
Expand All @@ -511,11 +513,11 @@ def _assert_hierarchy(
def _extract_hierarchies(self, catalog_system_tags: CatalogSystemTags) -> None:
for catalog, (catalog_tags, schema_name_to_tag) in catalog_system_tags.items():
if catalog_tags:
hierarchy = self._assert_hierarchy(catalog)
hierarchy = self._init_hierarchy(catalog)
hierarchy.system_tags = SystemTags(tags=catalog_tags)
for schema, schema_tags in schema_name_to_tag.items():
if schema_tags:
hierarchy = self._assert_hierarchy(catalog, schema)
hierarchy = self._init_hierarchy(catalog, schema)
hierarchy.system_tags = SystemTags(tags=schema_tags)

def _fetch_catalog_system_tags(self, catalog: str) -> CatalogSystemTagsTuple:
Expand Down

0 comments on commit 768f5ee

Please sign in to comment.