-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jk-fix-empty-schema-field
- Loading branch information
Showing
29 changed files
with
2,970 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
Release Availability Date | ||
--- | ||
21-Jan-2025 | ||
29-Jan-2025 | ||
|
||
Recommended CLI/SDK | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from datahub.configuration.common import MetaError | ||
|
||
# TODO: Move all other error types to this file. | ||
|
||
|
||
class SdkUsageError(MetaError): | ||
pass | ||
|
||
|
||
class AlreadyExistsError(SdkUsageError): | ||
pass | ||
|
||
|
||
class ItemNotFoundError(SdkUsageError): | ||
pass | ||
|
||
|
||
class MultipleItemsFoundError(SdkUsageError): | ||
pass | ||
|
||
|
||
class SchemaFieldKeyError(SdkUsageError, KeyError): | ||
pass | ||
|
||
|
||
class IngestionAttributionWarning(Warning): | ||
pass | ||
|
||
|
||
class MultipleSubtypesWarning(Warning): | ||
pass | ||
|
||
|
||
class ExperimentalWarning(Warning): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import warnings | ||
|
||
import datahub.metadata.schema_classes as models | ||
from datahub.errors import ExperimentalWarning, SdkUsageError | ||
from datahub.ingestion.graph.config import DatahubClientConfig | ||
from datahub.metadata.urns import ( | ||
ChartUrn, | ||
ContainerUrn, | ||
CorpGroupUrn, | ||
CorpUserUrn, | ||
DashboardUrn, | ||
DataPlatformInstanceUrn, | ||
DataPlatformUrn, | ||
DatasetUrn, | ||
DomainUrn, | ||
GlossaryTermUrn, | ||
SchemaFieldUrn, | ||
TagUrn, | ||
) | ||
from datahub.sdk.container import Container | ||
from datahub.sdk.dataset import Dataset | ||
from datahub.sdk.main_client import DataHubClient | ||
|
||
warnings.warn( | ||
"The new datahub SDK (e.g. datahub.sdk.*) is experimental. " | ||
"Our typical backwards-compatibility and stability guarantees do not apply to this code. " | ||
"When it's promoted to stable, the import path will change " | ||
"from `from datahub.sdk import ...` to `from datahub import ...`.", | ||
ExperimentalWarning, | ||
stacklevel=2, | ||
) | ||
del warnings | ||
del ExperimentalWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Dict, List, Type | ||
|
||
from datahub.sdk._entity import Entity | ||
from datahub.sdk.container import Container | ||
from datahub.sdk.dataset import Dataset | ||
|
||
# TODO: Is there a better way to declare this? | ||
ENTITY_CLASSES_LIST: List[Type[Entity]] = [ | ||
Container, | ||
Dataset, | ||
] | ||
|
||
ENTITY_CLASSES: Dict[str, Type[Entity]] = { | ||
cls.get_urn_type().ENTITY_TYPE: cls for cls in ENTITY_CLASSES_LIST | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from __future__ import annotations | ||
|
||
import contextlib | ||
from typing import Iterator | ||
|
||
from datahub.utilities.str_enum import StrEnum | ||
|
||
|
||
class KnownAttribution(StrEnum): | ||
INGESTION = "INGESTION" | ||
INGESTION_ALTERNATE = "INGESTION_ALTERNATE" | ||
|
||
UI = "UI" | ||
SDK = "SDK" | ||
|
||
PROPAGATION = "PROPAGATION" | ||
|
||
def is_ingestion(self) -> bool: | ||
return self in ( | ||
KnownAttribution.INGESTION, | ||
KnownAttribution.INGESTION_ALTERNATE, | ||
) | ||
|
||
|
||
_default_attribution = KnownAttribution.SDK | ||
|
||
|
||
def get_default_attribution() -> KnownAttribution: | ||
return _default_attribution | ||
|
||
|
||
def set_default_attribution(attribution: KnownAttribution) -> None: | ||
global _default_attribution | ||
_default_attribution = attribution | ||
|
||
|
||
@contextlib.contextmanager | ||
def change_default_attribution(attribution: KnownAttribution) -> Iterator[None]: | ||
old_attribution = get_default_attribution() | ||
try: | ||
set_default_attribution(attribution) | ||
yield | ||
finally: | ||
set_default_attribution(old_attribution) | ||
|
||
|
||
def is_ingestion_attribution() -> bool: | ||
return get_default_attribution().is_ingestion() |
Oops, something went wrong.