Skip to content

Commit

Permalink
return parent as EnityRef in search result
Browse files Browse the repository at this point in the history
  • Loading branch information
LavMatt committed Jul 3, 2024
1 parent 0deccdf commit d68cf3a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions lib/datahub-client/data_platform_catalogue/client/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
parse_properties,
parse_tags,
)
from data_platform_catalogue.entities import EntityRef
from data_platform_catalogue.search_types import (
FacetOption,
MultiSelectFilter,
Expand Down Expand Up @@ -232,24 +233,15 @@ def _parse_result(
last_modified = parse_last_modified(entity)
name, display_name, qualified_name = parse_names(entity, properties)
container = entity.get("container")
if container:
container_name, container_display_name, container_qualified_name = (
parse_names(container, container.get("properties"))
)
domain = parse_domain(entity)

metadata = {
"owner": owner.display_name,
"owner_email": owner.email,
"parent_container_display_name": (
container.get("properties").get("name")
if container is not None
else None
),
"parent_container_fqn": (
container.get("properties").get("qualifiedName")
if container is not None
else None
),
"parent_container_urn": (
container.get("urn") if container is not None else None
),
"total_parents": entity.get("relationships", {}).get("total", 0),
"domain_name": domain.display_name,
"domain_id": domain.urn,
Expand All @@ -270,6 +262,11 @@ def _parse_result(
name=name,
display_name=display_name,
fully_qualified_name=qualified_name,
parent_entity=(
EntityRef(urn=container.get("urn"), display_name=container_display_name)
if container
else None
),
description=properties.get("description", ""),
metadata=metadata,
tags=tags,
Expand Down

0 comments on commit d68cf3a

Please sign in to comment.