Skip to content

Commit

Permalink
Enhance GraphQL queries to includeSoftDelete parameter for relationsh…
Browse files Browse the repository at this point in the history
…ips (#1210)

* Enhance GraphQL queries to includeSoftDelete parameter for relationships

* Enhance getContainer GraphQL query to includeSoftDelete parameter in relationships

* Refactor EntityParser to simplify description retrieval from entity properties

* Refactor EntityParser to streamline description retrieval from entity properties

* Fix EntityParser to handle None properties correctly in description retrieval
  • Loading branch information
murdo-moj authored Jan 8, 2025
1 parent 42281f1 commit e691519
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ query getChartDetails($urn: String!) {
name
}
relationships(
input: { types: ["Contains"], direction: INCOMING, start: 0, count: 10 }
input: {
types: ["Contains"]
direction: INCOMING
start: 0
count: 10
includeSoftDelete: false
}
) {
total
relationships {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ query getContainer($urn: String!) {
subTypes {
typeNames
}
relationships(input: {types: ["IsPartOf"], direction:INCOMING start: 0, count: 500 }) {
relationships(
input: {
types: ["IsPartOf"]
direction: INCOMING
start: 0
count: 500
includeSoftDelete: false
}
) {
total
relationships {
entity {
Expand All @@ -44,7 +52,9 @@ query getContainer($urn: String!) {
}
tags {
tags {
tag{urn}
tag {
urn
}
}
}
subTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ query getDashboard($urn: String!) {
description
}
relationships(
input: { types: ["Contains"], direction: OUTGOING, start: 0, count: 500 }
input: {
types: ["Contains"]
direction: OUTGOING
start: 0
count: 500
includeSoftDelete: false
}
) {
total
relationships {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ query getDatasetDetails($urn: String!) {
typeNames
}
parent_container_relations: relationships(
input: { types: ["IsPartOf"], direction: OUTGOING, count: 10 }
input: {
types: ["IsPartOf"]
direction: OUTGOING
count: 10
includeSoftDelete: false
}
) {
total
relationships {
Expand Down
12 changes: 5 additions & 7 deletions lib/datahub-client/data_platform_catalogue/client/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@


class EntityParser:
def __init__(self):
pass

def parse(self, search_response) -> SearchResult:
"""Parse graphql response to a SearchResult object"""
Expand Down Expand Up @@ -430,11 +428,11 @@ def parse_relations(
if relation.get("entity", {}).get("properties") is not None
else relation.get("entity").get("name", "")
)
description = (
relation.get("entity").get("properties", {}).get("description", "")
if relation.get("entity", {}).get("properties") is not None
else ""
)
properties = relation.get("entity", {}).get("properties")
if properties is not None:
description = properties.get("description") or ""
elif properties is None:
description = ""
tags = self.parse_tags(relation.get("entity"))
related_entities.append(
EntitySummary(
Expand Down

0 comments on commit e691519

Please sign in to comment.