mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 11:49:23 +00:00
fix(ingest): use sequence for sdk input types (#14695)
Co-authored-by: Anush Kumar <anush.kumar@datahub.com>
This commit is contained in:
parent
4244620e7a
commit
14130701b5
@ -179,7 +179,7 @@ OwnerInputType: TypeAlias = Union[
|
||||
Tuple[ActorUrn, OwnershipTypeType],
|
||||
models.OwnerClass,
|
||||
]
|
||||
OwnersInputType: TypeAlias = List[OwnerInputType]
|
||||
OwnersInputType: TypeAlias = Sequence[OwnerInputType]
|
||||
|
||||
|
||||
class HasOwnership(Entity):
|
||||
@ -280,7 +280,9 @@ class HasOwnership(Entity):
|
||||
# If you pass in a ContainerKey, we can use parent_key() to build the browse path.
|
||||
# If you pass in a list of urns, we'll use that as the browse path. Any non-urn strings
|
||||
# will be treated as raw ids.
|
||||
ParentContainerInputType: TypeAlias = Union["Container", ContainerKey, List[UrnOrStr]]
|
||||
ParentContainerInputType: TypeAlias = Union[
|
||||
"Container", ContainerKey, Sequence[UrnOrStr]
|
||||
]
|
||||
|
||||
|
||||
class HasContainer(Entity):
|
||||
@ -340,7 +342,7 @@ class HasContainer(Entity):
|
||||
)
|
||||
for entry in parsed_path
|
||||
]
|
||||
elif container is not None:
|
||||
elif isinstance(container, ContainerKey):
|
||||
container_urn = container.as_urn()
|
||||
|
||||
browse_path_reversed = [container_urn]
|
||||
@ -399,7 +401,7 @@ class HasContainer(Entity):
|
||||
|
||||
|
||||
TagInputType: TypeAlias = Union[str, TagUrn, models.TagAssociationClass]
|
||||
TagsInputType: TypeAlias = List[TagInputType]
|
||||
TagsInputType: TypeAlias = Sequence[TagInputType]
|
||||
|
||||
|
||||
class HasTags(Entity):
|
||||
@ -454,7 +456,7 @@ class HasTags(Entity):
|
||||
TermInputType: TypeAlias = Union[
|
||||
str, GlossaryTermUrn, models.GlossaryTermAssociationClass
|
||||
]
|
||||
TermsInputType: TypeAlias = List[TermInputType]
|
||||
TermsInputType: TypeAlias = Sequence[TermInputType]
|
||||
|
||||
|
||||
class HasTerms(Entity):
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Type, Union
|
||||
from typing import Dict, List, Optional, Sequence, Type, Union
|
||||
|
||||
from deprecated.sphinx import deprecated
|
||||
from typing_extensions import Self
|
||||
@ -73,7 +73,7 @@ class Chart(
|
||||
last_refreshed: Optional[datetime] = None,
|
||||
chart_type: Optional[Union[str, models.ChartTypeClass]] = None,
|
||||
access: Optional[str] = None,
|
||||
input_datasets: Optional[List[Union[DatasetUrnOrStr, Dataset]]] = None,
|
||||
input_datasets: Optional[Sequence[Union[DatasetUrnOrStr, Dataset]]] = None,
|
||||
# Standard aspects.
|
||||
parent_container: ParentContainerInputType | Unset = unset,
|
||||
subtype: Optional[str] = None,
|
||||
@ -291,7 +291,7 @@ class Chart(
|
||||
return [DatasetUrn.from_string(input_urn) for input_urn in (props.inputs or [])]
|
||||
|
||||
def set_input_datasets(
|
||||
self, input_datasets: List[Union[DatasetUrnOrStr, Dataset]]
|
||||
self, input_datasets: Sequence[Union[DatasetUrnOrStr, Dataset]]
|
||||
) -> None:
|
||||
"""Set the input datasets of the chart."""
|
||||
# Convert all inputs to strings
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Type, Union
|
||||
from typing import Dict, List, Optional, Sequence, Type, Union
|
||||
|
||||
from deprecated.sphinx import deprecated
|
||||
from typing_extensions import Self
|
||||
@ -73,9 +73,9 @@ class Dashboard(
|
||||
custom_properties: Optional[Dict[str, str]] = None,
|
||||
last_modified: Optional[datetime] = None,
|
||||
last_refreshed: Optional[datetime] = None,
|
||||
input_datasets: Optional[List[Union[DatasetUrnOrStr, Dataset]]] = None,
|
||||
charts: Optional[List[Union[ChartUrnOrStr, Chart]]] = None,
|
||||
dashboards: Optional[List[Union[DashboardUrnOrStr, Dashboard]]] = None,
|
||||
input_datasets: Optional[Sequence[Union[DatasetUrnOrStr, Dataset]]] = None,
|
||||
charts: Optional[Sequence[Union[ChartUrnOrStr, Chart]]] = None,
|
||||
dashboards: Optional[Sequence[Union[DashboardUrnOrStr, Dashboard]]] = None,
|
||||
# Standard aspects.
|
||||
parent_container: ParentContainerInputType | Unset = unset,
|
||||
subtype: Optional[str] = None,
|
||||
@ -281,7 +281,7 @@ class Dashboard(
|
||||
]
|
||||
|
||||
def set_input_datasets(
|
||||
self, input_datasets: List[Union[DatasetUrnOrStr, Dataset]]
|
||||
self, input_datasets: Sequence[Union[DatasetUrnOrStr, Dataset]]
|
||||
) -> None:
|
||||
"""Set the input datasets of the dashboard."""
|
||||
props = self._ensure_dashboard_props()
|
||||
@ -332,7 +332,7 @@ class Dashboard(
|
||||
return []
|
||||
return [ChartUrn.from_string(edge.destinationUrn) for edge in chart_edges]
|
||||
|
||||
def set_charts(self, charts: List[Union[ChartUrnOrStr, Chart]]) -> None:
|
||||
def set_charts(self, charts: Sequence[Union[ChartUrnOrStr, Chart]]) -> None:
|
||||
"""Set the charts of the dashboard."""
|
||||
props = self._ensure_dashboard_props()
|
||||
chart_edges = props.chartEdges or []
|
||||
@ -384,7 +384,7 @@ class Dashboard(
|
||||
]
|
||||
|
||||
def set_dashboards(
|
||||
self, dashboards: List[Union[DashboardUrnOrStr, Dashboard]]
|
||||
self, dashboards: Sequence[Union[DashboardUrnOrStr, Dashboard]]
|
||||
) -> None:
|
||||
"""Set the dashboards of the dashboard."""
|
||||
props = self._ensure_dashboard_props()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user