Skip to content

fix(sdk): change deprecated value use #13511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions metadata-ingestion/src/datahub/api/graphql/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, List, Optional
from typing import Dict, List, Optional, Union

from gql import Client
from gql.transport.requests import RequestsHTTPTransport
Expand Down Expand Up @@ -39,16 +39,18 @@ def __init__(

def gen_filter(
self, filters: Dict[str, Optional[str]]
) -> Optional[Dict[str, List[Dict[str, str]]]]:
filter_expression: Optional[Dict[str, List[Dict[str, str]]]] = None
) -> Optional[Dict[str, List[Dict[str, Union[str, List[str]]]]]]:
filter_expression: Optional[
Dict[str, List[Dict[str, Union[str, List[str]]]]]
] = None
if not filters:
return None

filter = []
filter_list: List[Dict[str, Union[str, List[str]]]] = []
for key, value in filters.items():
if value is None:
continue
filter.append({"field": key, "value": value})
filter_list.append({"field": key, "values": [value]})

filter_expression = {"and": filter}
filter_expression = {"and": filter_list}
return filter_expression
8 changes: 4 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/graph/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def get_latest_timeseries_value(
filter_criteria_map: Dict[str, str],
) -> Optional[Aspect]:
filter_criteria = [
{"field": k, "value": v, "condition": "EQUAL"}
{"field": k, "values": [v], "condition": "EQUAL"}
for k, v in filter_criteria_map.items()
]
filter = {"or": [{"and": filter_criteria}]}
Expand Down Expand Up @@ -669,7 +669,7 @@ def get_domain_urn_by_name(self, domain_name: str) -> Optional[str]:
filter_criteria = [
{
"field": "name",
"value": domain_name,
"values": [domain_name],
"condition": "EQUAL",
}
]
Expand Down Expand Up @@ -789,15 +789,15 @@ def get_container_urns_by_filter(
filter_criteria.append(
{
"field": "customProperties",
"value": f"instance={env}",
"values": [f"instance={env}"],
"condition": "EQUAL",
}
)

filter_criteria.append(
{
"field": "typeNames",
"value": container_subtype,
"values": [container_subtype],
"condition": "EQUAL",
}
)
Expand Down
8 changes: 4 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/graph/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,23 @@ def _get_env_filters(env: str) -> List[RawSearchFilterRule]:
# For most entity types, we look at the origin field.
{
"field": "origin",
"value": env,
"values": [env],
"condition": "EQUAL",
},
# For containers, we look at the customProperties field.
# For any containers created after https://github.com/datahub-project/datahub/pull/8027,
# we look for the "env" property. Otherwise, we use the "instance" property.
{
"field": "customProperties",
"value": f"env={env}",
"values": [f"env={env}"],
},
{
"field": "customProperties",
"value": f"instance={env}",
"values": [f"instance={env}"],
},
{
"field": "env",
"value": env,
"values": [env],
},
# Note that not all entity types have an env (e.g. dashboards / charts).
# If the env filter is specified, these will be excluded.
Expand Down