acryl-datahub 0.15.0.6rc2__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of acryl-datahub might be problematic. Click here for more details.
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/METADATA +2522 -2493
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/RECORD +205 -192
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/WHEEL +1 -1
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/entry_points.txt +1 -0
- datahub/_version.py +1 -1
- datahub/api/entities/common/serialized_value.py +4 -3
- datahub/api/entities/dataset/dataset.py +731 -42
- datahub/api/entities/structuredproperties/structuredproperties.py +2 -2
- datahub/cli/check_cli.py +72 -19
- datahub/cli/docker_cli.py +3 -3
- datahub/cli/iceberg_cli.py +31 -7
- datahub/cli/ingest_cli.py +30 -93
- datahub/cli/lite_cli.py +4 -2
- datahub/cli/specific/dataproduct_cli.py +1 -1
- datahub/cli/specific/dataset_cli.py +128 -14
- datahub/configuration/common.py +10 -2
- datahub/configuration/git.py +1 -3
- datahub/configuration/kafka.py +1 -1
- datahub/emitter/mce_builder.py +28 -13
- datahub/emitter/mcp_builder.py +4 -1
- datahub/emitter/response_helper.py +145 -0
- datahub/emitter/rest_emitter.py +323 -10
- datahub/ingestion/api/decorators.py +1 -1
- datahub/ingestion/api/source_helpers.py +4 -0
- datahub/ingestion/fs/s3_fs.py +2 -2
- datahub/ingestion/glossary/classification_mixin.py +1 -5
- datahub/ingestion/graph/client.py +41 -22
- datahub/ingestion/graph/entity_versioning.py +3 -3
- datahub/ingestion/graph/filters.py +64 -37
- datahub/ingestion/reporting/datahub_ingestion_run_summary_provider.py +1 -6
- datahub/ingestion/run/pipeline.py +112 -148
- datahub/ingestion/run/sink_callback.py +77 -0
- datahub/ingestion/sink/datahub_rest.py +8 -0
- datahub/ingestion/source/abs/config.py +2 -4
- datahub/ingestion/source/bigquery_v2/bigquery_audit.py +1 -1
- datahub/ingestion/source/bigquery_v2/bigquery_config.py +2 -46
- datahub/ingestion/source/bigquery_v2/bigquery_schema.py +6 -1
- datahub/ingestion/source/bigquery_v2/bigquery_schema_gen.py +7 -4
- datahub/ingestion/source/cassandra/cassandra.py +152 -233
- datahub/ingestion/source/cassandra/cassandra_api.py +13 -5
- datahub/ingestion/source/common/gcp_credentials_config.py +53 -0
- datahub/ingestion/source/common/subtypes.py +12 -0
- datahub/ingestion/source/csv_enricher.py +3 -3
- datahub/ingestion/source/data_lake_common/path_spec.py +1 -3
- datahub/ingestion/source/dbt/dbt_common.py +8 -5
- datahub/ingestion/source/dbt/dbt_core.py +11 -9
- datahub/ingestion/source/dbt/dbt_tests.py +4 -8
- datahub/ingestion/source/delta_lake/config.py +8 -1
- datahub/ingestion/source/delta_lake/report.py +4 -2
- datahub/ingestion/source/delta_lake/source.py +20 -5
- datahub/ingestion/source/dremio/dremio_api.py +4 -8
- datahub/ingestion/source/dremio/dremio_aspects.py +3 -5
- datahub/ingestion/source/dynamodb/dynamodb.py +6 -0
- datahub/ingestion/source/elastic_search.py +26 -6
- datahub/ingestion/source/feast.py +27 -8
- datahub/ingestion/source/file.py +6 -3
- datahub/ingestion/source/gc/dataprocess_cleanup.py +1 -1
- datahub/ingestion/source/gc/execution_request_cleanup.py +2 -1
- datahub/ingestion/source/ge_data_profiler.py +12 -15
- datahub/ingestion/source/iceberg/iceberg.py +46 -12
- datahub/ingestion/source/iceberg/iceberg_common.py +71 -21
- datahub/ingestion/source/identity/okta.py +37 -7
- datahub/ingestion/source/kafka/kafka.py +1 -1
- datahub/ingestion/source/kafka_connect/common.py +2 -7
- datahub/ingestion/source/kafka_connect/kafka_connect.py +97 -4
- datahub/ingestion/source/kafka_connect/sink_connectors.py +2 -2
- datahub/ingestion/source/kafka_connect/source_connectors.py +6 -9
- datahub/ingestion/source/looker/looker_common.py +6 -5
- datahub/ingestion/source/looker/looker_file_loader.py +2 -2
- datahub/ingestion/source/looker/looker_lib_wrapper.py +2 -1
- datahub/ingestion/source/looker/looker_source.py +1 -1
- datahub/ingestion/source/looker/looker_template_language.py +4 -2
- datahub/ingestion/source/looker/lookml_source.py +3 -2
- datahub/ingestion/source/metabase.py +57 -35
- datahub/ingestion/source/metadata/business_glossary.py +45 -3
- datahub/ingestion/source/metadata/lineage.py +2 -2
- datahub/ingestion/source/mlflow.py +365 -35
- datahub/ingestion/source/mode.py +18 -8
- datahub/ingestion/source/neo4j/neo4j_source.py +27 -7
- datahub/ingestion/source/nifi.py +37 -11
- datahub/ingestion/source/openapi.py +1 -1
- datahub/ingestion/source/openapi_parser.py +49 -17
- datahub/ingestion/source/powerbi/m_query/parser.py +3 -2
- datahub/ingestion/source/powerbi/m_query/tree_function.py +2 -1
- datahub/ingestion/source/powerbi/powerbi.py +1 -3
- datahub/ingestion/source/powerbi/rest_api_wrapper/data_resolver.py +2 -1
- datahub/ingestion/source/powerbi_report_server/report_server.py +26 -7
- datahub/ingestion/source/powerbi_report_server/report_server_domain.py +1 -1
- datahub/ingestion/source/preset.py +7 -4
- datahub/ingestion/source/pulsar.py +3 -2
- datahub/ingestion/source/qlik_sense/websocket_connection.py +4 -2
- datahub/ingestion/source/redash.py +31 -7
- datahub/ingestion/source/redshift/config.py +4 -0
- datahub/ingestion/source/redshift/datashares.py +236 -0
- datahub/ingestion/source/redshift/lineage.py +6 -2
- datahub/ingestion/source/redshift/lineage_v2.py +24 -9
- datahub/ingestion/source/redshift/profile.py +1 -1
- datahub/ingestion/source/redshift/query.py +133 -33
- datahub/ingestion/source/redshift/redshift.py +46 -73
- datahub/ingestion/source/redshift/redshift_schema.py +186 -6
- datahub/ingestion/source/redshift/report.py +3 -0
- datahub/ingestion/source/s3/config.py +5 -5
- datahub/ingestion/source/s3/source.py +20 -41
- datahub/ingestion/source/salesforce.py +550 -275
- datahub/ingestion/source/schema_inference/object.py +1 -1
- datahub/ingestion/source/sigma/sigma.py +1 -1
- datahub/ingestion/source/slack/slack.py +31 -10
- datahub/ingestion/source/snowflake/snowflake_connection.py +2 -2
- datahub/ingestion/source/snowflake/snowflake_queries.py +19 -13
- datahub/ingestion/source/snowflake/snowflake_query.py +6 -4
- datahub/ingestion/source/snowflake/snowflake_schema.py +3 -4
- datahub/ingestion/source/snowflake/snowflake_v2.py +1 -1
- datahub/ingestion/source/sql/athena.py +10 -16
- datahub/ingestion/source/sql/druid.py +1 -5
- datahub/ingestion/source/sql/hive.py +15 -6
- datahub/ingestion/source/sql/hive_metastore.py +3 -2
- datahub/ingestion/source/sql/mssql/job_models.py +29 -0
- datahub/ingestion/source/sql/mssql/source.py +11 -5
- datahub/ingestion/source/sql/oracle.py +127 -63
- datahub/ingestion/source/sql/sql_common.py +16 -18
- datahub/ingestion/source/sql/sql_types.py +2 -2
- datahub/ingestion/source/sql/teradata.py +19 -5
- datahub/ingestion/source/sql/trino.py +2 -2
- datahub/ingestion/source/state/stale_entity_removal_handler.py +4 -8
- datahub/ingestion/source/superset.py +222 -62
- datahub/ingestion/source/tableau/tableau.py +22 -6
- datahub/ingestion/source/tableau/tableau_common.py +3 -2
- datahub/ingestion/source/unity/ge_profiler.py +2 -1
- datahub/ingestion/source/unity/source.py +11 -1
- datahub/ingestion/source/vertexai.py +697 -0
- datahub/ingestion/source_config/pulsar.py +3 -1
- datahub/ingestion/transformer/pattern_cleanup_ownership.py +25 -7
- datahub/lite/duckdb_lite.py +3 -10
- datahub/lite/lite_local.py +1 -1
- datahub/lite/lite_util.py +4 -3
- datahub/metadata/_schema_classes.py +714 -417
- datahub/metadata/_urns/urn_defs.py +1673 -1649
- datahub/metadata/com/linkedin/pegasus2avro/incident/__init__.py +4 -0
- datahub/metadata/schema.avsc +16438 -16603
- datahub/metadata/schemas/AssertionInfo.avsc +3 -1
- datahub/metadata/schemas/BusinessAttributeInfo.avsc +6 -2
- datahub/metadata/schemas/BusinessAttributes.avsc +6 -0
- datahub/metadata/schemas/ChartInfo.avsc +1 -0
- datahub/metadata/schemas/CorpGroupKey.avsc +2 -1
- datahub/metadata/schemas/CorpUserInfo.avsc +13 -0
- datahub/metadata/schemas/CorpUserKey.avsc +2 -1
- datahub/metadata/schemas/DataHubIngestionSourceInfo.avsc +8 -3
- datahub/metadata/schemas/DataProcessInstanceInput.avsc +129 -1
- datahub/metadata/schemas/DataProcessInstanceOutput.avsc +131 -3
- datahub/metadata/schemas/DataProcessKey.avsc +2 -1
- datahub/metadata/schemas/DataProductKey.avsc +2 -1
- datahub/metadata/schemas/DomainKey.avsc +2 -1
- datahub/metadata/schemas/EditableSchemaMetadata.avsc +6 -2
- datahub/metadata/schemas/GlossaryNodeKey.avsc +3 -1
- datahub/metadata/schemas/GlossaryTermKey.avsc +2 -1
- datahub/metadata/schemas/GlossaryTerms.avsc +3 -1
- datahub/metadata/schemas/IncidentInfo.avsc +130 -46
- datahub/metadata/schemas/InputFields.avsc +3 -1
- datahub/metadata/schemas/MLFeatureKey.avsc +2 -1
- datahub/metadata/schemas/MLFeatureTableKey.avsc +2 -1
- datahub/metadata/schemas/MLModelDeploymentKey.avsc +2 -1
- datahub/metadata/schemas/MLModelGroupKey.avsc +3 -1
- datahub/metadata/schemas/MLModelKey.avsc +3 -1
- datahub/metadata/schemas/MLPrimaryKeyKey.avsc +2 -1
- datahub/metadata/schemas/MetadataChangeEvent.avsc +20 -2
- datahub/metadata/schemas/PostKey.avsc +2 -1
- datahub/metadata/schemas/SchemaFieldKey.avsc +2 -1
- datahub/metadata/schemas/SchemaMetadata.avsc +3 -1
- datahub/metadata/schemas/StructuredPropertyDefinition.avsc +14 -0
- datahub/metadata/schemas/VersionProperties.avsc +18 -0
- datahub/metadata/schemas/VersionSetProperties.avsc +5 -0
- datahub/pydantic/__init__.py +0 -0
- datahub/pydantic/compat.py +58 -0
- datahub/sdk/__init__.py +30 -12
- datahub/sdk/_all_entities.py +1 -1
- datahub/sdk/_attribution.py +4 -0
- datahub/sdk/_shared.py +258 -16
- datahub/sdk/_utils.py +35 -0
- datahub/sdk/container.py +30 -6
- datahub/sdk/dataset.py +118 -20
- datahub/sdk/{_entity.py → entity.py} +24 -1
- datahub/sdk/entity_client.py +1 -1
- datahub/sdk/main_client.py +23 -0
- datahub/sdk/resolver_client.py +17 -29
- datahub/sdk/search_client.py +50 -0
- datahub/sdk/search_filters.py +374 -0
- datahub/specific/dataset.py +3 -4
- datahub/sql_parsing/_sqlglot_patch.py +2 -10
- datahub/sql_parsing/schema_resolver.py +1 -1
- datahub/sql_parsing/split_statements.py +220 -126
- datahub/sql_parsing/sql_parsing_common.py +7 -0
- datahub/sql_parsing/sqlglot_lineage.py +1 -1
- datahub/sql_parsing/sqlglot_utils.py +1 -4
- datahub/testing/check_sql_parser_result.py +5 -6
- datahub/testing/compare_metadata_json.py +7 -6
- datahub/testing/pytest_hooks.py +56 -0
- datahub/upgrade/upgrade.py +2 -2
- datahub/utilities/file_backed_collections.py +3 -14
- datahub/utilities/ingest_utils.py +106 -0
- datahub/utilities/mapping.py +1 -1
- datahub/utilities/memory_footprint.py +3 -2
- datahub/utilities/sentinels.py +22 -0
- datahub/utilities/unified_diff.py +5 -1
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/LICENSE +0 -0
- {acryl_datahub-0.15.0.6rc2.dist-info → acryl_datahub-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
# This file contains classes corresponding to entity URNs.
|
|
12
12
|
|
|
13
|
-
from typing import ClassVar, List, Optional, Type, TYPE_CHECKING, Union
|
|
13
|
+
from typing import ClassVar, List, Optional, Type, TYPE_CHECKING, Union, Literal
|
|
14
14
|
|
|
15
15
|
import functools
|
|
16
16
|
from deprecated.sphinx import deprecated as _sphinx_deprecated
|
|
@@ -22,122 +22,122 @@ from datahub.utilities.urns.error import InvalidUrnError
|
|
|
22
22
|
deprecated = functools.partial(_sphinx_deprecated, version="0.12.0.2")
|
|
23
23
|
|
|
24
24
|
if TYPE_CHECKING:
|
|
25
|
-
from datahub.metadata.schema_classes import
|
|
25
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
26
26
|
|
|
27
|
-
class
|
|
28
|
-
ENTITY_TYPE: ClassVar[
|
|
27
|
+
class BusinessAttributeUrn(_SpecificUrn):
|
|
28
|
+
ENTITY_TYPE: ClassVar[Literal["businessAttribute"]] = "businessAttribute"
|
|
29
29
|
_URN_PARTS: ClassVar[int] = 1
|
|
30
30
|
|
|
31
|
-
def __init__(self, id: Union["
|
|
31
|
+
def __init__(self, id: Union["BusinessAttributeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
32
32
|
if _allow_coercion:
|
|
33
33
|
# Field coercion logic (if any is required).
|
|
34
34
|
if isinstance(id, str):
|
|
35
35
|
if id.startswith('urn:li:'):
|
|
36
36
|
try:
|
|
37
|
-
id =
|
|
37
|
+
id = BusinessAttributeUrn.from_string(id)
|
|
38
38
|
except InvalidUrnError:
|
|
39
|
-
raise InvalidUrnError(f'Expecting a
|
|
39
|
+
raise InvalidUrnError(f'Expecting a BusinessAttributeUrn but got {id}')
|
|
40
40
|
else:
|
|
41
41
|
id = UrnEncoder.encode_string(id)
|
|
42
42
|
|
|
43
43
|
# Validation logic.
|
|
44
44
|
if not id:
|
|
45
|
-
raise InvalidUrnError("
|
|
46
|
-
if isinstance(id,
|
|
45
|
+
raise InvalidUrnError("BusinessAttributeUrn id cannot be empty")
|
|
46
|
+
if isinstance(id, BusinessAttributeUrn):
|
|
47
47
|
id = id.id
|
|
48
48
|
elif isinstance(id, Urn):
|
|
49
|
-
raise InvalidUrnError(f'Expecting a
|
|
49
|
+
raise InvalidUrnError(f'Expecting a BusinessAttributeUrn but got {id}')
|
|
50
50
|
if UrnEncoder.contains_reserved_char(id):
|
|
51
|
-
raise InvalidUrnError(f'
|
|
51
|
+
raise InvalidUrnError(f'BusinessAttributeUrn id contains reserved characters')
|
|
52
52
|
|
|
53
53
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
54
54
|
|
|
55
55
|
@classmethod
|
|
56
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
56
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "BusinessAttributeUrn":
|
|
57
57
|
if len(entity_ids) != cls._URN_PARTS:
|
|
58
|
-
raise InvalidUrnError(f"
|
|
58
|
+
raise InvalidUrnError(f"BusinessAttributeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
59
59
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
60
60
|
|
|
61
61
|
@classmethod
|
|
62
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
63
|
-
from datahub.metadata.schema_classes import
|
|
62
|
+
def underlying_key_aspect_type(cls) -> Type["BusinessAttributeKeyClass"]:
|
|
63
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
64
64
|
|
|
65
|
-
return
|
|
65
|
+
return BusinessAttributeKeyClass
|
|
66
66
|
|
|
67
|
-
def to_key_aspect(self) -> "
|
|
68
|
-
from datahub.metadata.schema_classes import
|
|
67
|
+
def to_key_aspect(self) -> "BusinessAttributeKeyClass":
|
|
68
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return BusinessAttributeKeyClass(id=self.id)
|
|
71
71
|
|
|
72
72
|
@classmethod
|
|
73
|
-
def from_key_aspect(cls, key_aspect: "
|
|
73
|
+
def from_key_aspect(cls, key_aspect: "BusinessAttributeKeyClass") -> "BusinessAttributeUrn":
|
|
74
74
|
return cls(id=key_aspect.id)
|
|
75
75
|
|
|
76
76
|
@property
|
|
77
77
|
def id(self) -> str:
|
|
78
|
-
return self.
|
|
78
|
+
return self._entity_ids[0]
|
|
79
79
|
|
|
80
80
|
if TYPE_CHECKING:
|
|
81
|
-
from datahub.metadata.schema_classes import
|
|
81
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
82
82
|
|
|
83
|
-
class
|
|
84
|
-
ENTITY_TYPE: ClassVar[
|
|
83
|
+
class DataTypeUrn(_SpecificUrn):
|
|
84
|
+
ENTITY_TYPE: ClassVar[Literal["dataType"]] = "dataType"
|
|
85
85
|
_URN_PARTS: ClassVar[int] = 1
|
|
86
86
|
|
|
87
|
-
def __init__(self, id: Union["
|
|
87
|
+
def __init__(self, id: Union["DataTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
88
88
|
if _allow_coercion:
|
|
89
89
|
# Field coercion logic (if any is required).
|
|
90
90
|
if isinstance(id, str):
|
|
91
91
|
if id.startswith('urn:li:'):
|
|
92
92
|
try:
|
|
93
|
-
id =
|
|
93
|
+
id = DataTypeUrn.from_string(id)
|
|
94
94
|
except InvalidUrnError:
|
|
95
|
-
raise InvalidUrnError(f'Expecting a
|
|
95
|
+
raise InvalidUrnError(f'Expecting a DataTypeUrn but got {id}')
|
|
96
96
|
else:
|
|
97
97
|
id = UrnEncoder.encode_string(id)
|
|
98
98
|
|
|
99
99
|
# Validation logic.
|
|
100
100
|
if not id:
|
|
101
|
-
raise InvalidUrnError("
|
|
102
|
-
if isinstance(id,
|
|
101
|
+
raise InvalidUrnError("DataTypeUrn id cannot be empty")
|
|
102
|
+
if isinstance(id, DataTypeUrn):
|
|
103
103
|
id = id.id
|
|
104
104
|
elif isinstance(id, Urn):
|
|
105
|
-
raise InvalidUrnError(f'Expecting a
|
|
105
|
+
raise InvalidUrnError(f'Expecting a DataTypeUrn but got {id}')
|
|
106
106
|
if UrnEncoder.contains_reserved_char(id):
|
|
107
|
-
raise InvalidUrnError(f'
|
|
107
|
+
raise InvalidUrnError(f'DataTypeUrn id contains reserved characters')
|
|
108
108
|
|
|
109
109
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
110
110
|
|
|
111
111
|
@classmethod
|
|
112
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
112
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataTypeUrn":
|
|
113
113
|
if len(entity_ids) != cls._URN_PARTS:
|
|
114
|
-
raise InvalidUrnError(f"
|
|
114
|
+
raise InvalidUrnError(f"DataTypeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
115
115
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
116
116
|
|
|
117
117
|
@classmethod
|
|
118
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
119
|
-
from datahub.metadata.schema_classes import
|
|
118
|
+
def underlying_key_aspect_type(cls) -> Type["DataTypeKeyClass"]:
|
|
119
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
120
120
|
|
|
121
|
-
return
|
|
121
|
+
return DataTypeKeyClass
|
|
122
122
|
|
|
123
|
-
def to_key_aspect(self) -> "
|
|
124
|
-
from datahub.metadata.schema_classes import
|
|
123
|
+
def to_key_aspect(self) -> "DataTypeKeyClass":
|
|
124
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
125
125
|
|
|
126
|
-
return
|
|
126
|
+
return DataTypeKeyClass(id=self.id)
|
|
127
127
|
|
|
128
128
|
@classmethod
|
|
129
|
-
def from_key_aspect(cls, key_aspect: "
|
|
129
|
+
def from_key_aspect(cls, key_aspect: "DataTypeKeyClass") -> "DataTypeUrn":
|
|
130
130
|
return cls(id=key_aspect.id)
|
|
131
131
|
|
|
132
132
|
@property
|
|
133
133
|
def id(self) -> str:
|
|
134
|
-
return self.
|
|
134
|
+
return self._entity_ids[0]
|
|
135
135
|
|
|
136
136
|
if TYPE_CHECKING:
|
|
137
137
|
from datahub.metadata.schema_classes import DataProductKeyClass
|
|
138
138
|
|
|
139
139
|
class DataProductUrn(_SpecificUrn):
|
|
140
|
-
ENTITY_TYPE: ClassVar[
|
|
140
|
+
ENTITY_TYPE: ClassVar[Literal["dataProduct"]] = "dataProduct"
|
|
141
141
|
_URN_PARTS: ClassVar[int] = 1
|
|
142
142
|
|
|
143
143
|
def __init__(self, id: Union["DataProductUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
@@ -187,305 +187,237 @@ class DataProductUrn(_SpecificUrn):
|
|
|
187
187
|
|
|
188
188
|
@property
|
|
189
189
|
def id(self) -> str:
|
|
190
|
-
return self.
|
|
190
|
+
return self._entity_ids[0]
|
|
191
191
|
|
|
192
192
|
if TYPE_CHECKING:
|
|
193
|
-
from datahub.metadata.schema_classes import
|
|
193
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
194
194
|
|
|
195
|
-
class
|
|
196
|
-
ENTITY_TYPE: ClassVar[
|
|
195
|
+
class TelemetryUrn(_SpecificUrn):
|
|
196
|
+
ENTITY_TYPE: ClassVar[Literal["telemetry"]] = "telemetry"
|
|
197
197
|
_URN_PARTS: ClassVar[int] = 1
|
|
198
198
|
|
|
199
|
-
def __init__(self,
|
|
199
|
+
def __init__(self, name: Union["TelemetryUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
200
200
|
if _allow_coercion:
|
|
201
201
|
# Field coercion logic (if any is required).
|
|
202
|
-
if isinstance(
|
|
203
|
-
if
|
|
202
|
+
if isinstance(name, str):
|
|
203
|
+
if name.startswith('urn:li:'):
|
|
204
204
|
try:
|
|
205
|
-
|
|
205
|
+
name = TelemetryUrn.from_string(name)
|
|
206
206
|
except InvalidUrnError:
|
|
207
|
-
raise InvalidUrnError(f'Expecting a
|
|
207
|
+
raise InvalidUrnError(f'Expecting a TelemetryUrn but got {name}')
|
|
208
208
|
else:
|
|
209
|
-
|
|
209
|
+
name = UrnEncoder.encode_string(name)
|
|
210
210
|
|
|
211
211
|
# Validation logic.
|
|
212
|
-
if not
|
|
213
|
-
raise InvalidUrnError("
|
|
214
|
-
if isinstance(
|
|
215
|
-
|
|
216
|
-
elif isinstance(
|
|
217
|
-
raise InvalidUrnError(f'Expecting a
|
|
218
|
-
if UrnEncoder.contains_reserved_char(
|
|
219
|
-
raise InvalidUrnError(f'
|
|
212
|
+
if not name:
|
|
213
|
+
raise InvalidUrnError("TelemetryUrn name cannot be empty")
|
|
214
|
+
if isinstance(name, TelemetryUrn):
|
|
215
|
+
name = name.name
|
|
216
|
+
elif isinstance(name, Urn):
|
|
217
|
+
raise InvalidUrnError(f'Expecting a TelemetryUrn but got {name}')
|
|
218
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
219
|
+
raise InvalidUrnError(f'TelemetryUrn name contains reserved characters')
|
|
220
220
|
|
|
221
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
221
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
222
222
|
|
|
223
223
|
@classmethod
|
|
224
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
224
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TelemetryUrn":
|
|
225
225
|
if len(entity_ids) != cls._URN_PARTS:
|
|
226
|
-
raise InvalidUrnError(f"
|
|
227
|
-
return cls(
|
|
226
|
+
raise InvalidUrnError(f"TelemetryUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
227
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
228
228
|
|
|
229
229
|
@classmethod
|
|
230
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
231
|
-
from datahub.metadata.schema_classes import
|
|
230
|
+
def underlying_key_aspect_type(cls) -> Type["TelemetryKeyClass"]:
|
|
231
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
232
232
|
|
|
233
|
-
return
|
|
233
|
+
return TelemetryKeyClass
|
|
234
234
|
|
|
235
|
-
def to_key_aspect(self) -> "
|
|
236
|
-
from datahub.metadata.schema_classes import
|
|
235
|
+
def to_key_aspect(self) -> "TelemetryKeyClass":
|
|
236
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
237
237
|
|
|
238
|
-
return
|
|
238
|
+
return TelemetryKeyClass(name=self.name)
|
|
239
239
|
|
|
240
240
|
@classmethod
|
|
241
|
-
def from_key_aspect(cls, key_aspect: "
|
|
242
|
-
return cls(
|
|
241
|
+
def from_key_aspect(cls, key_aspect: "TelemetryKeyClass") -> "TelemetryUrn":
|
|
242
|
+
return cls(name=key_aspect.name)
|
|
243
243
|
|
|
244
244
|
@property
|
|
245
|
-
def
|
|
246
|
-
return self.
|
|
245
|
+
def name(self) -> str:
|
|
246
|
+
return self._entity_ids[0]
|
|
247
247
|
|
|
248
248
|
if TYPE_CHECKING:
|
|
249
|
-
from datahub.metadata.schema_classes import
|
|
249
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
250
250
|
|
|
251
|
-
class
|
|
252
|
-
ENTITY_TYPE: ClassVar[
|
|
251
|
+
class DataHubAccessTokenUrn(_SpecificUrn):
|
|
252
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubAccessToken"]] = "dataHubAccessToken"
|
|
253
253
|
_URN_PARTS: ClassVar[int] = 1
|
|
254
254
|
|
|
255
|
-
def __init__(self, id: Union["
|
|
255
|
+
def __init__(self, id: Union["DataHubAccessTokenUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
256
256
|
if _allow_coercion:
|
|
257
257
|
# Field coercion logic (if any is required).
|
|
258
258
|
if isinstance(id, str):
|
|
259
259
|
if id.startswith('urn:li:'):
|
|
260
260
|
try:
|
|
261
|
-
id =
|
|
261
|
+
id = DataHubAccessTokenUrn.from_string(id)
|
|
262
262
|
except InvalidUrnError:
|
|
263
|
-
raise InvalidUrnError(f'Expecting a
|
|
263
|
+
raise InvalidUrnError(f'Expecting a DataHubAccessTokenUrn but got {id}')
|
|
264
264
|
else:
|
|
265
265
|
id = UrnEncoder.encode_string(id)
|
|
266
266
|
|
|
267
267
|
# Validation logic.
|
|
268
268
|
if not id:
|
|
269
|
-
raise InvalidUrnError("
|
|
270
|
-
if isinstance(id,
|
|
269
|
+
raise InvalidUrnError("DataHubAccessTokenUrn id cannot be empty")
|
|
270
|
+
if isinstance(id, DataHubAccessTokenUrn):
|
|
271
271
|
id = id.id
|
|
272
272
|
elif isinstance(id, Urn):
|
|
273
|
-
raise InvalidUrnError(f'Expecting a
|
|
273
|
+
raise InvalidUrnError(f'Expecting a DataHubAccessTokenUrn but got {id}')
|
|
274
274
|
if UrnEncoder.contains_reserved_char(id):
|
|
275
|
-
raise InvalidUrnError(f'
|
|
275
|
+
raise InvalidUrnError(f'DataHubAccessTokenUrn id contains reserved characters')
|
|
276
276
|
|
|
277
277
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
278
278
|
|
|
279
279
|
@classmethod
|
|
280
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
280
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubAccessTokenUrn":
|
|
281
281
|
if len(entity_ids) != cls._URN_PARTS:
|
|
282
|
-
raise InvalidUrnError(f"
|
|
282
|
+
raise InvalidUrnError(f"DataHubAccessTokenUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
283
283
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
284
284
|
|
|
285
285
|
@classmethod
|
|
286
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
287
|
-
from datahub.metadata.schema_classes import
|
|
286
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubAccessTokenKeyClass"]:
|
|
287
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
288
288
|
|
|
289
|
-
return
|
|
289
|
+
return DataHubAccessTokenKeyClass
|
|
290
290
|
|
|
291
|
-
def to_key_aspect(self) -> "
|
|
292
|
-
from datahub.metadata.schema_classes import
|
|
291
|
+
def to_key_aspect(self) -> "DataHubAccessTokenKeyClass":
|
|
292
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
293
293
|
|
|
294
|
-
return
|
|
294
|
+
return DataHubAccessTokenKeyClass(id=self.id)
|
|
295
295
|
|
|
296
296
|
@classmethod
|
|
297
|
-
def from_key_aspect(cls, key_aspect: "
|
|
297
|
+
def from_key_aspect(cls, key_aspect: "DataHubAccessTokenKeyClass") -> "DataHubAccessTokenUrn":
|
|
298
298
|
return cls(id=key_aspect.id)
|
|
299
299
|
|
|
300
300
|
@property
|
|
301
301
|
def id(self) -> str:
|
|
302
|
-
return self.
|
|
302
|
+
return self._entity_ids[0]
|
|
303
303
|
|
|
304
304
|
if TYPE_CHECKING:
|
|
305
|
-
from datahub.metadata.schema_classes import
|
|
305
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
306
306
|
|
|
307
|
-
class
|
|
308
|
-
ENTITY_TYPE: ClassVar[
|
|
309
|
-
_URN_PARTS: ClassVar[int] =
|
|
307
|
+
class DataHubConnectionUrn(_SpecificUrn):
|
|
308
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubConnection"]] = "dataHubConnection"
|
|
309
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
310
310
|
|
|
311
|
-
def __init__(self,
|
|
311
|
+
def __init__(self, id: Union["DataHubConnectionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
312
312
|
if _allow_coercion:
|
|
313
313
|
# Field coercion logic (if any is required).
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
if isinstance(id, str):
|
|
315
|
+
if id.startswith('urn:li:'):
|
|
316
|
+
try:
|
|
317
|
+
id = DataHubConnectionUrn.from_string(id)
|
|
318
|
+
except InvalidUrnError:
|
|
319
|
+
raise InvalidUrnError(f'Expecting a DataHubConnectionUrn but got {id}')
|
|
320
|
+
else:
|
|
321
|
+
id = UrnEncoder.encode_string(id)
|
|
317
322
|
|
|
318
323
|
# Validation logic.
|
|
319
|
-
if not
|
|
320
|
-
raise InvalidUrnError("
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
raise InvalidUrnError(
|
|
325
|
-
if UrnEncoder.contains_reserved_char(
|
|
326
|
-
raise InvalidUrnError(f'
|
|
327
|
-
if not env:
|
|
328
|
-
raise InvalidUrnError("MlModelGroupUrn env cannot be empty")
|
|
329
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
330
|
-
raise InvalidUrnError(f'MlModelGroupUrn env contains reserved characters')
|
|
324
|
+
if not id:
|
|
325
|
+
raise InvalidUrnError("DataHubConnectionUrn id cannot be empty")
|
|
326
|
+
if isinstance(id, DataHubConnectionUrn):
|
|
327
|
+
id = id.id
|
|
328
|
+
elif isinstance(id, Urn):
|
|
329
|
+
raise InvalidUrnError(f'Expecting a DataHubConnectionUrn but got {id}')
|
|
330
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
331
|
+
raise InvalidUrnError(f'DataHubConnectionUrn id contains reserved characters')
|
|
331
332
|
|
|
332
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
333
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
333
334
|
|
|
334
335
|
@classmethod
|
|
335
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
336
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubConnectionUrn":
|
|
336
337
|
if len(entity_ids) != cls._URN_PARTS:
|
|
337
|
-
raise InvalidUrnError(f"
|
|
338
|
-
return cls(
|
|
338
|
+
raise InvalidUrnError(f"DataHubConnectionUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
339
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
339
340
|
|
|
340
341
|
@classmethod
|
|
341
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
342
|
-
from datahub.metadata.schema_classes import
|
|
342
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubConnectionKeyClass"]:
|
|
343
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
343
344
|
|
|
344
|
-
return
|
|
345
|
+
return DataHubConnectionKeyClass
|
|
345
346
|
|
|
346
|
-
def to_key_aspect(self) -> "
|
|
347
|
-
from datahub.metadata.schema_classes import
|
|
347
|
+
def to_key_aspect(self) -> "DataHubConnectionKeyClass":
|
|
348
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
348
349
|
|
|
349
|
-
return
|
|
350
|
+
return DataHubConnectionKeyClass(id=self.id)
|
|
350
351
|
|
|
351
352
|
@classmethod
|
|
352
|
-
def from_key_aspect(cls, key_aspect: "
|
|
353
|
-
return cls(
|
|
354
|
-
|
|
355
|
-
@property
|
|
356
|
-
def platform(self) -> str:
|
|
357
|
-
return self.entity_ids[0]
|
|
358
|
-
|
|
359
|
-
@property
|
|
360
|
-
def name(self) -> str:
|
|
361
|
-
return self.entity_ids[1]
|
|
353
|
+
def from_key_aspect(cls, key_aspect: "DataHubConnectionKeyClass") -> "DataHubConnectionUrn":
|
|
354
|
+
return cls(id=key_aspect.id)
|
|
362
355
|
|
|
363
356
|
@property
|
|
364
|
-
def
|
|
365
|
-
return self.
|
|
357
|
+
def id(self) -> str:
|
|
358
|
+
return self._entity_ids[0]
|
|
366
359
|
|
|
367
360
|
if TYPE_CHECKING:
|
|
368
|
-
from datahub.metadata.schema_classes import
|
|
361
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
369
362
|
|
|
370
|
-
class
|
|
371
|
-
ENTITY_TYPE: ClassVar[
|
|
363
|
+
class DataHubRoleUrn(_SpecificUrn):
|
|
364
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubRole"]] = "dataHubRole"
|
|
372
365
|
_URN_PARTS: ClassVar[int] = 1
|
|
373
366
|
|
|
374
|
-
def __init__(self, id: Union["
|
|
367
|
+
def __init__(self, id: Union["DataHubRoleUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
375
368
|
if _allow_coercion:
|
|
376
369
|
# Field coercion logic (if any is required).
|
|
377
370
|
if isinstance(id, str):
|
|
378
371
|
if id.startswith('urn:li:'):
|
|
379
372
|
try:
|
|
380
|
-
id =
|
|
373
|
+
id = DataHubRoleUrn.from_string(id)
|
|
381
374
|
except InvalidUrnError:
|
|
382
|
-
raise InvalidUrnError(f'Expecting a
|
|
375
|
+
raise InvalidUrnError(f'Expecting a DataHubRoleUrn but got {id}')
|
|
383
376
|
else:
|
|
384
377
|
id = UrnEncoder.encode_string(id)
|
|
385
378
|
|
|
386
379
|
# Validation logic.
|
|
387
380
|
if not id:
|
|
388
|
-
raise InvalidUrnError("
|
|
389
|
-
if isinstance(id,
|
|
381
|
+
raise InvalidUrnError("DataHubRoleUrn id cannot be empty")
|
|
382
|
+
if isinstance(id, DataHubRoleUrn):
|
|
390
383
|
id = id.id
|
|
391
384
|
elif isinstance(id, Urn):
|
|
392
|
-
raise InvalidUrnError(f'Expecting a
|
|
385
|
+
raise InvalidUrnError(f'Expecting a DataHubRoleUrn but got {id}')
|
|
393
386
|
if UrnEncoder.contains_reserved_char(id):
|
|
394
|
-
raise InvalidUrnError(f'
|
|
387
|
+
raise InvalidUrnError(f'DataHubRoleUrn id contains reserved characters')
|
|
395
388
|
|
|
396
389
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
397
390
|
|
|
398
391
|
@classmethod
|
|
399
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
392
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubRoleUrn":
|
|
400
393
|
if len(entity_ids) != cls._URN_PARTS:
|
|
401
|
-
raise InvalidUrnError(f"
|
|
394
|
+
raise InvalidUrnError(f"DataHubRoleUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
402
395
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
403
396
|
|
|
404
397
|
@classmethod
|
|
405
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
406
|
-
from datahub.metadata.schema_classes import
|
|
398
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubRoleKeyClass"]:
|
|
399
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
407
400
|
|
|
408
|
-
return
|
|
401
|
+
return DataHubRoleKeyClass
|
|
409
402
|
|
|
410
|
-
def to_key_aspect(self) -> "
|
|
411
|
-
from datahub.metadata.schema_classes import
|
|
403
|
+
def to_key_aspect(self) -> "DataHubRoleKeyClass":
|
|
404
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
412
405
|
|
|
413
|
-
return
|
|
406
|
+
return DataHubRoleKeyClass(id=self.id)
|
|
414
407
|
|
|
415
408
|
@classmethod
|
|
416
|
-
def from_key_aspect(cls, key_aspect: "
|
|
409
|
+
def from_key_aspect(cls, key_aspect: "DataHubRoleKeyClass") -> "DataHubRoleUrn":
|
|
417
410
|
return cls(id=key_aspect.id)
|
|
418
411
|
|
|
419
412
|
@property
|
|
420
413
|
def id(self) -> str:
|
|
421
|
-
return self.
|
|
422
|
-
|
|
423
|
-
if TYPE_CHECKING:
|
|
424
|
-
from datahub.metadata.schema_classes import TagKeyClass
|
|
425
|
-
|
|
426
|
-
class TagUrn(_SpecificUrn):
|
|
427
|
-
ENTITY_TYPE: ClassVar[str] = "tag"
|
|
428
|
-
_URN_PARTS: ClassVar[int] = 1
|
|
429
|
-
|
|
430
|
-
def __init__(self, name: Union["TagUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
431
|
-
if _allow_coercion:
|
|
432
|
-
# Field coercion logic (if any is required).
|
|
433
|
-
if isinstance(name, str):
|
|
434
|
-
if name.startswith('urn:li:'):
|
|
435
|
-
try:
|
|
436
|
-
name = TagUrn.from_string(name)
|
|
437
|
-
except InvalidUrnError:
|
|
438
|
-
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
439
|
-
else:
|
|
440
|
-
name = UrnEncoder.encode_string(name)
|
|
441
|
-
|
|
442
|
-
# Validation logic.
|
|
443
|
-
if not name:
|
|
444
|
-
raise InvalidUrnError("TagUrn name cannot be empty")
|
|
445
|
-
if isinstance(name, TagUrn):
|
|
446
|
-
name = name.name
|
|
447
|
-
elif isinstance(name, Urn):
|
|
448
|
-
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
449
|
-
if UrnEncoder.contains_reserved_char(name):
|
|
450
|
-
raise InvalidUrnError(f'TagUrn name contains reserved characters')
|
|
451
|
-
|
|
452
|
-
super().__init__(self.ENTITY_TYPE, [name])
|
|
453
|
-
|
|
454
|
-
@classmethod
|
|
455
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "TagUrn":
|
|
456
|
-
if len(entity_ids) != cls._URN_PARTS:
|
|
457
|
-
raise InvalidUrnError(f"TagUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
458
|
-
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
459
|
-
|
|
460
|
-
@classmethod
|
|
461
|
-
def underlying_key_aspect_type(cls) -> Type["TagKeyClass"]:
|
|
462
|
-
from datahub.metadata.schema_classes import TagKeyClass
|
|
463
|
-
|
|
464
|
-
return TagKeyClass
|
|
465
|
-
|
|
466
|
-
def to_key_aspect(self) -> "TagKeyClass":
|
|
467
|
-
from datahub.metadata.schema_classes import TagKeyClass
|
|
468
|
-
|
|
469
|
-
return TagKeyClass(name=self.name)
|
|
470
|
-
|
|
471
|
-
@classmethod
|
|
472
|
-
def from_key_aspect(cls, key_aspect: "TagKeyClass") -> "TagUrn":
|
|
473
|
-
return cls(name=key_aspect.name)
|
|
474
|
-
|
|
475
|
-
@classmethod
|
|
476
|
-
@deprecated(reason="Use the constructor instead")
|
|
477
|
-
def create_from_id(cls, id: str) -> "TagUrn":
|
|
478
|
-
return cls(id)
|
|
479
|
-
|
|
480
|
-
@property
|
|
481
|
-
def name(self) -> str:
|
|
482
|
-
return self.entity_ids[0]
|
|
414
|
+
return self._entity_ids[0]
|
|
483
415
|
|
|
484
416
|
if TYPE_CHECKING:
|
|
485
|
-
from datahub.metadata.schema_classes import
|
|
417
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
486
418
|
|
|
487
|
-
class
|
|
488
|
-
ENTITY_TYPE: ClassVar[
|
|
419
|
+
class MlModelUrn(_SpecificUrn):
|
|
420
|
+
ENTITY_TYPE: ClassVar[Literal["mlModel"]] = "mlModel"
|
|
489
421
|
_URN_PARTS: ClassVar[int] = 3
|
|
490
422
|
|
|
491
423
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
@@ -497,685 +429,621 @@ class MlModelDeploymentUrn(_SpecificUrn):
|
|
|
497
429
|
|
|
498
430
|
# Validation logic.
|
|
499
431
|
if not platform:
|
|
500
|
-
raise InvalidUrnError("
|
|
432
|
+
raise InvalidUrnError("MlModelUrn platform cannot be empty")
|
|
501
433
|
platform = str(platform) # convert urn type to str
|
|
502
434
|
assert DataPlatformUrn.from_string(platform)
|
|
503
435
|
if not name:
|
|
504
|
-
raise InvalidUrnError("
|
|
436
|
+
raise InvalidUrnError("MlModelUrn name cannot be empty")
|
|
505
437
|
if UrnEncoder.contains_reserved_char(name):
|
|
506
|
-
raise InvalidUrnError(f'
|
|
438
|
+
raise InvalidUrnError(f'MlModelUrn name contains reserved characters')
|
|
507
439
|
if not env:
|
|
508
|
-
raise InvalidUrnError("
|
|
440
|
+
raise InvalidUrnError("MlModelUrn env cannot be empty")
|
|
509
441
|
if UrnEncoder.contains_reserved_char(env):
|
|
510
|
-
raise InvalidUrnError(f'
|
|
442
|
+
raise InvalidUrnError(f'MlModelUrn env contains reserved characters')
|
|
511
443
|
|
|
512
444
|
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
513
445
|
|
|
514
446
|
@classmethod
|
|
515
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
447
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelUrn":
|
|
516
448
|
if len(entity_ids) != cls._URN_PARTS:
|
|
517
|
-
raise InvalidUrnError(f"
|
|
449
|
+
raise InvalidUrnError(f"MlModelUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
518
450
|
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
519
451
|
|
|
520
452
|
@classmethod
|
|
521
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
522
|
-
from datahub.metadata.schema_classes import
|
|
453
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelKeyClass"]:
|
|
454
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
523
455
|
|
|
524
|
-
return
|
|
456
|
+
return MLModelKeyClass
|
|
525
457
|
|
|
526
|
-
def to_key_aspect(self) -> "
|
|
527
|
-
from datahub.metadata.schema_classes import
|
|
458
|
+
def to_key_aspect(self) -> "MLModelKeyClass":
|
|
459
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
528
460
|
|
|
529
|
-
return
|
|
461
|
+
return MLModelKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
530
462
|
|
|
531
463
|
@classmethod
|
|
532
|
-
def from_key_aspect(cls, key_aspect: "
|
|
464
|
+
def from_key_aspect(cls, key_aspect: "MLModelKeyClass") -> "MlModelUrn":
|
|
533
465
|
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
534
466
|
|
|
535
467
|
@property
|
|
536
468
|
def platform(self) -> str:
|
|
537
|
-
return self.
|
|
469
|
+
return self._entity_ids[0]
|
|
538
470
|
|
|
539
471
|
@property
|
|
540
472
|
def name(self) -> str:
|
|
541
|
-
return self.
|
|
473
|
+
return self._entity_ids[1]
|
|
542
474
|
|
|
543
475
|
@property
|
|
544
476
|
def env(self) -> str:
|
|
545
|
-
return self.
|
|
477
|
+
return self._entity_ids[2]
|
|
546
478
|
|
|
547
479
|
if TYPE_CHECKING:
|
|
548
|
-
from datahub.metadata.schema_classes import
|
|
480
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
549
481
|
|
|
550
|
-
class
|
|
551
|
-
ENTITY_TYPE: ClassVar[
|
|
552
|
-
_URN_PARTS: ClassVar[int] =
|
|
482
|
+
class NotebookUrn(_SpecificUrn):
|
|
483
|
+
ENTITY_TYPE: ClassVar[Literal["notebook"]] = "notebook"
|
|
484
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
553
485
|
|
|
554
|
-
def __init__(self,
|
|
486
|
+
def __init__(self, notebook_tool: str, notebook_id: str, *, _allow_coercion: bool = True) -> None:
|
|
555
487
|
if _allow_coercion:
|
|
556
488
|
# Field coercion logic (if any is required).
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
try:
|
|
560
|
-
id = DataHubActionUrn.from_string(id)
|
|
561
|
-
except InvalidUrnError:
|
|
562
|
-
raise InvalidUrnError(f'Expecting a DataHubActionUrn but got {id}')
|
|
563
|
-
else:
|
|
564
|
-
id = UrnEncoder.encode_string(id)
|
|
489
|
+
notebook_tool = UrnEncoder.encode_string(notebook_tool)
|
|
490
|
+
notebook_id = UrnEncoder.encode_string(notebook_id)
|
|
565
491
|
|
|
566
492
|
# Validation logic.
|
|
567
|
-
if not
|
|
568
|
-
raise InvalidUrnError("
|
|
569
|
-
if
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
raise InvalidUrnError(
|
|
573
|
-
if UrnEncoder.contains_reserved_char(
|
|
574
|
-
raise InvalidUrnError(f'
|
|
493
|
+
if not notebook_tool:
|
|
494
|
+
raise InvalidUrnError("NotebookUrn notebook_tool cannot be empty")
|
|
495
|
+
if UrnEncoder.contains_reserved_char(notebook_tool):
|
|
496
|
+
raise InvalidUrnError(f'NotebookUrn notebook_tool contains reserved characters')
|
|
497
|
+
if not notebook_id:
|
|
498
|
+
raise InvalidUrnError("NotebookUrn notebook_id cannot be empty")
|
|
499
|
+
if UrnEncoder.contains_reserved_char(notebook_id):
|
|
500
|
+
raise InvalidUrnError(f'NotebookUrn notebook_id contains reserved characters')
|
|
575
501
|
|
|
576
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
502
|
+
super().__init__(self.ENTITY_TYPE, [notebook_tool, notebook_id])
|
|
577
503
|
|
|
578
504
|
@classmethod
|
|
579
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
505
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "NotebookUrn":
|
|
580
506
|
if len(entity_ids) != cls._URN_PARTS:
|
|
581
|
-
raise InvalidUrnError(f"
|
|
582
|
-
return cls(
|
|
507
|
+
raise InvalidUrnError(f"NotebookUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
508
|
+
return cls(notebook_tool=entity_ids[0], notebook_id=entity_ids[1], _allow_coercion=False)
|
|
583
509
|
|
|
584
510
|
@classmethod
|
|
585
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
586
|
-
from datahub.metadata.schema_classes import
|
|
511
|
+
def underlying_key_aspect_type(cls) -> Type["NotebookKeyClass"]:
|
|
512
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
587
513
|
|
|
588
|
-
return
|
|
514
|
+
return NotebookKeyClass
|
|
589
515
|
|
|
590
|
-
def to_key_aspect(self) -> "
|
|
591
|
-
from datahub.metadata.schema_classes import
|
|
516
|
+
def to_key_aspect(self) -> "NotebookKeyClass":
|
|
517
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
592
518
|
|
|
593
|
-
return
|
|
519
|
+
return NotebookKeyClass(notebookTool=self.notebook_tool, notebookId=self.notebook_id)
|
|
594
520
|
|
|
595
521
|
@classmethod
|
|
596
|
-
def from_key_aspect(cls, key_aspect: "
|
|
597
|
-
return cls(
|
|
522
|
+
def from_key_aspect(cls, key_aspect: "NotebookKeyClass") -> "NotebookUrn":
|
|
523
|
+
return cls(notebook_tool=key_aspect.notebookTool, notebook_id=key_aspect.notebookId)
|
|
524
|
+
|
|
525
|
+
@deprecated(reason="Use .notebook_tool instead")
|
|
526
|
+
def get_platform_id(self) -> str:
|
|
527
|
+
return self.notebook_tool
|
|
528
|
+
|
|
529
|
+
@deprecated(reason="Use .notebook_id instead")
|
|
530
|
+
def get_notebook_id(self) -> str:
|
|
531
|
+
return self.notebook_id
|
|
598
532
|
|
|
599
533
|
@property
|
|
600
|
-
def
|
|
601
|
-
return self.
|
|
534
|
+
def notebook_tool(self) -> str:
|
|
535
|
+
return self._entity_ids[0]
|
|
536
|
+
|
|
537
|
+
@property
|
|
538
|
+
def notebook_id(self) -> str:
|
|
539
|
+
return self._entity_ids[1]
|
|
602
540
|
|
|
603
541
|
if TYPE_CHECKING:
|
|
604
|
-
from datahub.metadata.schema_classes import
|
|
542
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
605
543
|
|
|
606
|
-
class
|
|
607
|
-
ENTITY_TYPE: ClassVar[
|
|
544
|
+
class RoleUrn(_SpecificUrn):
|
|
545
|
+
ENTITY_TYPE: ClassVar[Literal["role"]] = "role"
|
|
608
546
|
_URN_PARTS: ClassVar[int] = 1
|
|
609
547
|
|
|
610
|
-
def __init__(self, id: Union["
|
|
548
|
+
def __init__(self, id: Union["RoleUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
611
549
|
if _allow_coercion:
|
|
612
550
|
# Field coercion logic (if any is required).
|
|
613
551
|
if isinstance(id, str):
|
|
614
552
|
if id.startswith('urn:li:'):
|
|
615
553
|
try:
|
|
616
|
-
id =
|
|
554
|
+
id = RoleUrn.from_string(id)
|
|
617
555
|
except InvalidUrnError:
|
|
618
|
-
raise InvalidUrnError(f'Expecting a
|
|
556
|
+
raise InvalidUrnError(f'Expecting a RoleUrn but got {id}')
|
|
619
557
|
else:
|
|
620
558
|
id = UrnEncoder.encode_string(id)
|
|
621
559
|
|
|
622
560
|
# Validation logic.
|
|
623
561
|
if not id:
|
|
624
|
-
raise InvalidUrnError("
|
|
625
|
-
if isinstance(id,
|
|
562
|
+
raise InvalidUrnError("RoleUrn id cannot be empty")
|
|
563
|
+
if isinstance(id, RoleUrn):
|
|
626
564
|
id = id.id
|
|
627
565
|
elif isinstance(id, Urn):
|
|
628
|
-
raise InvalidUrnError(f'Expecting a
|
|
566
|
+
raise InvalidUrnError(f'Expecting a RoleUrn but got {id}')
|
|
629
567
|
if UrnEncoder.contains_reserved_char(id):
|
|
630
|
-
raise InvalidUrnError(f'
|
|
568
|
+
raise InvalidUrnError(f'RoleUrn id contains reserved characters')
|
|
631
569
|
|
|
632
570
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
633
571
|
|
|
634
572
|
@classmethod
|
|
635
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
573
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "RoleUrn":
|
|
636
574
|
if len(entity_ids) != cls._URN_PARTS:
|
|
637
|
-
raise InvalidUrnError(f"
|
|
575
|
+
raise InvalidUrnError(f"RoleUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
638
576
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
639
577
|
|
|
640
578
|
@classmethod
|
|
641
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
642
|
-
from datahub.metadata.schema_classes import
|
|
579
|
+
def underlying_key_aspect_type(cls) -> Type["RoleKeyClass"]:
|
|
580
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
643
581
|
|
|
644
|
-
return
|
|
582
|
+
return RoleKeyClass
|
|
645
583
|
|
|
646
|
-
def to_key_aspect(self) -> "
|
|
647
|
-
from datahub.metadata.schema_classes import
|
|
584
|
+
def to_key_aspect(self) -> "RoleKeyClass":
|
|
585
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
648
586
|
|
|
649
|
-
return
|
|
587
|
+
return RoleKeyClass(id=self.id)
|
|
650
588
|
|
|
651
589
|
@classmethod
|
|
652
|
-
def from_key_aspect(cls, key_aspect: "
|
|
590
|
+
def from_key_aspect(cls, key_aspect: "RoleKeyClass") -> "RoleUrn":
|
|
653
591
|
return cls(id=key_aspect.id)
|
|
654
592
|
|
|
655
593
|
@property
|
|
656
594
|
def id(self) -> str:
|
|
657
|
-
return self.
|
|
595
|
+
return self._entity_ids[0]
|
|
658
596
|
|
|
659
597
|
if TYPE_CHECKING:
|
|
660
|
-
from datahub.metadata.schema_classes import
|
|
598
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
661
599
|
|
|
662
|
-
class
|
|
663
|
-
ENTITY_TYPE: ClassVar[
|
|
600
|
+
class GlobalSettingsUrn(_SpecificUrn):
|
|
601
|
+
ENTITY_TYPE: ClassVar[Literal["globalSettings"]] = "globalSettings"
|
|
664
602
|
_URN_PARTS: ClassVar[int] = 1
|
|
665
603
|
|
|
666
|
-
def __init__(self, id: Union["
|
|
604
|
+
def __init__(self, id: Union["GlobalSettingsUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
667
605
|
if _allow_coercion:
|
|
668
606
|
# Field coercion logic (if any is required).
|
|
669
607
|
if isinstance(id, str):
|
|
670
608
|
if id.startswith('urn:li:'):
|
|
671
609
|
try:
|
|
672
|
-
id =
|
|
610
|
+
id = GlobalSettingsUrn.from_string(id)
|
|
673
611
|
except InvalidUrnError:
|
|
674
|
-
raise InvalidUrnError(f'Expecting a
|
|
612
|
+
raise InvalidUrnError(f'Expecting a GlobalSettingsUrn but got {id}')
|
|
675
613
|
else:
|
|
676
614
|
id = UrnEncoder.encode_string(id)
|
|
677
615
|
|
|
678
616
|
# Validation logic.
|
|
679
617
|
if not id:
|
|
680
|
-
raise InvalidUrnError("
|
|
681
|
-
if isinstance(id,
|
|
618
|
+
raise InvalidUrnError("GlobalSettingsUrn id cannot be empty")
|
|
619
|
+
if isinstance(id, GlobalSettingsUrn):
|
|
682
620
|
id = id.id
|
|
683
621
|
elif isinstance(id, Urn):
|
|
684
|
-
raise InvalidUrnError(f'Expecting a
|
|
622
|
+
raise InvalidUrnError(f'Expecting a GlobalSettingsUrn but got {id}')
|
|
685
623
|
if UrnEncoder.contains_reserved_char(id):
|
|
686
|
-
raise InvalidUrnError(f'
|
|
624
|
+
raise InvalidUrnError(f'GlobalSettingsUrn id contains reserved characters')
|
|
687
625
|
|
|
688
626
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
689
627
|
|
|
690
628
|
@classmethod
|
|
691
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
629
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlobalSettingsUrn":
|
|
692
630
|
if len(entity_ids) != cls._URN_PARTS:
|
|
693
|
-
raise InvalidUrnError(f"
|
|
631
|
+
raise InvalidUrnError(f"GlobalSettingsUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
694
632
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
695
633
|
|
|
696
634
|
@classmethod
|
|
697
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
698
|
-
from datahub.metadata.schema_classes import
|
|
635
|
+
def underlying_key_aspect_type(cls) -> Type["GlobalSettingsKeyClass"]:
|
|
636
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
699
637
|
|
|
700
|
-
return
|
|
638
|
+
return GlobalSettingsKeyClass
|
|
701
639
|
|
|
702
|
-
def to_key_aspect(self) -> "
|
|
703
|
-
from datahub.metadata.schema_classes import
|
|
640
|
+
def to_key_aspect(self) -> "GlobalSettingsKeyClass":
|
|
641
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
704
642
|
|
|
705
|
-
return
|
|
643
|
+
return GlobalSettingsKeyClass(id=self.id)
|
|
706
644
|
|
|
707
645
|
@classmethod
|
|
708
|
-
def from_key_aspect(cls, key_aspect: "
|
|
646
|
+
def from_key_aspect(cls, key_aspect: "GlobalSettingsKeyClass") -> "GlobalSettingsUrn":
|
|
709
647
|
return cls(id=key_aspect.id)
|
|
710
648
|
|
|
711
649
|
@property
|
|
712
650
|
def id(self) -> str:
|
|
713
|
-
return self.
|
|
651
|
+
return self._entity_ids[0]
|
|
714
652
|
|
|
715
653
|
if TYPE_CHECKING:
|
|
716
|
-
from datahub.metadata.schema_classes import
|
|
717
|
-
|
|
718
|
-
class FormUrn(_SpecificUrn):
|
|
719
|
-
ENTITY_TYPE: ClassVar[str] = "form"
|
|
720
|
-
_URN_PARTS: ClassVar[int] = 1
|
|
654
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
721
655
|
|
|
722
|
-
|
|
656
|
+
class DatasetUrn(_SpecificUrn):
|
|
657
|
+
ENTITY_TYPE: ClassVar[Literal["dataset"]] = "dataset"
|
|
658
|
+
_URN_PARTS: ClassVar[int] = 3
|
|
659
|
+
|
|
660
|
+
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
723
661
|
if _allow_coercion:
|
|
724
662
|
# Field coercion logic (if any is required).
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
id = FormUrn.from_string(id)
|
|
729
|
-
except InvalidUrnError:
|
|
730
|
-
raise InvalidUrnError(f'Expecting a FormUrn but got {id}')
|
|
731
|
-
else:
|
|
732
|
-
id = UrnEncoder.encode_string(id)
|
|
663
|
+
platform = DataPlatformUrn(platform).urn()
|
|
664
|
+
name = UrnEncoder.encode_string(name)
|
|
665
|
+
env = env.upper()
|
|
733
666
|
|
|
734
667
|
# Validation logic.
|
|
735
|
-
if not
|
|
736
|
-
raise InvalidUrnError("
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
raise InvalidUrnError(
|
|
741
|
-
if UrnEncoder.contains_reserved_char(
|
|
742
|
-
raise InvalidUrnError(f'
|
|
668
|
+
if not platform:
|
|
669
|
+
raise InvalidUrnError("DatasetUrn platform cannot be empty")
|
|
670
|
+
platform = str(platform) # convert urn type to str
|
|
671
|
+
assert DataPlatformUrn.from_string(platform)
|
|
672
|
+
if not name:
|
|
673
|
+
raise InvalidUrnError("DatasetUrn name cannot be empty")
|
|
674
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
675
|
+
raise InvalidUrnError(f'DatasetUrn name contains reserved characters')
|
|
676
|
+
if not env:
|
|
677
|
+
raise InvalidUrnError("DatasetUrn env cannot be empty")
|
|
678
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
679
|
+
raise InvalidUrnError(f'DatasetUrn env contains reserved characters')
|
|
743
680
|
|
|
744
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
681
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
745
682
|
|
|
746
683
|
@classmethod
|
|
747
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
684
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DatasetUrn":
|
|
748
685
|
if len(entity_ids) != cls._URN_PARTS:
|
|
749
|
-
raise InvalidUrnError(f"
|
|
750
|
-
return cls(
|
|
751
|
-
|
|
752
|
-
@classmethod
|
|
753
|
-
def underlying_key_aspect_type(cls) -> Type["FormKeyClass"]:
|
|
754
|
-
from datahub.metadata.schema_classes import FormKeyClass
|
|
755
|
-
|
|
756
|
-
return FormKeyClass
|
|
757
|
-
|
|
758
|
-
def to_key_aspect(self) -> "FormKeyClass":
|
|
759
|
-
from datahub.metadata.schema_classes import FormKeyClass
|
|
760
|
-
|
|
761
|
-
return FormKeyClass(id=self.id)
|
|
686
|
+
raise InvalidUrnError(f"DatasetUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
687
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
762
688
|
|
|
763
689
|
@classmethod
|
|
764
|
-
def
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
@property
|
|
768
|
-
def id(self) -> str:
|
|
769
|
-
return self.entity_ids[0]
|
|
770
|
-
|
|
771
|
-
if TYPE_CHECKING:
|
|
772
|
-
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
773
|
-
|
|
774
|
-
class NotebookUrn(_SpecificUrn):
|
|
775
|
-
ENTITY_TYPE: ClassVar[str] = "notebook"
|
|
776
|
-
_URN_PARTS: ClassVar[int] = 2
|
|
690
|
+
def underlying_key_aspect_type(cls) -> Type["DatasetKeyClass"]:
|
|
691
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
777
692
|
|
|
778
|
-
|
|
779
|
-
if _allow_coercion:
|
|
780
|
-
# Field coercion logic (if any is required).
|
|
781
|
-
notebook_tool = UrnEncoder.encode_string(notebook_tool)
|
|
782
|
-
notebook_id = UrnEncoder.encode_string(notebook_id)
|
|
693
|
+
return DatasetKeyClass
|
|
783
694
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
raise InvalidUrnError("NotebookUrn notebook_tool cannot be empty")
|
|
787
|
-
if UrnEncoder.contains_reserved_char(notebook_tool):
|
|
788
|
-
raise InvalidUrnError(f'NotebookUrn notebook_tool contains reserved characters')
|
|
789
|
-
if not notebook_id:
|
|
790
|
-
raise InvalidUrnError("NotebookUrn notebook_id cannot be empty")
|
|
791
|
-
if UrnEncoder.contains_reserved_char(notebook_id):
|
|
792
|
-
raise InvalidUrnError(f'NotebookUrn notebook_id contains reserved characters')
|
|
695
|
+
def to_key_aspect(self) -> "DatasetKeyClass":
|
|
696
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
793
697
|
|
|
794
|
-
|
|
698
|
+
return DatasetKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
795
699
|
|
|
796
700
|
@classmethod
|
|
797
|
-
def
|
|
798
|
-
|
|
799
|
-
raise InvalidUrnError(f"NotebookUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
800
|
-
return cls(notebook_tool=entity_ids[0], notebook_id=entity_ids[1], _allow_coercion=False)
|
|
701
|
+
def from_key_aspect(cls, key_aspect: "DatasetKeyClass") -> "DatasetUrn":
|
|
702
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
801
703
|
|
|
802
704
|
@classmethod
|
|
803
|
-
def
|
|
804
|
-
|
|
705
|
+
def create_from_ids(
|
|
706
|
+
cls,
|
|
707
|
+
platform_id: str,
|
|
708
|
+
table_name: str,
|
|
709
|
+
env: str,
|
|
710
|
+
platform_instance: Optional[str] = None,
|
|
711
|
+
) -> "DatasetUrn":
|
|
712
|
+
return DatasetUrn(
|
|
713
|
+
platform=platform_id,
|
|
714
|
+
name=f"{platform_instance}.{table_name}" if platform_instance else table_name,
|
|
715
|
+
env=env,
|
|
716
|
+
)
|
|
805
717
|
|
|
806
|
-
|
|
718
|
+
from datahub.utilities.urns.field_paths import get_simple_field_path_from_v2_field_path as _get_simple_field_path_from_v2_field_path
|
|
807
719
|
|
|
808
|
-
|
|
809
|
-
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
720
|
+
get_simple_field_path_from_v2_field_path = staticmethod(deprecated(reason='Use the function from the field_paths module instead')(_get_simple_field_path_from_v2_field_path))
|
|
810
721
|
|
|
811
|
-
|
|
722
|
+
def get_data_platform_urn(self) -> "DataPlatformUrn":
|
|
723
|
+
return DataPlatformUrn.from_string(self.platform)
|
|
812
724
|
|
|
813
|
-
@
|
|
814
|
-
def
|
|
815
|
-
return
|
|
725
|
+
@deprecated(reason="Use .name instead")
|
|
726
|
+
def get_dataset_name(self) -> str:
|
|
727
|
+
return self.name
|
|
816
728
|
|
|
817
|
-
@deprecated(reason="Use .
|
|
818
|
-
def
|
|
819
|
-
return self.
|
|
729
|
+
@deprecated(reason="Use .env instead")
|
|
730
|
+
def get_env(self) -> str:
|
|
731
|
+
return self.env
|
|
820
732
|
|
|
821
|
-
@
|
|
822
|
-
def
|
|
823
|
-
return self.
|
|
733
|
+
@property
|
|
734
|
+
def platform(self) -> str:
|
|
735
|
+
return self._entity_ids[0]
|
|
824
736
|
|
|
825
737
|
@property
|
|
826
|
-
def
|
|
827
|
-
return self.
|
|
738
|
+
def name(self) -> str:
|
|
739
|
+
return self._entity_ids[1]
|
|
828
740
|
|
|
829
741
|
@property
|
|
830
|
-
def
|
|
831
|
-
return self.
|
|
742
|
+
def env(self) -> str:
|
|
743
|
+
return self._entity_ids[2]
|
|
832
744
|
|
|
833
745
|
if TYPE_CHECKING:
|
|
834
|
-
from datahub.metadata.schema_classes import
|
|
746
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
835
747
|
|
|
836
|
-
class
|
|
837
|
-
ENTITY_TYPE: ClassVar[
|
|
838
|
-
_URN_PARTS: ClassVar[int] =
|
|
748
|
+
class ChartUrn(_SpecificUrn):
|
|
749
|
+
ENTITY_TYPE: ClassVar[Literal["chart"]] = "chart"
|
|
750
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
839
751
|
|
|
840
|
-
def __init__(self,
|
|
752
|
+
def __init__(self, dashboard_tool: str, chart_id: str, *, _allow_coercion: bool = True) -> None:
|
|
841
753
|
if _allow_coercion:
|
|
842
754
|
# Field coercion logic (if any is required).
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
try:
|
|
846
|
-
id = DataHubConnectionUrn.from_string(id)
|
|
847
|
-
except InvalidUrnError:
|
|
848
|
-
raise InvalidUrnError(f'Expecting a DataHubConnectionUrn but got {id}')
|
|
849
|
-
else:
|
|
850
|
-
id = UrnEncoder.encode_string(id)
|
|
755
|
+
dashboard_tool = UrnEncoder.encode_string(dashboard_tool)
|
|
756
|
+
chart_id = UrnEncoder.encode_string(chart_id)
|
|
851
757
|
|
|
852
758
|
# Validation logic.
|
|
853
|
-
if not
|
|
854
|
-
raise InvalidUrnError("
|
|
855
|
-
if
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
raise InvalidUrnError(
|
|
859
|
-
if UrnEncoder.contains_reserved_char(
|
|
860
|
-
raise InvalidUrnError(f'
|
|
759
|
+
if not dashboard_tool:
|
|
760
|
+
raise InvalidUrnError("ChartUrn dashboard_tool cannot be empty")
|
|
761
|
+
if UrnEncoder.contains_reserved_char(dashboard_tool):
|
|
762
|
+
raise InvalidUrnError(f'ChartUrn dashboard_tool contains reserved characters')
|
|
763
|
+
if not chart_id:
|
|
764
|
+
raise InvalidUrnError("ChartUrn chart_id cannot be empty")
|
|
765
|
+
if UrnEncoder.contains_reserved_char(chart_id):
|
|
766
|
+
raise InvalidUrnError(f'ChartUrn chart_id contains reserved characters')
|
|
861
767
|
|
|
862
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
768
|
+
super().__init__(self.ENTITY_TYPE, [dashboard_tool, chart_id])
|
|
863
769
|
|
|
864
770
|
@classmethod
|
|
865
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
771
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ChartUrn":
|
|
866
772
|
if len(entity_ids) != cls._URN_PARTS:
|
|
867
|
-
raise InvalidUrnError(f"
|
|
868
|
-
return cls(
|
|
773
|
+
raise InvalidUrnError(f"ChartUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
774
|
+
return cls(dashboard_tool=entity_ids[0], chart_id=entity_ids[1], _allow_coercion=False)
|
|
869
775
|
|
|
870
776
|
@classmethod
|
|
871
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
872
|
-
from datahub.metadata.schema_classes import
|
|
777
|
+
def underlying_key_aspect_type(cls) -> Type["ChartKeyClass"]:
|
|
778
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
873
779
|
|
|
874
|
-
return
|
|
780
|
+
return ChartKeyClass
|
|
875
781
|
|
|
876
|
-
def to_key_aspect(self) -> "
|
|
877
|
-
from datahub.metadata.schema_classes import
|
|
782
|
+
def to_key_aspect(self) -> "ChartKeyClass":
|
|
783
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
878
784
|
|
|
879
|
-
return
|
|
785
|
+
return ChartKeyClass(dashboardTool=self.dashboard_tool, chartId=self.chart_id)
|
|
880
786
|
|
|
881
787
|
@classmethod
|
|
882
|
-
def from_key_aspect(cls, key_aspect: "
|
|
883
|
-
return cls(
|
|
788
|
+
def from_key_aspect(cls, key_aspect: "ChartKeyClass") -> "ChartUrn":
|
|
789
|
+
return cls(dashboard_tool=key_aspect.dashboardTool, chart_id=key_aspect.chartId)
|
|
884
790
|
|
|
791
|
+
@classmethod
|
|
792
|
+
def create_from_ids(
|
|
793
|
+
cls,
|
|
794
|
+
platform: str,
|
|
795
|
+
name: str,
|
|
796
|
+
platform_instance: Optional[str] = None,
|
|
797
|
+
) -> "ChartUrn":
|
|
798
|
+
return ChartUrn(
|
|
799
|
+
dashboard_tool=platform,
|
|
800
|
+
chart_id=f"{platform_instance}.{name}" if platform_instance else name,
|
|
801
|
+
)
|
|
802
|
+
|
|
885
803
|
@property
|
|
886
|
-
def
|
|
887
|
-
return self.
|
|
804
|
+
def dashboard_tool(self) -> str:
|
|
805
|
+
return self._entity_ids[0]
|
|
806
|
+
|
|
807
|
+
@property
|
|
808
|
+
def chart_id(self) -> str:
|
|
809
|
+
return self._entity_ids[1]
|
|
888
810
|
|
|
889
811
|
if TYPE_CHECKING:
|
|
890
|
-
from datahub.metadata.schema_classes import
|
|
812
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
891
813
|
|
|
892
|
-
class
|
|
893
|
-
ENTITY_TYPE: ClassVar[
|
|
814
|
+
class GlossaryNodeUrn(_SpecificUrn):
|
|
815
|
+
ENTITY_TYPE: ClassVar[Literal["glossaryNode"]] = "glossaryNode"
|
|
894
816
|
_URN_PARTS: ClassVar[int] = 1
|
|
895
817
|
|
|
896
|
-
def __init__(self,
|
|
818
|
+
def __init__(self, name: Union["GlossaryNodeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
897
819
|
if _allow_coercion:
|
|
898
820
|
# Field coercion logic (if any is required).
|
|
899
|
-
if isinstance(
|
|
900
|
-
if
|
|
821
|
+
if isinstance(name, str):
|
|
822
|
+
if name.startswith('urn:li:'):
|
|
901
823
|
try:
|
|
902
|
-
|
|
824
|
+
name = GlossaryNodeUrn.from_string(name)
|
|
903
825
|
except InvalidUrnError:
|
|
904
|
-
raise InvalidUrnError(f'Expecting a
|
|
826
|
+
raise InvalidUrnError(f'Expecting a GlossaryNodeUrn but got {name}')
|
|
905
827
|
else:
|
|
906
|
-
|
|
828
|
+
name = UrnEncoder.encode_string(name)
|
|
907
829
|
|
|
908
830
|
# Validation logic.
|
|
909
|
-
if not
|
|
910
|
-
raise InvalidUrnError("
|
|
911
|
-
if isinstance(
|
|
912
|
-
|
|
913
|
-
elif isinstance(
|
|
914
|
-
raise InvalidUrnError(f'Expecting a
|
|
915
|
-
if UrnEncoder.contains_reserved_char(
|
|
916
|
-
raise InvalidUrnError(f'
|
|
831
|
+
if not name:
|
|
832
|
+
raise InvalidUrnError("GlossaryNodeUrn name cannot be empty")
|
|
833
|
+
if isinstance(name, GlossaryNodeUrn):
|
|
834
|
+
name = name.name
|
|
835
|
+
elif isinstance(name, Urn):
|
|
836
|
+
raise InvalidUrnError(f'Expecting a GlossaryNodeUrn but got {name}')
|
|
837
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
838
|
+
raise InvalidUrnError(f'GlossaryNodeUrn name contains reserved characters')
|
|
917
839
|
|
|
918
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
840
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
919
841
|
|
|
920
842
|
@classmethod
|
|
921
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
843
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlossaryNodeUrn":
|
|
922
844
|
if len(entity_ids) != cls._URN_PARTS:
|
|
923
|
-
raise InvalidUrnError(f"
|
|
924
|
-
return cls(
|
|
845
|
+
raise InvalidUrnError(f"GlossaryNodeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
846
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
925
847
|
|
|
926
848
|
@classmethod
|
|
927
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
928
|
-
from datahub.metadata.schema_classes import
|
|
849
|
+
def underlying_key_aspect_type(cls) -> Type["GlossaryNodeKeyClass"]:
|
|
850
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
929
851
|
|
|
930
|
-
return
|
|
852
|
+
return GlossaryNodeKeyClass
|
|
931
853
|
|
|
932
|
-
def to_key_aspect(self) -> "
|
|
933
|
-
from datahub.metadata.schema_classes import
|
|
854
|
+
def to_key_aspect(self) -> "GlossaryNodeKeyClass":
|
|
855
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
934
856
|
|
|
935
|
-
return
|
|
857
|
+
return GlossaryNodeKeyClass(name=self.name)
|
|
936
858
|
|
|
937
859
|
@classmethod
|
|
938
|
-
def from_key_aspect(cls, key_aspect: "
|
|
939
|
-
return cls(
|
|
860
|
+
def from_key_aspect(cls, key_aspect: "GlossaryNodeKeyClass") -> "GlossaryNodeUrn":
|
|
861
|
+
return cls(name=key_aspect.name)
|
|
940
862
|
|
|
941
863
|
@property
|
|
942
|
-
def
|
|
943
|
-
return self.
|
|
864
|
+
def name(self) -> str:
|
|
865
|
+
return self._entity_ids[0]
|
|
944
866
|
|
|
945
867
|
if TYPE_CHECKING:
|
|
946
|
-
from datahub.metadata.schema_classes import
|
|
868
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
947
869
|
|
|
948
|
-
class
|
|
949
|
-
ENTITY_TYPE: ClassVar[
|
|
870
|
+
class AssertionUrn(_SpecificUrn):
|
|
871
|
+
ENTITY_TYPE: ClassVar[Literal["assertion"]] = "assertion"
|
|
950
872
|
_URN_PARTS: ClassVar[int] = 1
|
|
951
873
|
|
|
952
|
-
def __init__(self,
|
|
874
|
+
def __init__(self, assertion_id: Union["AssertionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
953
875
|
if _allow_coercion:
|
|
954
876
|
# Field coercion logic (if any is required).
|
|
955
|
-
if isinstance(
|
|
956
|
-
if
|
|
877
|
+
if isinstance(assertion_id, str):
|
|
878
|
+
if assertion_id.startswith('urn:li:'):
|
|
957
879
|
try:
|
|
958
|
-
|
|
880
|
+
assertion_id = AssertionUrn.from_string(assertion_id)
|
|
959
881
|
except InvalidUrnError:
|
|
960
|
-
raise InvalidUrnError(f'Expecting a
|
|
882
|
+
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
961
883
|
else:
|
|
962
|
-
|
|
884
|
+
assertion_id = UrnEncoder.encode_string(assertion_id)
|
|
963
885
|
|
|
964
886
|
# Validation logic.
|
|
965
|
-
if not
|
|
966
|
-
raise InvalidUrnError("
|
|
967
|
-
if isinstance(
|
|
968
|
-
|
|
969
|
-
elif isinstance(
|
|
970
|
-
raise InvalidUrnError(f'Expecting a
|
|
971
|
-
if UrnEncoder.contains_reserved_char(
|
|
972
|
-
raise InvalidUrnError(f'
|
|
887
|
+
if not assertion_id:
|
|
888
|
+
raise InvalidUrnError("AssertionUrn assertion_id cannot be empty")
|
|
889
|
+
if isinstance(assertion_id, AssertionUrn):
|
|
890
|
+
assertion_id = assertion_id.assertion_id
|
|
891
|
+
elif isinstance(assertion_id, Urn):
|
|
892
|
+
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
893
|
+
if UrnEncoder.contains_reserved_char(assertion_id):
|
|
894
|
+
raise InvalidUrnError(f'AssertionUrn assertion_id contains reserved characters')
|
|
973
895
|
|
|
974
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
896
|
+
super().__init__(self.ENTITY_TYPE, [assertion_id])
|
|
975
897
|
|
|
976
898
|
@classmethod
|
|
977
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
899
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "AssertionUrn":
|
|
978
900
|
if len(entity_ids) != cls._URN_PARTS:
|
|
979
|
-
raise InvalidUrnError(f"
|
|
980
|
-
return cls(
|
|
901
|
+
raise InvalidUrnError(f"AssertionUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
902
|
+
return cls(assertion_id=entity_ids[0], _allow_coercion=False)
|
|
981
903
|
|
|
982
904
|
@classmethod
|
|
983
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
984
|
-
from datahub.metadata.schema_classes import
|
|
905
|
+
def underlying_key_aspect_type(cls) -> Type["AssertionKeyClass"]:
|
|
906
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
985
907
|
|
|
986
|
-
return
|
|
908
|
+
return AssertionKeyClass
|
|
987
909
|
|
|
988
|
-
def to_key_aspect(self) -> "
|
|
989
|
-
from datahub.metadata.schema_classes import
|
|
910
|
+
def to_key_aspect(self) -> "AssertionKeyClass":
|
|
911
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
990
912
|
|
|
991
|
-
return
|
|
913
|
+
return AssertionKeyClass(assertionId=self.assertion_id)
|
|
992
914
|
|
|
993
915
|
@classmethod
|
|
994
|
-
def from_key_aspect(cls, key_aspect: "
|
|
995
|
-
return cls(
|
|
916
|
+
def from_key_aspect(cls, key_aspect: "AssertionKeyClass") -> "AssertionUrn":
|
|
917
|
+
return cls(assertion_id=key_aspect.assertionId)
|
|
996
918
|
|
|
997
919
|
@property
|
|
998
|
-
def
|
|
999
|
-
return self.
|
|
920
|
+
def assertion_id(self) -> str:
|
|
921
|
+
return self._entity_ids[0]
|
|
1000
922
|
|
|
1001
923
|
if TYPE_CHECKING:
|
|
1002
|
-
from datahub.metadata.schema_classes import
|
|
924
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
1003
925
|
|
|
1004
|
-
class
|
|
1005
|
-
ENTITY_TYPE: ClassVar[
|
|
926
|
+
class DataHubExecutionRequestUrn(_SpecificUrn):
|
|
927
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubExecutionRequest"]] = "dataHubExecutionRequest"
|
|
1006
928
|
_URN_PARTS: ClassVar[int] = 1
|
|
1007
929
|
|
|
1008
|
-
def __init__(self, id: Union["
|
|
930
|
+
def __init__(self, id: Union["DataHubExecutionRequestUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1009
931
|
if _allow_coercion:
|
|
1010
932
|
# Field coercion logic (if any is required).
|
|
1011
933
|
if isinstance(id, str):
|
|
1012
934
|
if id.startswith('urn:li:'):
|
|
1013
935
|
try:
|
|
1014
|
-
id =
|
|
936
|
+
id = DataHubExecutionRequestUrn.from_string(id)
|
|
1015
937
|
except InvalidUrnError:
|
|
1016
|
-
raise InvalidUrnError(f'Expecting a
|
|
938
|
+
raise InvalidUrnError(f'Expecting a DataHubExecutionRequestUrn but got {id}')
|
|
1017
939
|
else:
|
|
1018
940
|
id = UrnEncoder.encode_string(id)
|
|
1019
941
|
|
|
1020
942
|
# Validation logic.
|
|
1021
943
|
if not id:
|
|
1022
|
-
raise InvalidUrnError("
|
|
1023
|
-
if isinstance(id,
|
|
944
|
+
raise InvalidUrnError("DataHubExecutionRequestUrn id cannot be empty")
|
|
945
|
+
if isinstance(id, DataHubExecutionRequestUrn):
|
|
1024
946
|
id = id.id
|
|
1025
947
|
elif isinstance(id, Urn):
|
|
1026
|
-
raise InvalidUrnError(f'Expecting a
|
|
948
|
+
raise InvalidUrnError(f'Expecting a DataHubExecutionRequestUrn but got {id}')
|
|
1027
949
|
if UrnEncoder.contains_reserved_char(id):
|
|
1028
|
-
raise InvalidUrnError(f'
|
|
950
|
+
raise InvalidUrnError(f'DataHubExecutionRequestUrn id contains reserved characters')
|
|
1029
951
|
|
|
1030
952
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1031
953
|
|
|
1032
954
|
@classmethod
|
|
1033
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
955
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubExecutionRequestUrn":
|
|
1034
956
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1035
|
-
raise InvalidUrnError(f"
|
|
957
|
+
raise InvalidUrnError(f"DataHubExecutionRequestUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1036
958
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1037
959
|
|
|
1038
960
|
@classmethod
|
|
1039
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1040
|
-
from datahub.metadata.schema_classes import
|
|
961
|
+
def underlying_key_aspect_type(cls) -> Type["ExecutionRequestKeyClass"]:
|
|
962
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
1041
963
|
|
|
1042
|
-
return
|
|
964
|
+
return ExecutionRequestKeyClass
|
|
1043
965
|
|
|
1044
|
-
def to_key_aspect(self) -> "
|
|
1045
|
-
from datahub.metadata.schema_classes import
|
|
966
|
+
def to_key_aspect(self) -> "ExecutionRequestKeyClass":
|
|
967
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
1046
968
|
|
|
1047
|
-
return
|
|
969
|
+
return ExecutionRequestKeyClass(id=self.id)
|
|
1048
970
|
|
|
1049
971
|
@classmethod
|
|
1050
|
-
def from_key_aspect(cls, key_aspect: "
|
|
972
|
+
def from_key_aspect(cls, key_aspect: "ExecutionRequestKeyClass") -> "DataHubExecutionRequestUrn":
|
|
1051
973
|
return cls(id=key_aspect.id)
|
|
1052
974
|
|
|
1053
|
-
@classmethod
|
|
1054
|
-
@deprecated(reason="Use the constructor instead")
|
|
1055
|
-
def create_from_id(cls, id: str) -> "DomainUrn":
|
|
1056
|
-
return cls(id)
|
|
1057
|
-
|
|
1058
975
|
@property
|
|
1059
976
|
def id(self) -> str:
|
|
1060
|
-
return self.
|
|
977
|
+
return self._entity_ids[0]
|
|
1061
978
|
|
|
1062
979
|
if TYPE_CHECKING:
|
|
1063
|
-
from datahub.metadata.schema_classes import
|
|
980
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
1064
981
|
|
|
1065
|
-
class
|
|
1066
|
-
ENTITY_TYPE: ClassVar[
|
|
1067
|
-
_URN_PARTS: ClassVar[int] =
|
|
982
|
+
class MlModelGroupUrn(_SpecificUrn):
|
|
983
|
+
ENTITY_TYPE: ClassVar[Literal["mlModelGroup"]] = "mlModelGroup"
|
|
984
|
+
_URN_PARTS: ClassVar[int] = 3
|
|
1068
985
|
|
|
1069
|
-
def __init__(self,
|
|
986
|
+
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
1070
987
|
if _allow_coercion:
|
|
1071
988
|
# Field coercion logic (if any is required).
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
id = DataContractUrn.from_string(id)
|
|
1076
|
-
except InvalidUrnError:
|
|
1077
|
-
raise InvalidUrnError(f'Expecting a DataContractUrn but got {id}')
|
|
1078
|
-
else:
|
|
1079
|
-
id = UrnEncoder.encode_string(id)
|
|
989
|
+
platform = DataPlatformUrn(platform).urn()
|
|
990
|
+
name = UrnEncoder.encode_string(name)
|
|
991
|
+
env = env.upper()
|
|
1080
992
|
|
|
1081
993
|
# Validation logic.
|
|
1082
|
-
if not
|
|
1083
|
-
raise InvalidUrnError("
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
raise InvalidUrnError(
|
|
1088
|
-
if UrnEncoder.contains_reserved_char(
|
|
1089
|
-
raise InvalidUrnError(f'
|
|
994
|
+
if not platform:
|
|
995
|
+
raise InvalidUrnError("MlModelGroupUrn platform cannot be empty")
|
|
996
|
+
platform = str(platform) # convert urn type to str
|
|
997
|
+
assert DataPlatformUrn.from_string(platform)
|
|
998
|
+
if not name:
|
|
999
|
+
raise InvalidUrnError("MlModelGroupUrn name cannot be empty")
|
|
1000
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1001
|
+
raise InvalidUrnError(f'MlModelGroupUrn name contains reserved characters')
|
|
1002
|
+
if not env:
|
|
1003
|
+
raise InvalidUrnError("MlModelGroupUrn env cannot be empty")
|
|
1004
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
1005
|
+
raise InvalidUrnError(f'MlModelGroupUrn env contains reserved characters')
|
|
1090
1006
|
|
|
1091
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1007
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
1092
1008
|
|
|
1093
1009
|
@classmethod
|
|
1094
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1010
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelGroupUrn":
|
|
1095
1011
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1096
|
-
raise InvalidUrnError(f"
|
|
1097
|
-
return cls(
|
|
1098
|
-
|
|
1099
|
-
@classmethod
|
|
1100
|
-
def underlying_key_aspect_type(cls) -> Type["DataContractKeyClass"]:
|
|
1101
|
-
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
1102
|
-
|
|
1103
|
-
return DataContractKeyClass
|
|
1104
|
-
|
|
1105
|
-
def to_key_aspect(self) -> "DataContractKeyClass":
|
|
1106
|
-
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
1107
|
-
|
|
1108
|
-
return DataContractKeyClass(id=self.id)
|
|
1012
|
+
raise InvalidUrnError(f"MlModelGroupUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1013
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1109
1014
|
|
|
1110
1015
|
@classmethod
|
|
1111
|
-
def
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
@property
|
|
1115
|
-
def id(self) -> str:
|
|
1116
|
-
return self.entity_ids[0]
|
|
1117
|
-
|
|
1118
|
-
if TYPE_CHECKING:
|
|
1119
|
-
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
1120
|
-
|
|
1121
|
-
class AssertionUrn(_SpecificUrn):
|
|
1122
|
-
ENTITY_TYPE: ClassVar[str] = "assertion"
|
|
1123
|
-
_URN_PARTS: ClassVar[int] = 1
|
|
1124
|
-
|
|
1125
|
-
def __init__(self, assertion_id: Union["AssertionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1126
|
-
if _allow_coercion:
|
|
1127
|
-
# Field coercion logic (if any is required).
|
|
1128
|
-
if isinstance(assertion_id, str):
|
|
1129
|
-
if assertion_id.startswith('urn:li:'):
|
|
1130
|
-
try:
|
|
1131
|
-
assertion_id = AssertionUrn.from_string(assertion_id)
|
|
1132
|
-
except InvalidUrnError:
|
|
1133
|
-
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
1134
|
-
else:
|
|
1135
|
-
assertion_id = UrnEncoder.encode_string(assertion_id)
|
|
1016
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelGroupKeyClass"]:
|
|
1017
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
1136
1018
|
|
|
1137
|
-
|
|
1138
|
-
if not assertion_id:
|
|
1139
|
-
raise InvalidUrnError("AssertionUrn assertion_id cannot be empty")
|
|
1140
|
-
if isinstance(assertion_id, AssertionUrn):
|
|
1141
|
-
assertion_id = assertion_id.assertion_id
|
|
1142
|
-
elif isinstance(assertion_id, Urn):
|
|
1143
|
-
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
1144
|
-
if UrnEncoder.contains_reserved_char(assertion_id):
|
|
1145
|
-
raise InvalidUrnError(f'AssertionUrn assertion_id contains reserved characters')
|
|
1019
|
+
return MLModelGroupKeyClass
|
|
1146
1020
|
|
|
1147
|
-
|
|
1021
|
+
def to_key_aspect(self) -> "MLModelGroupKeyClass":
|
|
1022
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
1148
1023
|
|
|
1149
|
-
|
|
1150
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "AssertionUrn":
|
|
1151
|
-
if len(entity_ids) != cls._URN_PARTS:
|
|
1152
|
-
raise InvalidUrnError(f"AssertionUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1153
|
-
return cls(assertion_id=entity_ids[0], _allow_coercion=False)
|
|
1024
|
+
return MLModelGroupKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
1154
1025
|
|
|
1155
1026
|
@classmethod
|
|
1156
|
-
def
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
return AssertionKeyClass
|
|
1160
|
-
|
|
1161
|
-
def to_key_aspect(self) -> "AssertionKeyClass":
|
|
1162
|
-
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
1027
|
+
def from_key_aspect(cls, key_aspect: "MLModelGroupKeyClass") -> "MlModelGroupUrn":
|
|
1028
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
1163
1029
|
|
|
1164
|
-
|
|
1030
|
+
@property
|
|
1031
|
+
def platform(self) -> str:
|
|
1032
|
+
return self._entity_ids[0]
|
|
1165
1033
|
|
|
1166
|
-
@
|
|
1167
|
-
def
|
|
1168
|
-
return
|
|
1034
|
+
@property
|
|
1035
|
+
def name(self) -> str:
|
|
1036
|
+
return self._entity_ids[1]
|
|
1169
1037
|
|
|
1170
1038
|
@property
|
|
1171
|
-
def
|
|
1172
|
-
return self.
|
|
1039
|
+
def env(self) -> str:
|
|
1040
|
+
return self._entity_ids[2]
|
|
1173
1041
|
|
|
1174
1042
|
if TYPE_CHECKING:
|
|
1175
|
-
from datahub.metadata.schema_classes import
|
|
1043
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1176
1044
|
|
|
1177
|
-
class
|
|
1178
|
-
ENTITY_TYPE: ClassVar[
|
|
1045
|
+
class MlModelDeploymentUrn(_SpecificUrn):
|
|
1046
|
+
ENTITY_TYPE: ClassVar[Literal["mlModelDeployment"]] = "mlModelDeployment"
|
|
1179
1047
|
_URN_PARTS: ClassVar[int] = 3
|
|
1180
1048
|
|
|
1181
1049
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
@@ -1187,87 +1055,147 @@ class DatasetUrn(_SpecificUrn):
|
|
|
1187
1055
|
|
|
1188
1056
|
# Validation logic.
|
|
1189
1057
|
if not platform:
|
|
1190
|
-
raise InvalidUrnError("
|
|
1058
|
+
raise InvalidUrnError("MlModelDeploymentUrn platform cannot be empty")
|
|
1191
1059
|
platform = str(platform) # convert urn type to str
|
|
1192
1060
|
assert DataPlatformUrn.from_string(platform)
|
|
1193
1061
|
if not name:
|
|
1194
|
-
raise InvalidUrnError("
|
|
1062
|
+
raise InvalidUrnError("MlModelDeploymentUrn name cannot be empty")
|
|
1195
1063
|
if UrnEncoder.contains_reserved_char(name):
|
|
1196
|
-
raise InvalidUrnError(f'
|
|
1064
|
+
raise InvalidUrnError(f'MlModelDeploymentUrn name contains reserved characters')
|
|
1197
1065
|
if not env:
|
|
1198
|
-
raise InvalidUrnError("
|
|
1066
|
+
raise InvalidUrnError("MlModelDeploymentUrn env cannot be empty")
|
|
1199
1067
|
if UrnEncoder.contains_reserved_char(env):
|
|
1200
|
-
raise InvalidUrnError(f'
|
|
1068
|
+
raise InvalidUrnError(f'MlModelDeploymentUrn env contains reserved characters')
|
|
1201
1069
|
|
|
1202
1070
|
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
1203
1071
|
|
|
1204
1072
|
@classmethod
|
|
1205
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1073
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelDeploymentUrn":
|
|
1206
1074
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1207
|
-
raise InvalidUrnError(f"
|
|
1075
|
+
raise InvalidUrnError(f"MlModelDeploymentUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1208
1076
|
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1209
1077
|
|
|
1210
1078
|
@classmethod
|
|
1211
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1212
|
-
from datahub.metadata.schema_classes import
|
|
1079
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelDeploymentKeyClass"]:
|
|
1080
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1213
1081
|
|
|
1214
|
-
return
|
|
1082
|
+
return MLModelDeploymentKeyClass
|
|
1215
1083
|
|
|
1216
|
-
def to_key_aspect(self) -> "
|
|
1217
|
-
from datahub.metadata.schema_classes import
|
|
1084
|
+
def to_key_aspect(self) -> "MLModelDeploymentKeyClass":
|
|
1085
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1218
1086
|
|
|
1219
|
-
return
|
|
1087
|
+
return MLModelDeploymentKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
1220
1088
|
|
|
1221
1089
|
@classmethod
|
|
1222
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1090
|
+
def from_key_aspect(cls, key_aspect: "MLModelDeploymentKeyClass") -> "MlModelDeploymentUrn":
|
|
1223
1091
|
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
1224
1092
|
|
|
1093
|
+
@property
|
|
1094
|
+
def platform(self) -> str:
|
|
1095
|
+
return self._entity_ids[0]
|
|
1096
|
+
|
|
1097
|
+
@property
|
|
1098
|
+
def name(self) -> str:
|
|
1099
|
+
return self._entity_ids[1]
|
|
1100
|
+
|
|
1101
|
+
@property
|
|
1102
|
+
def env(self) -> str:
|
|
1103
|
+
return self._entity_ids[2]
|
|
1104
|
+
|
|
1105
|
+
if TYPE_CHECKING:
|
|
1106
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
1107
|
+
|
|
1108
|
+
class DataFlowUrn(_SpecificUrn):
|
|
1109
|
+
ENTITY_TYPE: ClassVar[Literal["dataFlow"]] = "dataFlow"
|
|
1110
|
+
_URN_PARTS: ClassVar[int] = 3
|
|
1111
|
+
|
|
1112
|
+
def __init__(self, orchestrator: str, flow_id: str, cluster: str, *, _allow_coercion: bool = True) -> None:
|
|
1113
|
+
if _allow_coercion:
|
|
1114
|
+
# Field coercion logic (if any is required).
|
|
1115
|
+
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
1116
|
+
flow_id = UrnEncoder.encode_string(flow_id)
|
|
1117
|
+
cluster = UrnEncoder.encode_string(cluster)
|
|
1118
|
+
|
|
1119
|
+
# Validation logic.
|
|
1120
|
+
if not orchestrator:
|
|
1121
|
+
raise InvalidUrnError("DataFlowUrn orchestrator cannot be empty")
|
|
1122
|
+
if UrnEncoder.contains_reserved_char(orchestrator):
|
|
1123
|
+
raise InvalidUrnError(f'DataFlowUrn orchestrator contains reserved characters')
|
|
1124
|
+
if not flow_id:
|
|
1125
|
+
raise InvalidUrnError("DataFlowUrn flow_id cannot be empty")
|
|
1126
|
+
if UrnEncoder.contains_reserved_char(flow_id):
|
|
1127
|
+
raise InvalidUrnError(f'DataFlowUrn flow_id contains reserved characters')
|
|
1128
|
+
if not cluster:
|
|
1129
|
+
raise InvalidUrnError("DataFlowUrn cluster cannot be empty")
|
|
1130
|
+
if UrnEncoder.contains_reserved_char(cluster):
|
|
1131
|
+
raise InvalidUrnError(f'DataFlowUrn cluster contains reserved characters')
|
|
1132
|
+
|
|
1133
|
+
super().__init__(self.ENTITY_TYPE, [orchestrator, flow_id, cluster])
|
|
1134
|
+
|
|
1135
|
+
@classmethod
|
|
1136
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataFlowUrn":
|
|
1137
|
+
if len(entity_ids) != cls._URN_PARTS:
|
|
1138
|
+
raise InvalidUrnError(f"DataFlowUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1139
|
+
return cls(orchestrator=entity_ids[0], flow_id=entity_ids[1], cluster=entity_ids[2], _allow_coercion=False)
|
|
1140
|
+
|
|
1141
|
+
@classmethod
|
|
1142
|
+
def underlying_key_aspect_type(cls) -> Type["DataFlowKeyClass"]:
|
|
1143
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
1144
|
+
|
|
1145
|
+
return DataFlowKeyClass
|
|
1146
|
+
|
|
1147
|
+
def to_key_aspect(self) -> "DataFlowKeyClass":
|
|
1148
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
1149
|
+
|
|
1150
|
+
return DataFlowKeyClass(orchestrator=self.orchestrator, flowId=self.flow_id, cluster=self.cluster)
|
|
1151
|
+
|
|
1152
|
+
@classmethod
|
|
1153
|
+
def from_key_aspect(cls, key_aspect: "DataFlowKeyClass") -> "DataFlowUrn":
|
|
1154
|
+
return cls(orchestrator=key_aspect.orchestrator, flow_id=key_aspect.flowId, cluster=key_aspect.cluster)
|
|
1155
|
+
|
|
1225
1156
|
@classmethod
|
|
1226
1157
|
def create_from_ids(
|
|
1227
1158
|
cls,
|
|
1228
|
-
|
|
1229
|
-
|
|
1159
|
+
orchestrator: str,
|
|
1160
|
+
flow_id: str,
|
|
1230
1161
|
env: str,
|
|
1231
1162
|
platform_instance: Optional[str] = None,
|
|
1232
|
-
) -> "
|
|
1233
|
-
return
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1163
|
+
) -> "DataFlowUrn":
|
|
1164
|
+
return cls(
|
|
1165
|
+
orchestrator=orchestrator,
|
|
1166
|
+
flow_id=f"{platform_instance}.{flow_id}" if platform_instance else flow_id,
|
|
1167
|
+
cluster=env,
|
|
1237
1168
|
)
|
|
1238
1169
|
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
def get_data_platform_urn(self) -> "DataPlatformUrn":
|
|
1244
|
-
return DataPlatformUrn.from_string(self.platform)
|
|
1170
|
+
@deprecated(reason="Use .orchestrator instead")
|
|
1171
|
+
def get_orchestrator_name(self) -> str:
|
|
1172
|
+
return self.orchestrator
|
|
1245
1173
|
|
|
1246
|
-
@deprecated(reason="Use .
|
|
1247
|
-
def
|
|
1248
|
-
return self.
|
|
1174
|
+
@deprecated(reason="Use .flow_id instead")
|
|
1175
|
+
def get_flow_id(self) -> str:
|
|
1176
|
+
return self.flow_id
|
|
1249
1177
|
|
|
1250
|
-
@deprecated(reason="Use .
|
|
1178
|
+
@deprecated(reason="Use .cluster instead")
|
|
1251
1179
|
def get_env(self) -> str:
|
|
1252
|
-
return self.
|
|
1180
|
+
return self.cluster
|
|
1253
1181
|
|
|
1254
1182
|
@property
|
|
1255
|
-
def
|
|
1256
|
-
return self.
|
|
1183
|
+
def orchestrator(self) -> str:
|
|
1184
|
+
return self._entity_ids[0]
|
|
1257
1185
|
|
|
1258
1186
|
@property
|
|
1259
|
-
def
|
|
1260
|
-
return self.
|
|
1187
|
+
def flow_id(self) -> str:
|
|
1188
|
+
return self._entity_ids[1]
|
|
1261
1189
|
|
|
1262
1190
|
@property
|
|
1263
|
-
def
|
|
1264
|
-
return self.
|
|
1191
|
+
def cluster(self) -> str:
|
|
1192
|
+
return self._entity_ids[2]
|
|
1265
1193
|
|
|
1266
1194
|
if TYPE_CHECKING:
|
|
1267
1195
|
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
1268
1196
|
|
|
1269
1197
|
class DataJobUrn(_SpecificUrn):
|
|
1270
|
-
ENTITY_TYPE: ClassVar[
|
|
1198
|
+
ENTITY_TYPE: ClassVar[Literal["dataJob"]] = "dataJob"
|
|
1271
1199
|
_URN_PARTS: ClassVar[int] = 2
|
|
1272
1200
|
|
|
1273
1201
|
def __init__(self, flow: Union["DataFlowUrn", str], job_id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1329,354 +1257,493 @@ class DataJobUrn(_SpecificUrn):
|
|
|
1329
1257
|
|
|
1330
1258
|
@property
|
|
1331
1259
|
def flow(self) -> str:
|
|
1332
|
-
return self.
|
|
1260
|
+
return self._entity_ids[0]
|
|
1333
1261
|
|
|
1334
1262
|
@property
|
|
1335
1263
|
def job_id(self) -> str:
|
|
1336
|
-
return self.
|
|
1264
|
+
return self._entity_ids[1]
|
|
1337
1265
|
|
|
1338
1266
|
if TYPE_CHECKING:
|
|
1339
|
-
from datahub.metadata.schema_classes import
|
|
1267
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
1340
1268
|
|
|
1341
|
-
class
|
|
1342
|
-
ENTITY_TYPE: ClassVar[
|
|
1269
|
+
class CorpGroupUrn(_SpecificUrn):
|
|
1270
|
+
ENTITY_TYPE: ClassVar[Literal["corpGroup"]] = "corpGroup"
|
|
1343
1271
|
_URN_PARTS: ClassVar[int] = 1
|
|
1344
1272
|
|
|
1345
|
-
def __init__(self,
|
|
1273
|
+
def __init__(self, name: Union["CorpGroupUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1346
1274
|
if _allow_coercion:
|
|
1347
1275
|
# Field coercion logic (if any is required).
|
|
1348
|
-
if isinstance(
|
|
1349
|
-
if
|
|
1276
|
+
if isinstance(name, str):
|
|
1277
|
+
if name.startswith('urn:li:'):
|
|
1350
1278
|
try:
|
|
1351
|
-
|
|
1279
|
+
name = CorpGroupUrn.from_string(name)
|
|
1352
1280
|
except InvalidUrnError:
|
|
1353
|
-
raise InvalidUrnError(f'Expecting a
|
|
1281
|
+
raise InvalidUrnError(f'Expecting a CorpGroupUrn but got {name}')
|
|
1354
1282
|
else:
|
|
1355
|
-
|
|
1283
|
+
name = UrnEncoder.encode_string(name)
|
|
1356
1284
|
|
|
1357
1285
|
# Validation logic.
|
|
1358
|
-
if not
|
|
1359
|
-
raise InvalidUrnError("
|
|
1360
|
-
if isinstance(
|
|
1361
|
-
|
|
1362
|
-
elif isinstance(
|
|
1363
|
-
raise InvalidUrnError(f'Expecting a
|
|
1364
|
-
if UrnEncoder.contains_reserved_char(
|
|
1365
|
-
raise InvalidUrnError(f'
|
|
1286
|
+
if not name:
|
|
1287
|
+
raise InvalidUrnError("CorpGroupUrn name cannot be empty")
|
|
1288
|
+
if isinstance(name, CorpGroupUrn):
|
|
1289
|
+
name = name.name
|
|
1290
|
+
elif isinstance(name, Urn):
|
|
1291
|
+
raise InvalidUrnError(f'Expecting a CorpGroupUrn but got {name}')
|
|
1292
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1293
|
+
raise InvalidUrnError(f'CorpGroupUrn name contains reserved characters')
|
|
1366
1294
|
|
|
1367
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1295
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
1368
1296
|
|
|
1369
1297
|
@classmethod
|
|
1370
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1298
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "CorpGroupUrn":
|
|
1371
1299
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1372
|
-
raise InvalidUrnError(f"
|
|
1373
|
-
return cls(
|
|
1300
|
+
raise InvalidUrnError(f"CorpGroupUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1301
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
1374
1302
|
|
|
1375
1303
|
@classmethod
|
|
1376
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1377
|
-
from datahub.metadata.schema_classes import
|
|
1304
|
+
def underlying_key_aspect_type(cls) -> Type["CorpGroupKeyClass"]:
|
|
1305
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
1378
1306
|
|
|
1379
|
-
return
|
|
1307
|
+
return CorpGroupKeyClass
|
|
1380
1308
|
|
|
1381
|
-
def to_key_aspect(self) -> "
|
|
1382
|
-
from datahub.metadata.schema_classes import
|
|
1309
|
+
def to_key_aspect(self) -> "CorpGroupKeyClass":
|
|
1310
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
1383
1311
|
|
|
1384
|
-
return
|
|
1312
|
+
return CorpGroupKeyClass(name=self.name)
|
|
1385
1313
|
|
|
1386
1314
|
@classmethod
|
|
1387
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1388
|
-
return cls(
|
|
1315
|
+
def from_key_aspect(cls, key_aspect: "CorpGroupKeyClass") -> "CorpGroupUrn":
|
|
1316
|
+
return cls(name=key_aspect.name)
|
|
1317
|
+
|
|
1318
|
+
@classmethod
|
|
1319
|
+
@deprecated(reason="Use the constructor instead")
|
|
1320
|
+
def create_from_id(cls, id: str) -> "CorpGroupUrn":
|
|
1321
|
+
return cls(id)
|
|
1322
|
+
|
|
1323
|
+
@property
|
|
1324
|
+
def name(self) -> str:
|
|
1325
|
+
return self._entity_ids[0]
|
|
1326
|
+
|
|
1327
|
+
if TYPE_CHECKING:
|
|
1328
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
1329
|
+
|
|
1330
|
+
class DataPlatformUrn(_SpecificUrn):
|
|
1331
|
+
ENTITY_TYPE: ClassVar[Literal["dataPlatform"]] = "dataPlatform"
|
|
1332
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1333
|
+
|
|
1334
|
+
def __init__(self, platform_name: Union["DataPlatformUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1335
|
+
if _allow_coercion:
|
|
1336
|
+
# Field coercion logic (if any is required).
|
|
1337
|
+
if isinstance(platform_name, str):
|
|
1338
|
+
if platform_name.startswith('urn:li:'):
|
|
1339
|
+
try:
|
|
1340
|
+
platform_name = DataPlatformUrn.from_string(platform_name)
|
|
1341
|
+
except InvalidUrnError:
|
|
1342
|
+
raise InvalidUrnError(f'Expecting a DataPlatformUrn but got {platform_name}')
|
|
1343
|
+
else:
|
|
1344
|
+
platform_name = UrnEncoder.encode_string(platform_name)
|
|
1345
|
+
|
|
1346
|
+
# Validation logic.
|
|
1347
|
+
if not platform_name:
|
|
1348
|
+
raise InvalidUrnError("DataPlatformUrn platform_name cannot be empty")
|
|
1349
|
+
if isinstance(platform_name, DataPlatformUrn):
|
|
1350
|
+
platform_name = platform_name.platform_name
|
|
1351
|
+
elif isinstance(platform_name, Urn):
|
|
1352
|
+
raise InvalidUrnError(f'Expecting a DataPlatformUrn but got {platform_name}')
|
|
1353
|
+
if UrnEncoder.contains_reserved_char(platform_name):
|
|
1354
|
+
raise InvalidUrnError(f'DataPlatformUrn platform_name contains reserved characters')
|
|
1355
|
+
|
|
1356
|
+
super().__init__(self.ENTITY_TYPE, [platform_name])
|
|
1357
|
+
|
|
1358
|
+
@classmethod
|
|
1359
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataPlatformUrn":
|
|
1360
|
+
if len(entity_ids) != cls._URN_PARTS:
|
|
1361
|
+
raise InvalidUrnError(f"DataPlatformUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1362
|
+
return cls(platform_name=entity_ids[0], _allow_coercion=False)
|
|
1363
|
+
|
|
1364
|
+
@classmethod
|
|
1365
|
+
def underlying_key_aspect_type(cls) -> Type["DataPlatformKeyClass"]:
|
|
1366
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
1367
|
+
|
|
1368
|
+
return DataPlatformKeyClass
|
|
1369
|
+
|
|
1370
|
+
def to_key_aspect(self) -> "DataPlatformKeyClass":
|
|
1371
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
1372
|
+
|
|
1373
|
+
return DataPlatformKeyClass(platformName=self.platform_name)
|
|
1374
|
+
|
|
1375
|
+
@classmethod
|
|
1376
|
+
def from_key_aspect(cls, key_aspect: "DataPlatformKeyClass") -> "DataPlatformUrn":
|
|
1377
|
+
return cls(platform_name=key_aspect.platformName)
|
|
1378
|
+
|
|
1379
|
+
@classmethod
|
|
1380
|
+
@deprecated(reason="Use the constructor instead")
|
|
1381
|
+
def create_from_id(cls, id: str) -> "DataPlatformUrn":
|
|
1382
|
+
return cls(id)
|
|
1389
1383
|
|
|
1390
1384
|
@property
|
|
1391
|
-
def
|
|
1392
|
-
return self.
|
|
1385
|
+
def platform_name(self) -> str:
|
|
1386
|
+
return self._entity_ids[0]
|
|
1393
1387
|
|
|
1394
1388
|
if TYPE_CHECKING:
|
|
1395
|
-
from datahub.metadata.schema_classes import
|
|
1389
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
1396
1390
|
|
|
1397
|
-
class
|
|
1398
|
-
ENTITY_TYPE: ClassVar[
|
|
1391
|
+
class CorpUserUrn(_SpecificUrn):
|
|
1392
|
+
ENTITY_TYPE: ClassVar[Literal["corpuser"]] = "corpuser"
|
|
1399
1393
|
_URN_PARTS: ClassVar[int] = 1
|
|
1400
1394
|
|
|
1401
|
-
def __init__(self,
|
|
1395
|
+
def __init__(self, username: Union["CorpUserUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1402
1396
|
if _allow_coercion:
|
|
1403
1397
|
# Field coercion logic (if any is required).
|
|
1404
|
-
if isinstance(
|
|
1405
|
-
if
|
|
1398
|
+
if isinstance(username, str):
|
|
1399
|
+
if username.startswith('urn:li:'):
|
|
1406
1400
|
try:
|
|
1407
|
-
|
|
1401
|
+
username = CorpUserUrn.from_string(username)
|
|
1408
1402
|
except InvalidUrnError:
|
|
1409
|
-
raise InvalidUrnError(f'Expecting a
|
|
1403
|
+
raise InvalidUrnError(f'Expecting a CorpUserUrn but got {username}')
|
|
1410
1404
|
else:
|
|
1411
|
-
|
|
1405
|
+
username = UrnEncoder.encode_string(username)
|
|
1412
1406
|
|
|
1413
1407
|
# Validation logic.
|
|
1414
|
-
if not
|
|
1415
|
-
raise InvalidUrnError("
|
|
1416
|
-
if isinstance(
|
|
1417
|
-
|
|
1418
|
-
elif isinstance(
|
|
1419
|
-
raise InvalidUrnError(f'Expecting a
|
|
1420
|
-
if UrnEncoder.contains_reserved_char(
|
|
1421
|
-
raise InvalidUrnError(f'
|
|
1408
|
+
if not username:
|
|
1409
|
+
raise InvalidUrnError("CorpUserUrn username cannot be empty")
|
|
1410
|
+
if isinstance(username, CorpUserUrn):
|
|
1411
|
+
username = username.username
|
|
1412
|
+
elif isinstance(username, Urn):
|
|
1413
|
+
raise InvalidUrnError(f'Expecting a CorpUserUrn but got {username}')
|
|
1414
|
+
if UrnEncoder.contains_reserved_char(username):
|
|
1415
|
+
raise InvalidUrnError(f'CorpUserUrn username contains reserved characters')
|
|
1422
1416
|
|
|
1423
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1417
|
+
super().__init__(self.ENTITY_TYPE, [username])
|
|
1424
1418
|
|
|
1425
1419
|
@classmethod
|
|
1426
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1420
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "CorpUserUrn":
|
|
1427
1421
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1428
|
-
raise InvalidUrnError(f"
|
|
1429
|
-
return cls(
|
|
1422
|
+
raise InvalidUrnError(f"CorpUserUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1423
|
+
return cls(username=entity_ids[0], _allow_coercion=False)
|
|
1430
1424
|
|
|
1431
1425
|
@classmethod
|
|
1432
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1433
|
-
from datahub.metadata.schema_classes import
|
|
1426
|
+
def underlying_key_aspect_type(cls) -> Type["CorpUserKeyClass"]:
|
|
1427
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
1434
1428
|
|
|
1435
|
-
return
|
|
1429
|
+
return CorpUserKeyClass
|
|
1436
1430
|
|
|
1437
|
-
def to_key_aspect(self) -> "
|
|
1438
|
-
from datahub.metadata.schema_classes import
|
|
1431
|
+
def to_key_aspect(self) -> "CorpUserKeyClass":
|
|
1432
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
1439
1433
|
|
|
1440
|
-
return
|
|
1434
|
+
return CorpUserKeyClass(username=self.username)
|
|
1441
1435
|
|
|
1442
1436
|
@classmethod
|
|
1443
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1444
|
-
return cls(
|
|
1437
|
+
def from_key_aspect(cls, key_aspect: "CorpUserKeyClass") -> "CorpUserUrn":
|
|
1438
|
+
return cls(username=key_aspect.username)
|
|
1439
|
+
|
|
1440
|
+
@classmethod
|
|
1441
|
+
@deprecated(reason="Use the constructor instead")
|
|
1442
|
+
def create_from_id(cls, id: str) -> "CorpUserUrn":
|
|
1443
|
+
return cls(id)
|
|
1445
1444
|
|
|
1446
1445
|
@property
|
|
1447
|
-
def
|
|
1448
|
-
return self.
|
|
1446
|
+
def username(self) -> str:
|
|
1447
|
+
return self._entity_ids[0]
|
|
1449
1448
|
|
|
1450
1449
|
if TYPE_CHECKING:
|
|
1451
|
-
from datahub.metadata.schema_classes import
|
|
1450
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
1452
1451
|
|
|
1453
|
-
class
|
|
1454
|
-
ENTITY_TYPE: ClassVar[
|
|
1452
|
+
class DashboardUrn(_SpecificUrn):
|
|
1453
|
+
ENTITY_TYPE: ClassVar[Literal["dashboard"]] = "dashboard"
|
|
1455
1454
|
_URN_PARTS: ClassVar[int] = 2
|
|
1456
1455
|
|
|
1457
|
-
def __init__(self,
|
|
1456
|
+
def __init__(self, dashboard_tool: str, dashboard_id: str, *, _allow_coercion: bool = True) -> None:
|
|
1458
1457
|
if _allow_coercion:
|
|
1459
1458
|
# Field coercion logic (if any is required).
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
try:
|
|
1463
|
-
parent = Urn.from_string(parent)
|
|
1464
|
-
except InvalidUrnError:
|
|
1465
|
-
raise InvalidUrnError(f'Expecting a Urn but got {parent}')
|
|
1466
|
-
else:
|
|
1467
|
-
parent = UrnEncoder.encode_string(parent)
|
|
1468
|
-
field_path = UrnEncoder.encode_string(field_path)
|
|
1459
|
+
dashboard_tool = UrnEncoder.encode_string(dashboard_tool)
|
|
1460
|
+
dashboard_id = UrnEncoder.encode_string(dashboard_id)
|
|
1469
1461
|
|
|
1470
1462
|
# Validation logic.
|
|
1471
|
-
if not
|
|
1472
|
-
raise InvalidUrnError("
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
if not
|
|
1476
|
-
raise InvalidUrnError("
|
|
1477
|
-
if UrnEncoder.contains_reserved_char(
|
|
1478
|
-
raise InvalidUrnError(f'
|
|
1463
|
+
if not dashboard_tool:
|
|
1464
|
+
raise InvalidUrnError("DashboardUrn dashboard_tool cannot be empty")
|
|
1465
|
+
if UrnEncoder.contains_reserved_char(dashboard_tool):
|
|
1466
|
+
raise InvalidUrnError(f'DashboardUrn dashboard_tool contains reserved characters')
|
|
1467
|
+
if not dashboard_id:
|
|
1468
|
+
raise InvalidUrnError("DashboardUrn dashboard_id cannot be empty")
|
|
1469
|
+
if UrnEncoder.contains_reserved_char(dashboard_id):
|
|
1470
|
+
raise InvalidUrnError(f'DashboardUrn dashboard_id contains reserved characters')
|
|
1479
1471
|
|
|
1480
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1472
|
+
super().__init__(self.ENTITY_TYPE, [dashboard_tool, dashboard_id])
|
|
1481
1473
|
|
|
1482
1474
|
@classmethod
|
|
1483
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1475
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DashboardUrn":
|
|
1484
1476
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1485
|
-
raise InvalidUrnError(f"
|
|
1486
|
-
return cls(
|
|
1477
|
+
raise InvalidUrnError(f"DashboardUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1478
|
+
return cls(dashboard_tool=entity_ids[0], dashboard_id=entity_ids[1], _allow_coercion=False)
|
|
1487
1479
|
|
|
1488
1480
|
@classmethod
|
|
1489
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1490
|
-
from datahub.metadata.schema_classes import
|
|
1481
|
+
def underlying_key_aspect_type(cls) -> Type["DashboardKeyClass"]:
|
|
1482
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
1491
1483
|
|
|
1492
|
-
return
|
|
1484
|
+
return DashboardKeyClass
|
|
1493
1485
|
|
|
1494
|
-
def to_key_aspect(self) -> "
|
|
1495
|
-
from datahub.metadata.schema_classes import
|
|
1486
|
+
def to_key_aspect(self) -> "DashboardKeyClass":
|
|
1487
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
1496
1488
|
|
|
1497
|
-
return
|
|
1489
|
+
return DashboardKeyClass(dashboardTool=self.dashboard_tool, dashboardId=self.dashboard_id)
|
|
1498
1490
|
|
|
1499
1491
|
@classmethod
|
|
1500
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1501
|
-
return cls(
|
|
1492
|
+
def from_key_aspect(cls, key_aspect: "DashboardKeyClass") -> "DashboardUrn":
|
|
1493
|
+
return cls(dashboard_tool=key_aspect.dashboardTool, dashboard_id=key_aspect.dashboardId)
|
|
1502
1494
|
|
|
1495
|
+
@classmethod
|
|
1496
|
+
def create_from_ids(
|
|
1497
|
+
cls,
|
|
1498
|
+
platform: str,
|
|
1499
|
+
name: str,
|
|
1500
|
+
platform_instance: Optional[str] = None,
|
|
1501
|
+
) -> "DashboardUrn":
|
|
1502
|
+
return DashboardUrn(
|
|
1503
|
+
dashboard_tool=platform,
|
|
1504
|
+
dashboard_id=f"{platform_instance}.{name}" if platform_instance else name,
|
|
1505
|
+
)
|
|
1506
|
+
|
|
1503
1507
|
@property
|
|
1504
|
-
def
|
|
1505
|
-
return self.
|
|
1508
|
+
def dashboard_tool(self) -> str:
|
|
1509
|
+
return self._entity_ids[0]
|
|
1506
1510
|
|
|
1507
1511
|
@property
|
|
1508
|
-
def
|
|
1509
|
-
return self.
|
|
1512
|
+
def dashboard_id(self) -> str:
|
|
1513
|
+
return self._entity_ids[1]
|
|
1510
1514
|
|
|
1511
1515
|
if TYPE_CHECKING:
|
|
1512
|
-
from datahub.metadata.schema_classes import
|
|
1516
|
+
from datahub.metadata.schema_classes import MLPrimaryKeyKeyClass
|
|
1513
1517
|
|
|
1514
|
-
class
|
|
1515
|
-
ENTITY_TYPE: ClassVar[
|
|
1518
|
+
class MlPrimaryKeyUrn(_SpecificUrn):
|
|
1519
|
+
ENTITY_TYPE: ClassVar[Literal["mlPrimaryKey"]] = "mlPrimaryKey"
|
|
1516
1520
|
_URN_PARTS: ClassVar[int] = 2
|
|
1517
1521
|
|
|
1518
|
-
def __init__(self,
|
|
1522
|
+
def __init__(self, feature_namespace: str, name: str, *, _allow_coercion: bool = True) -> None:
|
|
1519
1523
|
if _allow_coercion:
|
|
1520
1524
|
# Field coercion logic (if any is required).
|
|
1521
|
-
|
|
1525
|
+
feature_namespace = UrnEncoder.encode_string(feature_namespace)
|
|
1522
1526
|
name = UrnEncoder.encode_string(name)
|
|
1523
1527
|
|
|
1524
1528
|
# Validation logic.
|
|
1525
|
-
if not
|
|
1526
|
-
raise InvalidUrnError("
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
+
if not feature_namespace:
|
|
1530
|
+
raise InvalidUrnError("MlPrimaryKeyUrn feature_namespace cannot be empty")
|
|
1531
|
+
if UrnEncoder.contains_reserved_char(feature_namespace):
|
|
1532
|
+
raise InvalidUrnError(f'MlPrimaryKeyUrn feature_namespace contains reserved characters')
|
|
1529
1533
|
if not name:
|
|
1530
|
-
raise InvalidUrnError("
|
|
1534
|
+
raise InvalidUrnError("MlPrimaryKeyUrn name cannot be empty")
|
|
1531
1535
|
if UrnEncoder.contains_reserved_char(name):
|
|
1532
|
-
raise InvalidUrnError(f'
|
|
1536
|
+
raise InvalidUrnError(f'MlPrimaryKeyUrn name contains reserved characters')
|
|
1533
1537
|
|
|
1534
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1538
|
+
super().__init__(self.ENTITY_TYPE, [feature_namespace, name])
|
|
1535
1539
|
|
|
1536
1540
|
@classmethod
|
|
1537
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1541
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlPrimaryKeyUrn":
|
|
1538
1542
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1539
|
-
raise InvalidUrnError(f"
|
|
1540
|
-
return cls(
|
|
1543
|
+
raise InvalidUrnError(f"MlPrimaryKeyUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1544
|
+
return cls(feature_namespace=entity_ids[0], name=entity_ids[1], _allow_coercion=False)
|
|
1541
1545
|
|
|
1542
1546
|
@classmethod
|
|
1543
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1544
|
-
from datahub.metadata.schema_classes import
|
|
1547
|
+
def underlying_key_aspect_type(cls) -> Type["MLPrimaryKeyKeyClass"]:
|
|
1548
|
+
from datahub.metadata.schema_classes import MLPrimaryKeyKeyClass
|
|
1545
1549
|
|
|
1546
|
-
return
|
|
1550
|
+
return MLPrimaryKeyKeyClass
|
|
1547
1551
|
|
|
1548
|
-
def to_key_aspect(self) -> "
|
|
1549
|
-
from datahub.metadata.schema_classes import
|
|
1552
|
+
def to_key_aspect(self) -> "MLPrimaryKeyKeyClass":
|
|
1553
|
+
from datahub.metadata.schema_classes import MLPrimaryKeyKeyClass
|
|
1550
1554
|
|
|
1551
|
-
return
|
|
1555
|
+
return MLPrimaryKeyKeyClass(featureNamespace=self.feature_namespace, name=self.name)
|
|
1552
1556
|
|
|
1553
1557
|
@classmethod
|
|
1554
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1555
|
-
return cls(
|
|
1558
|
+
def from_key_aspect(cls, key_aspect: "MLPrimaryKeyKeyClass") -> "MlPrimaryKeyUrn":
|
|
1559
|
+
return cls(feature_namespace=key_aspect.featureNamespace, name=key_aspect.name)
|
|
1556
1560
|
|
|
1557
1561
|
@property
|
|
1558
|
-
def
|
|
1559
|
-
return self.
|
|
1562
|
+
def feature_namespace(self) -> str:
|
|
1563
|
+
return self._entity_ids[0]
|
|
1560
1564
|
|
|
1561
1565
|
@property
|
|
1562
1566
|
def name(self) -> str:
|
|
1563
|
-
return self.
|
|
1567
|
+
return self._entity_ids[1]
|
|
1564
1568
|
|
|
1565
1569
|
if TYPE_CHECKING:
|
|
1566
|
-
from datahub.metadata.schema_classes import
|
|
1570
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1567
1571
|
|
|
1568
|
-
class
|
|
1569
|
-
ENTITY_TYPE: ClassVar[
|
|
1570
|
-
_URN_PARTS: ClassVar[int] =
|
|
1572
|
+
class QueryUrn(_SpecificUrn):
|
|
1573
|
+
ENTITY_TYPE: ClassVar[Literal["query"]] = "query"
|
|
1574
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1571
1575
|
|
|
1572
|
-
def __init__(self,
|
|
1576
|
+
def __init__(self, id: Union["QueryUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1573
1577
|
if _allow_coercion:
|
|
1574
1578
|
# Field coercion logic (if any is required).
|
|
1575
|
-
|
|
1576
|
-
|
|
1579
|
+
if isinstance(id, str):
|
|
1580
|
+
if id.startswith('urn:li:'):
|
|
1581
|
+
try:
|
|
1582
|
+
id = QueryUrn.from_string(id)
|
|
1583
|
+
except InvalidUrnError:
|
|
1584
|
+
raise InvalidUrnError(f'Expecting a QueryUrn but got {id}')
|
|
1585
|
+
else:
|
|
1586
|
+
id = UrnEncoder.encode_string(id)
|
|
1577
1587
|
|
|
1578
1588
|
# Validation logic.
|
|
1579
|
-
if not
|
|
1580
|
-
raise InvalidUrnError("
|
|
1581
|
-
if
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
raise InvalidUrnError(
|
|
1585
|
-
if UrnEncoder.contains_reserved_char(
|
|
1586
|
-
raise InvalidUrnError(f'
|
|
1589
|
+
if not id:
|
|
1590
|
+
raise InvalidUrnError("QueryUrn id cannot be empty")
|
|
1591
|
+
if isinstance(id, QueryUrn):
|
|
1592
|
+
id = id.id
|
|
1593
|
+
elif isinstance(id, Urn):
|
|
1594
|
+
raise InvalidUrnError(f'Expecting a QueryUrn but got {id}')
|
|
1595
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1596
|
+
raise InvalidUrnError(f'QueryUrn id contains reserved characters')
|
|
1597
|
+
|
|
1598
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1599
|
+
|
|
1600
|
+
@classmethod
|
|
1601
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "QueryUrn":
|
|
1602
|
+
if len(entity_ids) != cls._URN_PARTS:
|
|
1603
|
+
raise InvalidUrnError(f"QueryUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1604
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1605
|
+
|
|
1606
|
+
@classmethod
|
|
1607
|
+
def underlying_key_aspect_type(cls) -> Type["QueryKeyClass"]:
|
|
1608
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1609
|
+
|
|
1610
|
+
return QueryKeyClass
|
|
1611
|
+
|
|
1612
|
+
def to_key_aspect(self) -> "QueryKeyClass":
|
|
1613
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1614
|
+
|
|
1615
|
+
return QueryKeyClass(id=self.id)
|
|
1616
|
+
|
|
1617
|
+
@classmethod
|
|
1618
|
+
def from_key_aspect(cls, key_aspect: "QueryKeyClass") -> "QueryUrn":
|
|
1619
|
+
return cls(id=key_aspect.id)
|
|
1620
|
+
|
|
1621
|
+
@property
|
|
1622
|
+
def id(self) -> str:
|
|
1623
|
+
return self._entity_ids[0]
|
|
1624
|
+
|
|
1625
|
+
if TYPE_CHECKING:
|
|
1626
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1627
|
+
|
|
1628
|
+
class OwnershipTypeUrn(_SpecificUrn):
|
|
1629
|
+
ENTITY_TYPE: ClassVar[Literal["ownershipType"]] = "ownershipType"
|
|
1630
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1631
|
+
|
|
1632
|
+
def __init__(self, id: Union["OwnershipTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1633
|
+
if _allow_coercion:
|
|
1634
|
+
# Field coercion logic (if any is required).
|
|
1635
|
+
if isinstance(id, str):
|
|
1636
|
+
if id.startswith('urn:li:'):
|
|
1637
|
+
try:
|
|
1638
|
+
id = OwnershipTypeUrn.from_string(id)
|
|
1639
|
+
except InvalidUrnError:
|
|
1640
|
+
raise InvalidUrnError(f'Expecting a OwnershipTypeUrn but got {id}')
|
|
1641
|
+
else:
|
|
1642
|
+
id = UrnEncoder.encode_string(id)
|
|
1587
1643
|
|
|
1588
|
-
|
|
1644
|
+
# Validation logic.
|
|
1645
|
+
if not id:
|
|
1646
|
+
raise InvalidUrnError("OwnershipTypeUrn id cannot be empty")
|
|
1647
|
+
if isinstance(id, OwnershipTypeUrn):
|
|
1648
|
+
id = id.id
|
|
1649
|
+
elif isinstance(id, Urn):
|
|
1650
|
+
raise InvalidUrnError(f'Expecting a OwnershipTypeUrn but got {id}')
|
|
1651
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1652
|
+
raise InvalidUrnError(f'OwnershipTypeUrn id contains reserved characters')
|
|
1653
|
+
|
|
1654
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1589
1655
|
|
|
1590
1656
|
@classmethod
|
|
1591
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1657
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "OwnershipTypeUrn":
|
|
1592
1658
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1593
|
-
raise InvalidUrnError(f"
|
|
1594
|
-
return cls(
|
|
1659
|
+
raise InvalidUrnError(f"OwnershipTypeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1660
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1595
1661
|
|
|
1596
1662
|
@classmethod
|
|
1597
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1598
|
-
from datahub.metadata.schema_classes import
|
|
1663
|
+
def underlying_key_aspect_type(cls) -> Type["OwnershipTypeKeyClass"]:
|
|
1664
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1599
1665
|
|
|
1600
|
-
return
|
|
1666
|
+
return OwnershipTypeKeyClass
|
|
1601
1667
|
|
|
1602
|
-
def to_key_aspect(self) -> "
|
|
1603
|
-
from datahub.metadata.schema_classes import
|
|
1668
|
+
def to_key_aspect(self) -> "OwnershipTypeKeyClass":
|
|
1669
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1604
1670
|
|
|
1605
|
-
return
|
|
1671
|
+
return OwnershipTypeKeyClass(id=self.id)
|
|
1606
1672
|
|
|
1607
1673
|
@classmethod
|
|
1608
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1609
|
-
return cls(
|
|
1610
|
-
|
|
1611
|
-
@property
|
|
1612
|
-
def dashboard_tool(self) -> str:
|
|
1613
|
-
return self.entity_ids[0]
|
|
1674
|
+
def from_key_aspect(cls, key_aspect: "OwnershipTypeKeyClass") -> "OwnershipTypeUrn":
|
|
1675
|
+
return cls(id=key_aspect.id)
|
|
1614
1676
|
|
|
1615
1677
|
@property
|
|
1616
|
-
def
|
|
1617
|
-
return self.
|
|
1678
|
+
def id(self) -> str:
|
|
1679
|
+
return self._entity_ids[0]
|
|
1618
1680
|
|
|
1619
1681
|
if TYPE_CHECKING:
|
|
1620
|
-
from datahub.metadata.schema_classes import
|
|
1682
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
1621
1683
|
|
|
1622
|
-
class
|
|
1623
|
-
ENTITY_TYPE: ClassVar[
|
|
1684
|
+
class DomainUrn(_SpecificUrn):
|
|
1685
|
+
ENTITY_TYPE: ClassVar[Literal["domain"]] = "domain"
|
|
1624
1686
|
_URN_PARTS: ClassVar[int] = 1
|
|
1625
1687
|
|
|
1626
|
-
def __init__(self,
|
|
1688
|
+
def __init__(self, id: Union["DomainUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1627
1689
|
if _allow_coercion:
|
|
1628
1690
|
# Field coercion logic (if any is required).
|
|
1629
|
-
if isinstance(
|
|
1630
|
-
if
|
|
1691
|
+
if isinstance(id, str):
|
|
1692
|
+
if id.startswith('urn:li:'):
|
|
1631
1693
|
try:
|
|
1632
|
-
|
|
1694
|
+
id = DomainUrn.from_string(id)
|
|
1633
1695
|
except InvalidUrnError:
|
|
1634
|
-
raise InvalidUrnError(f'Expecting a
|
|
1696
|
+
raise InvalidUrnError(f'Expecting a DomainUrn but got {id}')
|
|
1635
1697
|
else:
|
|
1636
|
-
|
|
1698
|
+
id = UrnEncoder.encode_string(id)
|
|
1637
1699
|
|
|
1638
1700
|
# Validation logic.
|
|
1639
|
-
if not
|
|
1640
|
-
raise InvalidUrnError("
|
|
1641
|
-
if isinstance(
|
|
1642
|
-
|
|
1643
|
-
elif isinstance(
|
|
1644
|
-
raise InvalidUrnError(f'Expecting a
|
|
1645
|
-
if UrnEncoder.contains_reserved_char(
|
|
1646
|
-
raise InvalidUrnError(f'
|
|
1701
|
+
if not id:
|
|
1702
|
+
raise InvalidUrnError("DomainUrn id cannot be empty")
|
|
1703
|
+
if isinstance(id, DomainUrn):
|
|
1704
|
+
id = id.id
|
|
1705
|
+
elif isinstance(id, Urn):
|
|
1706
|
+
raise InvalidUrnError(f'Expecting a DomainUrn but got {id}')
|
|
1707
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1708
|
+
raise InvalidUrnError(f'DomainUrn id contains reserved characters')
|
|
1647
1709
|
|
|
1648
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1710
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1649
1711
|
|
|
1650
1712
|
@classmethod
|
|
1651
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1713
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DomainUrn":
|
|
1652
1714
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1653
|
-
raise InvalidUrnError(f"
|
|
1654
|
-
return cls(
|
|
1715
|
+
raise InvalidUrnError(f"DomainUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1716
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1655
1717
|
|
|
1656
1718
|
@classmethod
|
|
1657
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1658
|
-
from datahub.metadata.schema_classes import
|
|
1719
|
+
def underlying_key_aspect_type(cls) -> Type["DomainKeyClass"]:
|
|
1720
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
1659
1721
|
|
|
1660
|
-
return
|
|
1722
|
+
return DomainKeyClass
|
|
1661
1723
|
|
|
1662
|
-
def to_key_aspect(self) -> "
|
|
1663
|
-
from datahub.metadata.schema_classes import
|
|
1724
|
+
def to_key_aspect(self) -> "DomainKeyClass":
|
|
1725
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
1664
1726
|
|
|
1665
|
-
return
|
|
1727
|
+
return DomainKeyClass(id=self.id)
|
|
1666
1728
|
|
|
1667
1729
|
@classmethod
|
|
1668
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1669
|
-
return cls(
|
|
1730
|
+
def from_key_aspect(cls, key_aspect: "DomainKeyClass") -> "DomainUrn":
|
|
1731
|
+
return cls(id=key_aspect.id)
|
|
1732
|
+
|
|
1733
|
+
@classmethod
|
|
1734
|
+
@deprecated(reason="Use the constructor instead")
|
|
1735
|
+
def create_from_id(cls, id: str) -> "DomainUrn":
|
|
1736
|
+
return cls(id)
|
|
1670
1737
|
|
|
1671
1738
|
@property
|
|
1672
|
-
def
|
|
1673
|
-
return self.
|
|
1739
|
+
def id(self) -> str:
|
|
1740
|
+
return self._entity_ids[0]
|
|
1674
1741
|
|
|
1675
1742
|
if TYPE_CHECKING:
|
|
1676
1743
|
from datahub.metadata.schema_classes import MLFeatureKeyClass
|
|
1677
1744
|
|
|
1678
1745
|
class MlFeatureUrn(_SpecificUrn):
|
|
1679
|
-
ENTITY_TYPE: ClassVar[
|
|
1746
|
+
ENTITY_TYPE: ClassVar[Literal["mlFeature"]] = "mlFeature"
|
|
1680
1747
|
_URN_PARTS: ClassVar[int] = 2
|
|
1681
1748
|
|
|
1682
1749
|
def __init__(self, feature_namespace: str, name: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1720,73 +1787,71 @@ class MlFeatureUrn(_SpecificUrn):
|
|
|
1720
1787
|
|
|
1721
1788
|
@property
|
|
1722
1789
|
def feature_namespace(self) -> str:
|
|
1723
|
-
return self.
|
|
1790
|
+
return self._entity_ids[0]
|
|
1724
1791
|
|
|
1725
1792
|
@property
|
|
1726
1793
|
def name(self) -> str:
|
|
1727
|
-
return self.
|
|
1794
|
+
return self._entity_ids[1]
|
|
1728
1795
|
|
|
1729
1796
|
if TYPE_CHECKING:
|
|
1730
|
-
from datahub.metadata.schema_classes import
|
|
1797
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1731
1798
|
|
|
1732
|
-
class
|
|
1733
|
-
ENTITY_TYPE: ClassVar[
|
|
1734
|
-
_URN_PARTS: ClassVar[int] =
|
|
1799
|
+
class MlFeatureTableUrn(_SpecificUrn):
|
|
1800
|
+
ENTITY_TYPE: ClassVar[Literal["mlFeatureTable"]] = "mlFeatureTable"
|
|
1801
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
1735
1802
|
|
|
1736
|
-
def __init__(self,
|
|
1803
|
+
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, *, _allow_coercion: bool = True) -> None:
|
|
1737
1804
|
if _allow_coercion:
|
|
1738
1805
|
# Field coercion logic (if any is required).
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
try:
|
|
1742
|
-
id = DataHubStepStateUrn.from_string(id)
|
|
1743
|
-
except InvalidUrnError:
|
|
1744
|
-
raise InvalidUrnError(f'Expecting a DataHubStepStateUrn but got {id}')
|
|
1745
|
-
else:
|
|
1746
|
-
id = UrnEncoder.encode_string(id)
|
|
1806
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1807
|
+
name = UrnEncoder.encode_string(name)
|
|
1747
1808
|
|
|
1748
1809
|
# Validation logic.
|
|
1749
|
-
if not
|
|
1750
|
-
raise InvalidUrnError("
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
raise InvalidUrnError(
|
|
1755
|
-
if UrnEncoder.contains_reserved_char(
|
|
1756
|
-
raise InvalidUrnError(f'
|
|
1810
|
+
if not platform:
|
|
1811
|
+
raise InvalidUrnError("MlFeatureTableUrn platform cannot be empty")
|
|
1812
|
+
platform = str(platform) # convert urn type to str
|
|
1813
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1814
|
+
if not name:
|
|
1815
|
+
raise InvalidUrnError("MlFeatureTableUrn name cannot be empty")
|
|
1816
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1817
|
+
raise InvalidUrnError(f'MlFeatureTableUrn name contains reserved characters')
|
|
1757
1818
|
|
|
1758
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1819
|
+
super().__init__(self.ENTITY_TYPE, [platform, name])
|
|
1759
1820
|
|
|
1760
1821
|
@classmethod
|
|
1761
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1822
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlFeatureTableUrn":
|
|
1762
1823
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1763
|
-
raise InvalidUrnError(f"
|
|
1764
|
-
return cls(
|
|
1824
|
+
raise InvalidUrnError(f"MlFeatureTableUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1825
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], _allow_coercion=False)
|
|
1765
1826
|
|
|
1766
1827
|
@classmethod
|
|
1767
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1768
|
-
from datahub.metadata.schema_classes import
|
|
1828
|
+
def underlying_key_aspect_type(cls) -> Type["MLFeatureTableKeyClass"]:
|
|
1829
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1769
1830
|
|
|
1770
|
-
return
|
|
1831
|
+
return MLFeatureTableKeyClass
|
|
1771
1832
|
|
|
1772
|
-
def to_key_aspect(self) -> "
|
|
1773
|
-
from datahub.metadata.schema_classes import
|
|
1833
|
+
def to_key_aspect(self) -> "MLFeatureTableKeyClass":
|
|
1834
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1774
1835
|
|
|
1775
|
-
return
|
|
1836
|
+
return MLFeatureTableKeyClass(platform=self.platform, name=self.name)
|
|
1776
1837
|
|
|
1777
1838
|
@classmethod
|
|
1778
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1779
|
-
return cls(
|
|
1839
|
+
def from_key_aspect(cls, key_aspect: "MLFeatureTableKeyClass") -> "MlFeatureTableUrn":
|
|
1840
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name)
|
|
1780
1841
|
|
|
1781
1842
|
@property
|
|
1782
|
-
def
|
|
1783
|
-
return self.
|
|
1843
|
+
def platform(self) -> str:
|
|
1844
|
+
return self._entity_ids[0]
|
|
1845
|
+
|
|
1846
|
+
@property
|
|
1847
|
+
def name(self) -> str:
|
|
1848
|
+
return self._entity_ids[1]
|
|
1784
1849
|
|
|
1785
1850
|
if TYPE_CHECKING:
|
|
1786
1851
|
from datahub.metadata.schema_classes import DataHubViewKeyClass
|
|
1787
1852
|
|
|
1788
1853
|
class DataHubViewUrn(_SpecificUrn):
|
|
1789
|
-
ENTITY_TYPE: ClassVar[
|
|
1854
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubView"]] = "dataHubView"
|
|
1790
1855
|
_URN_PARTS: ClassVar[int] = 1
|
|
1791
1856
|
|
|
1792
1857
|
def __init__(self, id: Union["DataHubViewUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
@@ -1836,953 +1901,933 @@ class DataHubViewUrn(_SpecificUrn):
|
|
|
1836
1901
|
|
|
1837
1902
|
@property
|
|
1838
1903
|
def id(self) -> str:
|
|
1839
|
-
return self.
|
|
1904
|
+
return self._entity_ids[0]
|
|
1840
1905
|
|
|
1841
1906
|
if TYPE_CHECKING:
|
|
1842
|
-
from datahub.metadata.schema_classes import
|
|
1907
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1843
1908
|
|
|
1844
|
-
class
|
|
1845
|
-
ENTITY_TYPE: ClassVar[
|
|
1846
|
-
_URN_PARTS: ClassVar[int] =
|
|
1909
|
+
class DataHubActionUrn(_SpecificUrn):
|
|
1910
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubAction"]] = "dataHubAction"
|
|
1911
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1847
1912
|
|
|
1848
|
-
def __init__(self,
|
|
1913
|
+
def __init__(self, id: Union["DataHubActionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1849
1914
|
if _allow_coercion:
|
|
1850
1915
|
# Field coercion logic (if any is required).
|
|
1851
|
-
|
|
1852
|
-
|
|
1916
|
+
if isinstance(id, str):
|
|
1917
|
+
if id.startswith('urn:li:'):
|
|
1918
|
+
try:
|
|
1919
|
+
id = DataHubActionUrn.from_string(id)
|
|
1920
|
+
except InvalidUrnError:
|
|
1921
|
+
raise InvalidUrnError(f'Expecting a DataHubActionUrn but got {id}')
|
|
1922
|
+
else:
|
|
1923
|
+
id = UrnEncoder.encode_string(id)
|
|
1853
1924
|
|
|
1854
1925
|
# Validation logic.
|
|
1855
|
-
if not
|
|
1856
|
-
raise InvalidUrnError("
|
|
1857
|
-
if
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
raise InvalidUrnError(
|
|
1861
|
-
if UrnEncoder.contains_reserved_char(
|
|
1862
|
-
raise InvalidUrnError(f'
|
|
1926
|
+
if not id:
|
|
1927
|
+
raise InvalidUrnError("DataHubActionUrn id cannot be empty")
|
|
1928
|
+
if isinstance(id, DataHubActionUrn):
|
|
1929
|
+
id = id.id
|
|
1930
|
+
elif isinstance(id, Urn):
|
|
1931
|
+
raise InvalidUrnError(f'Expecting a DataHubActionUrn but got {id}')
|
|
1932
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1933
|
+
raise InvalidUrnError(f'DataHubActionUrn id contains reserved characters')
|
|
1863
1934
|
|
|
1864
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1935
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1865
1936
|
|
|
1866
1937
|
@classmethod
|
|
1867
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1938
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubActionUrn":
|
|
1868
1939
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1869
|
-
raise InvalidUrnError(f"
|
|
1870
|
-
return cls(
|
|
1940
|
+
raise InvalidUrnError(f"DataHubActionUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1941
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1871
1942
|
|
|
1872
1943
|
@classmethod
|
|
1873
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1874
|
-
from datahub.metadata.schema_classes import
|
|
1944
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubActionKeyClass"]:
|
|
1945
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1875
1946
|
|
|
1876
|
-
return
|
|
1947
|
+
return DataHubActionKeyClass
|
|
1877
1948
|
|
|
1878
|
-
def to_key_aspect(self) -> "
|
|
1879
|
-
from datahub.metadata.schema_classes import
|
|
1949
|
+
def to_key_aspect(self) -> "DataHubActionKeyClass":
|
|
1950
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1880
1951
|
|
|
1881
|
-
return
|
|
1952
|
+
return DataHubActionKeyClass(id=self.id)
|
|
1882
1953
|
|
|
1883
1954
|
@classmethod
|
|
1884
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1885
|
-
return cls(
|
|
1886
|
-
|
|
1887
|
-
@property
|
|
1888
|
-
def entity_name(self) -> str:
|
|
1889
|
-
return self.entity_ids[0]
|
|
1955
|
+
def from_key_aspect(cls, key_aspect: "DataHubActionKeyClass") -> "DataHubActionUrn":
|
|
1956
|
+
return cls(id=key_aspect.id)
|
|
1890
1957
|
|
|
1891
1958
|
@property
|
|
1892
|
-
def
|
|
1893
|
-
return self.
|
|
1959
|
+
def id(self) -> str:
|
|
1960
|
+
return self._entity_ids[0]
|
|
1894
1961
|
|
|
1895
1962
|
if TYPE_CHECKING:
|
|
1896
|
-
from datahub.metadata.schema_classes import
|
|
1963
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
1897
1964
|
|
|
1898
|
-
class
|
|
1899
|
-
ENTITY_TYPE: ClassVar[
|
|
1900
|
-
_URN_PARTS: ClassVar[int] =
|
|
1965
|
+
class DataHubUpgradeUrn(_SpecificUrn):
|
|
1966
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubUpgrade"]] = "dataHubUpgrade"
|
|
1967
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1901
1968
|
|
|
1902
|
-
def __init__(self,
|
|
1969
|
+
def __init__(self, id: Union["DataHubUpgradeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1903
1970
|
if _allow_coercion:
|
|
1904
1971
|
# Field coercion logic (if any is required).
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
if not name:
|
|
1914
|
-
raise InvalidUrnError("MlPrimaryKeyUrn name cannot be empty")
|
|
1915
|
-
if UrnEncoder.contains_reserved_char(name):
|
|
1916
|
-
raise InvalidUrnError(f'MlPrimaryKeyUrn name contains reserved characters')
|
|
1972
|
+
if isinstance(id, str):
|
|
1973
|
+
if id.startswith('urn:li:'):
|
|
1974
|
+
try:
|
|
1975
|
+
id = DataHubUpgradeUrn.from_string(id)
|
|
1976
|
+
except InvalidUrnError:
|
|
1977
|
+
raise InvalidUrnError(f'Expecting a DataHubUpgradeUrn but got {id}')
|
|
1978
|
+
else:
|
|
1979
|
+
id = UrnEncoder.encode_string(id)
|
|
1917
1980
|
|
|
1918
|
-
|
|
1981
|
+
# Validation logic.
|
|
1982
|
+
if not id:
|
|
1983
|
+
raise InvalidUrnError("DataHubUpgradeUrn id cannot be empty")
|
|
1984
|
+
if isinstance(id, DataHubUpgradeUrn):
|
|
1985
|
+
id = id.id
|
|
1986
|
+
elif isinstance(id, Urn):
|
|
1987
|
+
raise InvalidUrnError(f'Expecting a DataHubUpgradeUrn but got {id}')
|
|
1988
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1989
|
+
raise InvalidUrnError(f'DataHubUpgradeUrn id contains reserved characters')
|
|
1990
|
+
|
|
1991
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1919
1992
|
|
|
1920
1993
|
@classmethod
|
|
1921
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1994
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubUpgradeUrn":
|
|
1922
1995
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1923
|
-
raise InvalidUrnError(f"
|
|
1924
|
-
return cls(
|
|
1996
|
+
raise InvalidUrnError(f"DataHubUpgradeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1997
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1925
1998
|
|
|
1926
1999
|
@classmethod
|
|
1927
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1928
|
-
from datahub.metadata.schema_classes import
|
|
2000
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubUpgradeKeyClass"]:
|
|
2001
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
1929
2002
|
|
|
1930
|
-
return
|
|
2003
|
+
return DataHubUpgradeKeyClass
|
|
1931
2004
|
|
|
1932
|
-
def to_key_aspect(self) -> "
|
|
1933
|
-
from datahub.metadata.schema_classes import
|
|
2005
|
+
def to_key_aspect(self) -> "DataHubUpgradeKeyClass":
|
|
2006
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
1934
2007
|
|
|
1935
|
-
return
|
|
2008
|
+
return DataHubUpgradeKeyClass(id=self.id)
|
|
1936
2009
|
|
|
1937
2010
|
@classmethod
|
|
1938
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1939
|
-
return cls(
|
|
1940
|
-
|
|
1941
|
-
@property
|
|
1942
|
-
def feature_namespace(self) -> str:
|
|
1943
|
-
return self.entity_ids[0]
|
|
2011
|
+
def from_key_aspect(cls, key_aspect: "DataHubUpgradeKeyClass") -> "DataHubUpgradeUrn":
|
|
2012
|
+
return cls(id=key_aspect.id)
|
|
1944
2013
|
|
|
1945
2014
|
@property
|
|
1946
|
-
def
|
|
1947
|
-
return self.
|
|
2015
|
+
def id(self) -> str:
|
|
2016
|
+
return self._entity_ids[0]
|
|
1948
2017
|
|
|
1949
2018
|
if TYPE_CHECKING:
|
|
1950
|
-
from datahub.metadata.schema_classes import
|
|
2019
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
1951
2020
|
|
|
1952
|
-
class
|
|
1953
|
-
ENTITY_TYPE: ClassVar[
|
|
1954
|
-
_URN_PARTS: ClassVar[int] =
|
|
2021
|
+
class DataHubStepStateUrn(_SpecificUrn):
|
|
2022
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubStepState"]] = "dataHubStepState"
|
|
2023
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
1955
2024
|
|
|
1956
|
-
def __init__(self,
|
|
2025
|
+
def __init__(self, id: Union["DataHubStepStateUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1957
2026
|
if _allow_coercion:
|
|
1958
2027
|
# Field coercion logic (if any is required).
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
2028
|
+
if isinstance(id, str):
|
|
2029
|
+
if id.startswith('urn:li:'):
|
|
2030
|
+
try:
|
|
2031
|
+
id = DataHubStepStateUrn.from_string(id)
|
|
2032
|
+
except InvalidUrnError:
|
|
2033
|
+
raise InvalidUrnError(f'Expecting a DataHubStepStateUrn but got {id}')
|
|
2034
|
+
else:
|
|
2035
|
+
id = UrnEncoder.encode_string(id)
|
|
1962
2036
|
|
|
1963
2037
|
# Validation logic.
|
|
1964
|
-
if not
|
|
1965
|
-
raise InvalidUrnError("
|
|
1966
|
-
if
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
raise InvalidUrnError(
|
|
1970
|
-
if UrnEncoder.contains_reserved_char(
|
|
1971
|
-
raise InvalidUrnError(f'
|
|
1972
|
-
if not cluster:
|
|
1973
|
-
raise InvalidUrnError("DataFlowUrn cluster cannot be empty")
|
|
1974
|
-
if UrnEncoder.contains_reserved_char(cluster):
|
|
1975
|
-
raise InvalidUrnError(f'DataFlowUrn cluster contains reserved characters')
|
|
2038
|
+
if not id:
|
|
2039
|
+
raise InvalidUrnError("DataHubStepStateUrn id cannot be empty")
|
|
2040
|
+
if isinstance(id, DataHubStepStateUrn):
|
|
2041
|
+
id = id.id
|
|
2042
|
+
elif isinstance(id, Urn):
|
|
2043
|
+
raise InvalidUrnError(f'Expecting a DataHubStepStateUrn but got {id}')
|
|
2044
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2045
|
+
raise InvalidUrnError(f'DataHubStepStateUrn id contains reserved characters')
|
|
1976
2046
|
|
|
1977
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2047
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1978
2048
|
|
|
1979
2049
|
@classmethod
|
|
1980
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2050
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubStepStateUrn":
|
|
1981
2051
|
if len(entity_ids) != cls._URN_PARTS:
|
|
1982
|
-
raise InvalidUrnError(f"
|
|
1983
|
-
return cls(
|
|
2052
|
+
raise InvalidUrnError(f"DataHubStepStateUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2053
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1984
2054
|
|
|
1985
2055
|
@classmethod
|
|
1986
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1987
|
-
from datahub.metadata.schema_classes import
|
|
1988
|
-
|
|
1989
|
-
return DataFlowKeyClass
|
|
2056
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubStepStateKeyClass"]:
|
|
2057
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
1990
2058
|
|
|
1991
|
-
|
|
1992
|
-
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
2059
|
+
return DataHubStepStateKeyClass
|
|
1993
2060
|
|
|
1994
|
-
|
|
2061
|
+
def to_key_aspect(self) -> "DataHubStepStateKeyClass":
|
|
2062
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
1995
2063
|
|
|
1996
|
-
|
|
1997
|
-
def from_key_aspect(cls, key_aspect: "DataFlowKeyClass") -> "DataFlowUrn":
|
|
1998
|
-
return cls(orchestrator=key_aspect.orchestrator, flow_id=key_aspect.flowId, cluster=key_aspect.cluster)
|
|
2064
|
+
return DataHubStepStateKeyClass(id=self.id)
|
|
1999
2065
|
|
|
2000
2066
|
@classmethod
|
|
2001
|
-
def
|
|
2002
|
-
cls
|
|
2003
|
-
orchestrator: str,
|
|
2004
|
-
flow_id: str,
|
|
2005
|
-
env: str,
|
|
2006
|
-
platform_instance: Optional[str] = None,
|
|
2007
|
-
) -> "DataFlowUrn":
|
|
2008
|
-
return cls(
|
|
2009
|
-
orchestrator=orchestrator,
|
|
2010
|
-
flow_id=f"{platform_instance}.{flow_id}" if platform_instance else flow_id,
|
|
2011
|
-
cluster=env,
|
|
2012
|
-
)
|
|
2013
|
-
|
|
2014
|
-
@deprecated(reason="Use .orchestrator instead")
|
|
2015
|
-
def get_orchestrator_name(self) -> str:
|
|
2016
|
-
return self.orchestrator
|
|
2017
|
-
|
|
2018
|
-
@deprecated(reason="Use .flow_id instead")
|
|
2019
|
-
def get_flow_id(self) -> str:
|
|
2020
|
-
return self.flow_id
|
|
2021
|
-
|
|
2022
|
-
@deprecated(reason="Use .cluster instead")
|
|
2023
|
-
def get_env(self) -> str:
|
|
2024
|
-
return self.cluster
|
|
2025
|
-
|
|
2026
|
-
@property
|
|
2027
|
-
def orchestrator(self) -> str:
|
|
2028
|
-
return self.entity_ids[0]
|
|
2029
|
-
|
|
2030
|
-
@property
|
|
2031
|
-
def flow_id(self) -> str:
|
|
2032
|
-
return self.entity_ids[1]
|
|
2067
|
+
def from_key_aspect(cls, key_aspect: "DataHubStepStateKeyClass") -> "DataHubStepStateUrn":
|
|
2068
|
+
return cls(id=key_aspect.id)
|
|
2033
2069
|
|
|
2034
2070
|
@property
|
|
2035
|
-
def
|
|
2036
|
-
return self.
|
|
2071
|
+
def id(self) -> str:
|
|
2072
|
+
return self._entity_ids[0]
|
|
2037
2073
|
|
|
2038
2074
|
if TYPE_CHECKING:
|
|
2039
|
-
from datahub.metadata.schema_classes import
|
|
2075
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
2040
2076
|
|
|
2041
|
-
class
|
|
2042
|
-
ENTITY_TYPE: ClassVar[
|
|
2077
|
+
class ErModelRelationshipUrn(_SpecificUrn):
|
|
2078
|
+
ENTITY_TYPE: ClassVar[Literal["erModelRelationship"]] = "erModelRelationship"
|
|
2043
2079
|
_URN_PARTS: ClassVar[int] = 1
|
|
2044
2080
|
|
|
2045
|
-
def __init__(self,
|
|
2081
|
+
def __init__(self, id: Union["ErModelRelationshipUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2046
2082
|
if _allow_coercion:
|
|
2047
2083
|
# Field coercion logic (if any is required).
|
|
2048
|
-
if isinstance(
|
|
2049
|
-
if
|
|
2084
|
+
if isinstance(id, str):
|
|
2085
|
+
if id.startswith('urn:li:'):
|
|
2050
2086
|
try:
|
|
2051
|
-
|
|
2087
|
+
id = ErModelRelationshipUrn.from_string(id)
|
|
2052
2088
|
except InvalidUrnError:
|
|
2053
|
-
raise InvalidUrnError(f'Expecting a
|
|
2089
|
+
raise InvalidUrnError(f'Expecting a ErModelRelationshipUrn but got {id}')
|
|
2054
2090
|
else:
|
|
2055
|
-
|
|
2091
|
+
id = UrnEncoder.encode_string(id)
|
|
2056
2092
|
|
|
2057
2093
|
# Validation logic.
|
|
2058
|
-
if not
|
|
2059
|
-
raise InvalidUrnError("
|
|
2060
|
-
if isinstance(
|
|
2061
|
-
|
|
2062
|
-
elif isinstance(
|
|
2063
|
-
raise InvalidUrnError(f'Expecting a
|
|
2064
|
-
if UrnEncoder.contains_reserved_char(
|
|
2065
|
-
raise InvalidUrnError(f'
|
|
2094
|
+
if not id:
|
|
2095
|
+
raise InvalidUrnError("ErModelRelationshipUrn id cannot be empty")
|
|
2096
|
+
if isinstance(id, ErModelRelationshipUrn):
|
|
2097
|
+
id = id.id
|
|
2098
|
+
elif isinstance(id, Urn):
|
|
2099
|
+
raise InvalidUrnError(f'Expecting a ErModelRelationshipUrn but got {id}')
|
|
2100
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2101
|
+
raise InvalidUrnError(f'ErModelRelationshipUrn id contains reserved characters')
|
|
2066
2102
|
|
|
2067
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2103
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2068
2104
|
|
|
2069
2105
|
@classmethod
|
|
2070
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2106
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ErModelRelationshipUrn":
|
|
2071
2107
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2072
|
-
raise InvalidUrnError(f"
|
|
2073
|
-
return cls(
|
|
2108
|
+
raise InvalidUrnError(f"ErModelRelationshipUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2109
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2074
2110
|
|
|
2075
2111
|
@classmethod
|
|
2076
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2077
|
-
from datahub.metadata.schema_classes import
|
|
2078
|
-
|
|
2079
|
-
return CorpUserKeyClass
|
|
2112
|
+
def underlying_key_aspect_type(cls) -> Type["ERModelRelationshipKeyClass"]:
|
|
2113
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
2080
2114
|
|
|
2081
|
-
|
|
2082
|
-
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
2115
|
+
return ERModelRelationshipKeyClass
|
|
2083
2116
|
|
|
2084
|
-
|
|
2117
|
+
def to_key_aspect(self) -> "ERModelRelationshipKeyClass":
|
|
2118
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
2085
2119
|
|
|
2086
|
-
|
|
2087
|
-
def from_key_aspect(cls, key_aspect: "CorpUserKeyClass") -> "CorpUserUrn":
|
|
2088
|
-
return cls(username=key_aspect.username)
|
|
2120
|
+
return ERModelRelationshipKeyClass(id=self.id)
|
|
2089
2121
|
|
|
2090
2122
|
@classmethod
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
return cls(id)
|
|
2123
|
+
def from_key_aspect(cls, key_aspect: "ERModelRelationshipKeyClass") -> "ErModelRelationshipUrn":
|
|
2124
|
+
return cls(id=key_aspect.id)
|
|
2094
2125
|
|
|
2095
2126
|
@property
|
|
2096
|
-
def
|
|
2097
|
-
return self.
|
|
2127
|
+
def id(self) -> str:
|
|
2128
|
+
return self._entity_ids[0]
|
|
2098
2129
|
|
|
2099
2130
|
if TYPE_CHECKING:
|
|
2100
|
-
from datahub.metadata.schema_classes import
|
|
2131
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
2101
2132
|
|
|
2102
|
-
class
|
|
2103
|
-
ENTITY_TYPE: ClassVar[
|
|
2133
|
+
class DataHubPolicyUrn(_SpecificUrn):
|
|
2134
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubPolicy"]] = "dataHubPolicy"
|
|
2104
2135
|
_URN_PARTS: ClassVar[int] = 1
|
|
2105
2136
|
|
|
2106
|
-
def __init__(self, id: Union["
|
|
2137
|
+
def __init__(self, id: Union["DataHubPolicyUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2107
2138
|
if _allow_coercion:
|
|
2108
2139
|
# Field coercion logic (if any is required).
|
|
2109
2140
|
if isinstance(id, str):
|
|
2110
2141
|
if id.startswith('urn:li:'):
|
|
2111
2142
|
try:
|
|
2112
|
-
id =
|
|
2143
|
+
id = DataHubPolicyUrn.from_string(id)
|
|
2113
2144
|
except InvalidUrnError:
|
|
2114
|
-
raise InvalidUrnError(f'Expecting a
|
|
2145
|
+
raise InvalidUrnError(f'Expecting a DataHubPolicyUrn but got {id}')
|
|
2115
2146
|
else:
|
|
2116
2147
|
id = UrnEncoder.encode_string(id)
|
|
2117
2148
|
|
|
2118
2149
|
# Validation logic.
|
|
2119
2150
|
if not id:
|
|
2120
|
-
raise InvalidUrnError("
|
|
2121
|
-
if isinstance(id,
|
|
2151
|
+
raise InvalidUrnError("DataHubPolicyUrn id cannot be empty")
|
|
2152
|
+
if isinstance(id, DataHubPolicyUrn):
|
|
2122
2153
|
id = id.id
|
|
2123
2154
|
elif isinstance(id, Urn):
|
|
2124
|
-
raise InvalidUrnError(f'Expecting a
|
|
2155
|
+
raise InvalidUrnError(f'Expecting a DataHubPolicyUrn but got {id}')
|
|
2125
2156
|
if UrnEncoder.contains_reserved_char(id):
|
|
2126
|
-
raise InvalidUrnError(f'
|
|
2157
|
+
raise InvalidUrnError(f'DataHubPolicyUrn id contains reserved characters')
|
|
2127
2158
|
|
|
2128
2159
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2129
2160
|
|
|
2130
2161
|
@classmethod
|
|
2131
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2162
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubPolicyUrn":
|
|
2132
2163
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2133
|
-
raise InvalidUrnError(f"
|
|
2164
|
+
raise InvalidUrnError(f"DataHubPolicyUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2134
2165
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2135
2166
|
|
|
2136
2167
|
@classmethod
|
|
2137
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2138
|
-
from datahub.metadata.schema_classes import
|
|
2168
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubPolicyKeyClass"]:
|
|
2169
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
2139
2170
|
|
|
2140
|
-
return
|
|
2171
|
+
return DataHubPolicyKeyClass
|
|
2141
2172
|
|
|
2142
|
-
def to_key_aspect(self) -> "
|
|
2143
|
-
from datahub.metadata.schema_classes import
|
|
2173
|
+
def to_key_aspect(self) -> "DataHubPolicyKeyClass":
|
|
2174
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
2144
2175
|
|
|
2145
|
-
return
|
|
2176
|
+
return DataHubPolicyKeyClass(id=self.id)
|
|
2146
2177
|
|
|
2147
2178
|
@classmethod
|
|
2148
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2179
|
+
def from_key_aspect(cls, key_aspect: "DataHubPolicyKeyClass") -> "DataHubPolicyUrn":
|
|
2149
2180
|
return cls(id=key_aspect.id)
|
|
2150
2181
|
|
|
2151
2182
|
@property
|
|
2152
2183
|
def id(self) -> str:
|
|
2153
|
-
return self.
|
|
2184
|
+
return self._entity_ids[0]
|
|
2154
2185
|
|
|
2155
2186
|
if TYPE_CHECKING:
|
|
2156
|
-
from datahub.metadata.schema_classes import
|
|
2187
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2157
2188
|
|
|
2158
|
-
class
|
|
2159
|
-
ENTITY_TYPE: ClassVar[
|
|
2160
|
-
_URN_PARTS: ClassVar[int] =
|
|
2189
|
+
class DataHubRetentionUrn(_SpecificUrn):
|
|
2190
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubRetention"]] = "dataHubRetention"
|
|
2191
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
2161
2192
|
|
|
2162
|
-
def __init__(self,
|
|
2193
|
+
def __init__(self, entity_name: str, aspect_name: str, *, _allow_coercion: bool = True) -> None:
|
|
2163
2194
|
if _allow_coercion:
|
|
2164
2195
|
# Field coercion logic (if any is required).
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
try:
|
|
2168
|
-
platform_name = DataPlatformUrn.from_string(platform_name)
|
|
2169
|
-
except InvalidUrnError:
|
|
2170
|
-
raise InvalidUrnError(f'Expecting a DataPlatformUrn but got {platform_name}')
|
|
2171
|
-
else:
|
|
2172
|
-
platform_name = UrnEncoder.encode_string(platform_name)
|
|
2196
|
+
entity_name = UrnEncoder.encode_string(entity_name)
|
|
2197
|
+
aspect_name = UrnEncoder.encode_string(aspect_name)
|
|
2173
2198
|
|
|
2174
2199
|
# Validation logic.
|
|
2175
|
-
if not
|
|
2176
|
-
raise InvalidUrnError("
|
|
2177
|
-
if
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
raise InvalidUrnError(
|
|
2181
|
-
if UrnEncoder.contains_reserved_char(
|
|
2182
|
-
raise InvalidUrnError(f'
|
|
2200
|
+
if not entity_name:
|
|
2201
|
+
raise InvalidUrnError("DataHubRetentionUrn entity_name cannot be empty")
|
|
2202
|
+
if UrnEncoder.contains_reserved_char(entity_name):
|
|
2203
|
+
raise InvalidUrnError(f'DataHubRetentionUrn entity_name contains reserved characters')
|
|
2204
|
+
if not aspect_name:
|
|
2205
|
+
raise InvalidUrnError("DataHubRetentionUrn aspect_name cannot be empty")
|
|
2206
|
+
if UrnEncoder.contains_reserved_char(aspect_name):
|
|
2207
|
+
raise InvalidUrnError(f'DataHubRetentionUrn aspect_name contains reserved characters')
|
|
2183
2208
|
|
|
2184
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2209
|
+
super().__init__(self.ENTITY_TYPE, [entity_name, aspect_name])
|
|
2185
2210
|
|
|
2186
2211
|
@classmethod
|
|
2187
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2212
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubRetentionUrn":
|
|
2188
2213
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2189
|
-
raise InvalidUrnError(f"
|
|
2190
|
-
return cls(
|
|
2214
|
+
raise InvalidUrnError(f"DataHubRetentionUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2215
|
+
return cls(entity_name=entity_ids[0], aspect_name=entity_ids[1], _allow_coercion=False)
|
|
2191
2216
|
|
|
2192
2217
|
@classmethod
|
|
2193
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2194
|
-
from datahub.metadata.schema_classes import
|
|
2218
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubRetentionKeyClass"]:
|
|
2219
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2195
2220
|
|
|
2196
|
-
return
|
|
2221
|
+
return DataHubRetentionKeyClass
|
|
2197
2222
|
|
|
2198
|
-
def to_key_aspect(self) -> "
|
|
2199
|
-
from datahub.metadata.schema_classes import
|
|
2223
|
+
def to_key_aspect(self) -> "DataHubRetentionKeyClass":
|
|
2224
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2200
2225
|
|
|
2201
|
-
return
|
|
2226
|
+
return DataHubRetentionKeyClass(entityName=self.entity_name, aspectName=self.aspect_name)
|
|
2202
2227
|
|
|
2203
2228
|
@classmethod
|
|
2204
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2205
|
-
return cls(
|
|
2229
|
+
def from_key_aspect(cls, key_aspect: "DataHubRetentionKeyClass") -> "DataHubRetentionUrn":
|
|
2230
|
+
return cls(entity_name=key_aspect.entityName, aspect_name=key_aspect.aspectName)
|
|
2206
2231
|
|
|
2207
|
-
@
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
return cls(id)
|
|
2232
|
+
@property
|
|
2233
|
+
def entity_name(self) -> str:
|
|
2234
|
+
return self._entity_ids[0]
|
|
2211
2235
|
|
|
2212
2236
|
@property
|
|
2213
|
-
def
|
|
2214
|
-
return self.
|
|
2237
|
+
def aspect_name(self) -> str:
|
|
2238
|
+
return self._entity_ids[1]
|
|
2215
2239
|
|
|
2216
2240
|
if TYPE_CHECKING:
|
|
2217
|
-
from datahub.metadata.schema_classes import
|
|
2241
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
2218
2242
|
|
|
2219
|
-
class
|
|
2220
|
-
ENTITY_TYPE: ClassVar[
|
|
2243
|
+
class DataContractUrn(_SpecificUrn):
|
|
2244
|
+
ENTITY_TYPE: ClassVar[Literal["dataContract"]] = "dataContract"
|
|
2221
2245
|
_URN_PARTS: ClassVar[int] = 1
|
|
2222
2246
|
|
|
2223
|
-
def __init__(self,
|
|
2247
|
+
def __init__(self, id: Union["DataContractUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2224
2248
|
if _allow_coercion:
|
|
2225
2249
|
# Field coercion logic (if any is required).
|
|
2226
|
-
if isinstance(
|
|
2227
|
-
if
|
|
2250
|
+
if isinstance(id, str):
|
|
2251
|
+
if id.startswith('urn:li:'):
|
|
2228
2252
|
try:
|
|
2229
|
-
|
|
2253
|
+
id = DataContractUrn.from_string(id)
|
|
2230
2254
|
except InvalidUrnError:
|
|
2231
|
-
raise InvalidUrnError(f'Expecting a
|
|
2255
|
+
raise InvalidUrnError(f'Expecting a DataContractUrn but got {id}')
|
|
2232
2256
|
else:
|
|
2233
|
-
|
|
2257
|
+
id = UrnEncoder.encode_string(id)
|
|
2234
2258
|
|
|
2235
2259
|
# Validation logic.
|
|
2236
|
-
if not
|
|
2237
|
-
raise InvalidUrnError("
|
|
2238
|
-
if isinstance(
|
|
2239
|
-
|
|
2240
|
-
elif isinstance(
|
|
2241
|
-
raise InvalidUrnError(f'Expecting a
|
|
2242
|
-
if UrnEncoder.contains_reserved_char(
|
|
2243
|
-
raise InvalidUrnError(f'
|
|
2260
|
+
if not id:
|
|
2261
|
+
raise InvalidUrnError("DataContractUrn id cannot be empty")
|
|
2262
|
+
if isinstance(id, DataContractUrn):
|
|
2263
|
+
id = id.id
|
|
2264
|
+
elif isinstance(id, Urn):
|
|
2265
|
+
raise InvalidUrnError(f'Expecting a DataContractUrn but got {id}')
|
|
2266
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2267
|
+
raise InvalidUrnError(f'DataContractUrn id contains reserved characters')
|
|
2244
2268
|
|
|
2245
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2269
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2246
2270
|
|
|
2247
2271
|
@classmethod
|
|
2248
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2272
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataContractUrn":
|
|
2249
2273
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2250
|
-
raise InvalidUrnError(f"
|
|
2251
|
-
return cls(
|
|
2274
|
+
raise InvalidUrnError(f"DataContractUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2275
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2252
2276
|
|
|
2253
2277
|
@classmethod
|
|
2254
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2255
|
-
from datahub.metadata.schema_classes import
|
|
2278
|
+
def underlying_key_aspect_type(cls) -> Type["DataContractKeyClass"]:
|
|
2279
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
2256
2280
|
|
|
2257
|
-
return
|
|
2281
|
+
return DataContractKeyClass
|
|
2258
2282
|
|
|
2259
|
-
def to_key_aspect(self) -> "
|
|
2260
|
-
from datahub.metadata.schema_classes import
|
|
2283
|
+
def to_key_aspect(self) -> "DataContractKeyClass":
|
|
2284
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
2261
2285
|
|
|
2262
|
-
return
|
|
2286
|
+
return DataContractKeyClass(id=self.id)
|
|
2263
2287
|
|
|
2264
2288
|
@classmethod
|
|
2265
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2266
|
-
return cls(
|
|
2289
|
+
def from_key_aspect(cls, key_aspect: "DataContractKeyClass") -> "DataContractUrn":
|
|
2290
|
+
return cls(id=key_aspect.id)
|
|
2267
2291
|
|
|
2268
2292
|
@property
|
|
2269
|
-
def
|
|
2270
|
-
return self.
|
|
2293
|
+
def id(self) -> str:
|
|
2294
|
+
return self._entity_ids[0]
|
|
2271
2295
|
|
|
2272
2296
|
if TYPE_CHECKING:
|
|
2273
|
-
from datahub.metadata.schema_classes import
|
|
2297
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
2274
2298
|
|
|
2275
|
-
class
|
|
2276
|
-
ENTITY_TYPE: ClassVar[
|
|
2277
|
-
_URN_PARTS: ClassVar[int] =
|
|
2299
|
+
class DataProcessUrn(_SpecificUrn):
|
|
2300
|
+
ENTITY_TYPE: ClassVar[Literal["dataProcess"]] = "dataProcess"
|
|
2301
|
+
_URN_PARTS: ClassVar[int] = 3
|
|
2278
2302
|
|
|
2279
|
-
def __init__(self,
|
|
2303
|
+
def __init__(self, name: str, orchestrator: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
2280
2304
|
if _allow_coercion:
|
|
2281
2305
|
# Field coercion logic (if any is required).
|
|
2282
|
-
|
|
2283
|
-
|
|
2306
|
+
name = UrnEncoder.encode_string(name)
|
|
2307
|
+
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
2308
|
+
env = env.upper()
|
|
2284
2309
|
|
|
2285
2310
|
# Validation logic.
|
|
2286
|
-
if not
|
|
2287
|
-
raise InvalidUrnError("
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
if not
|
|
2291
|
-
raise InvalidUrnError("
|
|
2292
|
-
if UrnEncoder.contains_reserved_char(
|
|
2293
|
-
raise InvalidUrnError(f'
|
|
2311
|
+
if not name:
|
|
2312
|
+
raise InvalidUrnError("DataProcessUrn name cannot be empty")
|
|
2313
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
2314
|
+
raise InvalidUrnError(f'DataProcessUrn name contains reserved characters')
|
|
2315
|
+
if not orchestrator:
|
|
2316
|
+
raise InvalidUrnError("DataProcessUrn orchestrator cannot be empty")
|
|
2317
|
+
if UrnEncoder.contains_reserved_char(orchestrator):
|
|
2318
|
+
raise InvalidUrnError(f'DataProcessUrn orchestrator contains reserved characters')
|
|
2319
|
+
if not env:
|
|
2320
|
+
raise InvalidUrnError("DataProcessUrn env cannot be empty")
|
|
2321
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
2322
|
+
raise InvalidUrnError(f'DataProcessUrn env contains reserved characters')
|
|
2294
2323
|
|
|
2295
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2324
|
+
super().__init__(self.ENTITY_TYPE, [name, orchestrator, env])
|
|
2296
2325
|
|
|
2297
2326
|
@classmethod
|
|
2298
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2327
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataProcessUrn":
|
|
2299
2328
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2300
|
-
raise InvalidUrnError(f"
|
|
2301
|
-
return cls(
|
|
2329
|
+
raise InvalidUrnError(f"DataProcessUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2330
|
+
return cls(name=entity_ids[0], orchestrator=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
2302
2331
|
|
|
2303
2332
|
@classmethod
|
|
2304
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2305
|
-
from datahub.metadata.schema_classes import
|
|
2333
|
+
def underlying_key_aspect_type(cls) -> Type["DataProcessKeyClass"]:
|
|
2334
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
2306
2335
|
|
|
2307
|
-
return
|
|
2336
|
+
return DataProcessKeyClass
|
|
2308
2337
|
|
|
2309
|
-
def to_key_aspect(self) -> "
|
|
2310
|
-
from datahub.metadata.schema_classes import
|
|
2338
|
+
def to_key_aspect(self) -> "DataProcessKeyClass":
|
|
2339
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
2311
2340
|
|
|
2312
|
-
return
|
|
2341
|
+
return DataProcessKeyClass(name=self.name, orchestrator=self.orchestrator, origin=self.env)
|
|
2313
2342
|
|
|
2314
2343
|
@classmethod
|
|
2315
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2316
|
-
return cls(
|
|
2344
|
+
def from_key_aspect(cls, key_aspect: "DataProcessKeyClass") -> "DataProcessUrn":
|
|
2345
|
+
return cls(name=key_aspect.name, orchestrator=key_aspect.orchestrator, env=key_aspect.origin)
|
|
2317
2346
|
|
|
2318
2347
|
@property
|
|
2319
|
-
def
|
|
2320
|
-
return self.
|
|
2348
|
+
def name(self) -> str:
|
|
2349
|
+
return self._entity_ids[0]
|
|
2321
2350
|
|
|
2322
2351
|
@property
|
|
2323
|
-
def
|
|
2324
|
-
return self.
|
|
2352
|
+
def orchestrator(self) -> str:
|
|
2353
|
+
return self._entity_ids[1]
|
|
2354
|
+
|
|
2355
|
+
@property
|
|
2356
|
+
def env(self) -> str:
|
|
2357
|
+
return self._entity_ids[2]
|
|
2325
2358
|
|
|
2326
2359
|
if TYPE_CHECKING:
|
|
2327
|
-
from datahub.metadata.schema_classes import
|
|
2360
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
2328
2361
|
|
|
2329
|
-
class
|
|
2330
|
-
ENTITY_TYPE: ClassVar[
|
|
2362
|
+
class DataProcessInstanceUrn(_SpecificUrn):
|
|
2363
|
+
ENTITY_TYPE: ClassVar[Literal["dataProcessInstance"]] = "dataProcessInstance"
|
|
2331
2364
|
_URN_PARTS: ClassVar[int] = 1
|
|
2332
2365
|
|
|
2333
|
-
def __init__(self,
|
|
2366
|
+
def __init__(self, id: Union["DataProcessInstanceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2334
2367
|
if _allow_coercion:
|
|
2335
2368
|
# Field coercion logic (if any is required).
|
|
2336
|
-
if isinstance(
|
|
2337
|
-
if
|
|
2369
|
+
if isinstance(id, str):
|
|
2370
|
+
if id.startswith('urn:li:'):
|
|
2338
2371
|
try:
|
|
2339
|
-
|
|
2372
|
+
id = DataProcessInstanceUrn.from_string(id)
|
|
2340
2373
|
except InvalidUrnError:
|
|
2341
|
-
raise InvalidUrnError(f'Expecting a
|
|
2374
|
+
raise InvalidUrnError(f'Expecting a DataProcessInstanceUrn but got {id}')
|
|
2342
2375
|
else:
|
|
2343
|
-
|
|
2376
|
+
id = UrnEncoder.encode_string(id)
|
|
2344
2377
|
|
|
2345
2378
|
# Validation logic.
|
|
2346
|
-
if not
|
|
2347
|
-
raise InvalidUrnError("
|
|
2348
|
-
if isinstance(
|
|
2349
|
-
|
|
2350
|
-
elif isinstance(
|
|
2351
|
-
raise InvalidUrnError(f'Expecting a
|
|
2352
|
-
if UrnEncoder.contains_reserved_char(
|
|
2353
|
-
raise InvalidUrnError(f'
|
|
2379
|
+
if not id:
|
|
2380
|
+
raise InvalidUrnError("DataProcessInstanceUrn id cannot be empty")
|
|
2381
|
+
if isinstance(id, DataProcessInstanceUrn):
|
|
2382
|
+
id = id.id
|
|
2383
|
+
elif isinstance(id, Urn):
|
|
2384
|
+
raise InvalidUrnError(f'Expecting a DataProcessInstanceUrn but got {id}')
|
|
2385
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2386
|
+
raise InvalidUrnError(f'DataProcessInstanceUrn id contains reserved characters')
|
|
2354
2387
|
|
|
2355
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2388
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2356
2389
|
|
|
2357
2390
|
@classmethod
|
|
2358
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2391
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataProcessInstanceUrn":
|
|
2359
2392
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2360
|
-
raise InvalidUrnError(f"
|
|
2361
|
-
return cls(
|
|
2393
|
+
raise InvalidUrnError(f"DataProcessInstanceUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2394
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2362
2395
|
|
|
2363
2396
|
@classmethod
|
|
2364
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2365
|
-
from datahub.metadata.schema_classes import
|
|
2397
|
+
def underlying_key_aspect_type(cls) -> Type["DataProcessInstanceKeyClass"]:
|
|
2398
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
2366
2399
|
|
|
2367
|
-
return
|
|
2400
|
+
return DataProcessInstanceKeyClass
|
|
2368
2401
|
|
|
2369
|
-
def to_key_aspect(self) -> "
|
|
2370
|
-
from datahub.metadata.schema_classes import
|
|
2402
|
+
def to_key_aspect(self) -> "DataProcessInstanceKeyClass":
|
|
2403
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
2371
2404
|
|
|
2372
|
-
return
|
|
2405
|
+
return DataProcessInstanceKeyClass(id=self.id)
|
|
2373
2406
|
|
|
2374
2407
|
@classmethod
|
|
2375
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2376
|
-
return cls(
|
|
2408
|
+
def from_key_aspect(cls, key_aspect: "DataProcessInstanceKeyClass") -> "DataProcessInstanceUrn":
|
|
2409
|
+
return cls(id=key_aspect.id)
|
|
2410
|
+
|
|
2411
|
+
@classmethod
|
|
2412
|
+
@deprecated(reason="Use the constructor instead")
|
|
2413
|
+
def create_from_id(cls, id: str) -> "DataProcessInstanceUrn":
|
|
2414
|
+
return cls(id)
|
|
2415
|
+
|
|
2416
|
+
@deprecated(reason="Use .id instead")
|
|
2417
|
+
def get_dataprocessinstance_id(self) -> str:
|
|
2418
|
+
return self.id
|
|
2377
2419
|
|
|
2378
2420
|
@property
|
|
2379
|
-
def
|
|
2380
|
-
return self.
|
|
2421
|
+
def id(self) -> str:
|
|
2422
|
+
return self._entity_ids[0]
|
|
2381
2423
|
|
|
2382
2424
|
if TYPE_CHECKING:
|
|
2383
|
-
from datahub.metadata.schema_classes import
|
|
2425
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2384
2426
|
|
|
2385
|
-
class
|
|
2386
|
-
ENTITY_TYPE: ClassVar[
|
|
2387
|
-
_URN_PARTS: ClassVar[int] =
|
|
2427
|
+
class GlossaryTermUrn(_SpecificUrn):
|
|
2428
|
+
ENTITY_TYPE: ClassVar[Literal["glossaryTerm"]] = "glossaryTerm"
|
|
2429
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
2388
2430
|
|
|
2389
|
-
def __init__(self,
|
|
2431
|
+
def __init__(self, name: Union["GlossaryTermUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2390
2432
|
if _allow_coercion:
|
|
2391
2433
|
# Field coercion logic (if any is required).
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2434
|
+
if isinstance(name, str):
|
|
2435
|
+
if name.startswith('urn:li:'):
|
|
2436
|
+
try:
|
|
2437
|
+
name = GlossaryTermUrn.from_string(name)
|
|
2438
|
+
except InvalidUrnError:
|
|
2439
|
+
raise InvalidUrnError(f'Expecting a GlossaryTermUrn but got {name}')
|
|
2440
|
+
else:
|
|
2441
|
+
name = UrnEncoder.encode_string(name)
|
|
2395
2442
|
|
|
2396
2443
|
# Validation logic.
|
|
2397
|
-
if not platform:
|
|
2398
|
-
raise InvalidUrnError("MlModelUrn platform cannot be empty")
|
|
2399
|
-
platform = str(platform) # convert urn type to str
|
|
2400
|
-
assert DataPlatformUrn.from_string(platform)
|
|
2401
2444
|
if not name:
|
|
2402
|
-
raise InvalidUrnError("
|
|
2445
|
+
raise InvalidUrnError("GlossaryTermUrn name cannot be empty")
|
|
2446
|
+
if isinstance(name, GlossaryTermUrn):
|
|
2447
|
+
name = name.name
|
|
2448
|
+
elif isinstance(name, Urn):
|
|
2449
|
+
raise InvalidUrnError(f'Expecting a GlossaryTermUrn but got {name}')
|
|
2403
2450
|
if UrnEncoder.contains_reserved_char(name):
|
|
2404
|
-
raise InvalidUrnError(f'
|
|
2405
|
-
if not env:
|
|
2406
|
-
raise InvalidUrnError("MlModelUrn env cannot be empty")
|
|
2407
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
2408
|
-
raise InvalidUrnError(f'MlModelUrn env contains reserved characters')
|
|
2451
|
+
raise InvalidUrnError(f'GlossaryTermUrn name contains reserved characters')
|
|
2409
2452
|
|
|
2410
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2453
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
2411
2454
|
|
|
2412
2455
|
@classmethod
|
|
2413
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2456
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlossaryTermUrn":
|
|
2414
2457
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2415
|
-
raise InvalidUrnError(f"
|
|
2416
|
-
return cls(
|
|
2458
|
+
raise InvalidUrnError(f"GlossaryTermUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2459
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
2417
2460
|
|
|
2418
2461
|
@classmethod
|
|
2419
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2420
|
-
from datahub.metadata.schema_classes import
|
|
2462
|
+
def underlying_key_aspect_type(cls) -> Type["GlossaryTermKeyClass"]:
|
|
2463
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2421
2464
|
|
|
2422
|
-
return
|
|
2465
|
+
return GlossaryTermKeyClass
|
|
2423
2466
|
|
|
2424
|
-
def to_key_aspect(self) -> "
|
|
2425
|
-
from datahub.metadata.schema_classes import
|
|
2467
|
+
def to_key_aspect(self) -> "GlossaryTermKeyClass":
|
|
2468
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2426
2469
|
|
|
2427
|
-
return
|
|
2470
|
+
return GlossaryTermKeyClass(name=self.name)
|
|
2428
2471
|
|
|
2429
2472
|
@classmethod
|
|
2430
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2431
|
-
return cls(
|
|
2432
|
-
|
|
2433
|
-
@property
|
|
2434
|
-
def platform(self) -> str:
|
|
2435
|
-
return self.entity_ids[0]
|
|
2473
|
+
def from_key_aspect(cls, key_aspect: "GlossaryTermKeyClass") -> "GlossaryTermUrn":
|
|
2474
|
+
return cls(name=key_aspect.name)
|
|
2436
2475
|
|
|
2437
2476
|
@property
|
|
2438
2477
|
def name(self) -> str:
|
|
2439
|
-
return self.
|
|
2440
|
-
|
|
2441
|
-
@property
|
|
2442
|
-
def env(self) -> str:
|
|
2443
|
-
return self.entity_ids[2]
|
|
2478
|
+
return self._entity_ids[0]
|
|
2444
2479
|
|
|
2445
2480
|
if TYPE_CHECKING:
|
|
2446
|
-
from datahub.metadata.schema_classes import
|
|
2481
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
2447
2482
|
|
|
2448
|
-
class
|
|
2449
|
-
ENTITY_TYPE: ClassVar[
|
|
2483
|
+
class FormUrn(_SpecificUrn):
|
|
2484
|
+
ENTITY_TYPE: ClassVar[Literal["form"]] = "form"
|
|
2450
2485
|
_URN_PARTS: ClassVar[int] = 1
|
|
2451
2486
|
|
|
2452
|
-
def __init__(self, id: Union["
|
|
2487
|
+
def __init__(self, id: Union["FormUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2453
2488
|
if _allow_coercion:
|
|
2454
2489
|
# Field coercion logic (if any is required).
|
|
2455
2490
|
if isinstance(id, str):
|
|
2456
2491
|
if id.startswith('urn:li:'):
|
|
2457
2492
|
try:
|
|
2458
|
-
id =
|
|
2493
|
+
id = FormUrn.from_string(id)
|
|
2459
2494
|
except InvalidUrnError:
|
|
2460
|
-
raise InvalidUrnError(f'Expecting a
|
|
2495
|
+
raise InvalidUrnError(f'Expecting a FormUrn but got {id}')
|
|
2461
2496
|
else:
|
|
2462
2497
|
id = UrnEncoder.encode_string(id)
|
|
2463
2498
|
|
|
2464
2499
|
# Validation logic.
|
|
2465
2500
|
if not id:
|
|
2466
|
-
raise InvalidUrnError("
|
|
2467
|
-
if isinstance(id,
|
|
2501
|
+
raise InvalidUrnError("FormUrn id cannot be empty")
|
|
2502
|
+
if isinstance(id, FormUrn):
|
|
2468
2503
|
id = id.id
|
|
2469
2504
|
elif isinstance(id, Urn):
|
|
2470
|
-
raise InvalidUrnError(f'Expecting a
|
|
2505
|
+
raise InvalidUrnError(f'Expecting a FormUrn but got {id}')
|
|
2471
2506
|
if UrnEncoder.contains_reserved_char(id):
|
|
2472
|
-
raise InvalidUrnError(f'
|
|
2507
|
+
raise InvalidUrnError(f'FormUrn id contains reserved characters')
|
|
2473
2508
|
|
|
2474
2509
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2475
2510
|
|
|
2476
2511
|
@classmethod
|
|
2477
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2512
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "FormUrn":
|
|
2478
2513
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2479
|
-
raise InvalidUrnError(f"
|
|
2514
|
+
raise InvalidUrnError(f"FormUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2480
2515
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2481
2516
|
|
|
2482
2517
|
@classmethod
|
|
2483
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2484
|
-
from datahub.metadata.schema_classes import
|
|
2518
|
+
def underlying_key_aspect_type(cls) -> Type["FormKeyClass"]:
|
|
2519
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
2485
2520
|
|
|
2486
|
-
return
|
|
2521
|
+
return FormKeyClass
|
|
2487
2522
|
|
|
2488
|
-
def to_key_aspect(self) -> "
|
|
2489
|
-
from datahub.metadata.schema_classes import
|
|
2523
|
+
def to_key_aspect(self) -> "FormKeyClass":
|
|
2524
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
2490
2525
|
|
|
2491
|
-
return
|
|
2526
|
+
return FormKeyClass(id=self.id)
|
|
2492
2527
|
|
|
2493
2528
|
@classmethod
|
|
2494
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2529
|
+
def from_key_aspect(cls, key_aspect: "FormKeyClass") -> "FormUrn":
|
|
2495
2530
|
return cls(id=key_aspect.id)
|
|
2496
2531
|
|
|
2497
2532
|
@property
|
|
2498
2533
|
def id(self) -> str:
|
|
2499
|
-
return self.
|
|
2534
|
+
return self._entity_ids[0]
|
|
2500
2535
|
|
|
2501
2536
|
if TYPE_CHECKING:
|
|
2502
|
-
from datahub.metadata.schema_classes import
|
|
2537
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
2503
2538
|
|
|
2504
|
-
class
|
|
2505
|
-
ENTITY_TYPE: ClassVar[
|
|
2506
|
-
_URN_PARTS: ClassVar[int] =
|
|
2539
|
+
class SchemaFieldUrn(_SpecificUrn):
|
|
2540
|
+
ENTITY_TYPE: ClassVar[Literal["schemaField"]] = "schemaField"
|
|
2541
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
2507
2542
|
|
|
2508
|
-
def __init__(self,
|
|
2543
|
+
def __init__(self, parent: Union["Urn", str], field_path: str, *, _allow_coercion: bool = True) -> None:
|
|
2509
2544
|
if _allow_coercion:
|
|
2510
2545
|
# Field coercion logic (if any is required).
|
|
2511
|
-
if isinstance(
|
|
2512
|
-
if
|
|
2546
|
+
if isinstance(parent, str):
|
|
2547
|
+
if parent.startswith('urn:li:'):
|
|
2513
2548
|
try:
|
|
2514
|
-
|
|
2549
|
+
parent = Urn.from_string(parent)
|
|
2515
2550
|
except InvalidUrnError:
|
|
2516
|
-
raise InvalidUrnError(f'Expecting a
|
|
2551
|
+
raise InvalidUrnError(f'Expecting a Urn but got {parent}')
|
|
2517
2552
|
else:
|
|
2518
|
-
|
|
2553
|
+
parent = UrnEncoder.encode_string(parent)
|
|
2554
|
+
field_path = UrnEncoder.encode_string(field_path)
|
|
2519
2555
|
|
|
2520
2556
|
# Validation logic.
|
|
2521
|
-
if not
|
|
2522
|
-
raise InvalidUrnError("
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
raise InvalidUrnError(
|
|
2527
|
-
if UrnEncoder.contains_reserved_char(
|
|
2528
|
-
raise InvalidUrnError(f'
|
|
2557
|
+
if not parent:
|
|
2558
|
+
raise InvalidUrnError("SchemaFieldUrn parent cannot be empty")
|
|
2559
|
+
parent = str(parent) # convert urn type to str
|
|
2560
|
+
assert Urn.from_string(parent)
|
|
2561
|
+
if not field_path:
|
|
2562
|
+
raise InvalidUrnError("SchemaFieldUrn field_path cannot be empty")
|
|
2563
|
+
if UrnEncoder.contains_reserved_char(field_path):
|
|
2564
|
+
raise InvalidUrnError(f'SchemaFieldUrn field_path contains reserved characters')
|
|
2529
2565
|
|
|
2530
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2566
|
+
super().__init__(self.ENTITY_TYPE, [parent, field_path])
|
|
2531
2567
|
|
|
2532
2568
|
@classmethod
|
|
2533
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2569
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "SchemaFieldUrn":
|
|
2534
2570
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2535
|
-
raise InvalidUrnError(f"
|
|
2536
|
-
return cls(
|
|
2571
|
+
raise InvalidUrnError(f"SchemaFieldUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2572
|
+
return cls(parent=entity_ids[0], field_path=entity_ids[1], _allow_coercion=False)
|
|
2537
2573
|
|
|
2538
2574
|
@classmethod
|
|
2539
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2540
|
-
from datahub.metadata.schema_classes import
|
|
2575
|
+
def underlying_key_aspect_type(cls) -> Type["SchemaFieldKeyClass"]:
|
|
2576
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
2541
2577
|
|
|
2542
|
-
return
|
|
2578
|
+
return SchemaFieldKeyClass
|
|
2543
2579
|
|
|
2544
|
-
def to_key_aspect(self) -> "
|
|
2545
|
-
from datahub.metadata.schema_classes import
|
|
2580
|
+
def to_key_aspect(self) -> "SchemaFieldKeyClass":
|
|
2581
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
2546
2582
|
|
|
2547
|
-
return
|
|
2583
|
+
return SchemaFieldKeyClass(parent=self.parent, fieldPath=self.field_path)
|
|
2548
2584
|
|
|
2549
2585
|
@classmethod
|
|
2550
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2551
|
-
return cls(
|
|
2586
|
+
def from_key_aspect(cls, key_aspect: "SchemaFieldKeyClass") -> "SchemaFieldUrn":
|
|
2587
|
+
return cls(parent=key_aspect.parent, field_path=key_aspect.fieldPath)
|
|
2552
2588
|
|
|
2553
2589
|
@property
|
|
2554
|
-
def
|
|
2555
|
-
return self.
|
|
2590
|
+
def parent(self) -> str:
|
|
2591
|
+
return self._entity_ids[0]
|
|
2592
|
+
|
|
2593
|
+
@property
|
|
2594
|
+
def field_path(self) -> str:
|
|
2595
|
+
return self._entity_ids[1]
|
|
2556
2596
|
|
|
2557
2597
|
if TYPE_CHECKING:
|
|
2558
|
-
from datahub.metadata.schema_classes import
|
|
2598
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
2559
2599
|
|
|
2560
|
-
class
|
|
2561
|
-
ENTITY_TYPE: ClassVar[
|
|
2600
|
+
class TagUrn(_SpecificUrn):
|
|
2601
|
+
ENTITY_TYPE: ClassVar[Literal["tag"]] = "tag"
|
|
2562
2602
|
_URN_PARTS: ClassVar[int] = 1
|
|
2563
2603
|
|
|
2564
|
-
def __init__(self, name: Union["
|
|
2604
|
+
def __init__(self, name: Union["TagUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2565
2605
|
if _allow_coercion:
|
|
2566
2606
|
# Field coercion logic (if any is required).
|
|
2567
2607
|
if isinstance(name, str):
|
|
2568
2608
|
if name.startswith('urn:li:'):
|
|
2569
2609
|
try:
|
|
2570
|
-
name =
|
|
2610
|
+
name = TagUrn.from_string(name)
|
|
2571
2611
|
except InvalidUrnError:
|
|
2572
|
-
raise InvalidUrnError(f'Expecting a
|
|
2612
|
+
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
2573
2613
|
else:
|
|
2574
2614
|
name = UrnEncoder.encode_string(name)
|
|
2575
2615
|
|
|
2576
2616
|
# Validation logic.
|
|
2577
2617
|
if not name:
|
|
2578
|
-
raise InvalidUrnError("
|
|
2579
|
-
if isinstance(name,
|
|
2618
|
+
raise InvalidUrnError("TagUrn name cannot be empty")
|
|
2619
|
+
if isinstance(name, TagUrn):
|
|
2580
2620
|
name = name.name
|
|
2581
2621
|
elif isinstance(name, Urn):
|
|
2582
|
-
raise InvalidUrnError(f'Expecting a
|
|
2622
|
+
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
2583
2623
|
if UrnEncoder.contains_reserved_char(name):
|
|
2584
|
-
raise InvalidUrnError(f'
|
|
2624
|
+
raise InvalidUrnError(f'TagUrn name contains reserved characters')
|
|
2585
2625
|
|
|
2586
2626
|
super().__init__(self.ENTITY_TYPE, [name])
|
|
2587
2627
|
|
|
2588
2628
|
@classmethod
|
|
2589
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2629
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TagUrn":
|
|
2590
2630
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2591
|
-
raise InvalidUrnError(f"
|
|
2631
|
+
raise InvalidUrnError(f"TagUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2592
2632
|
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
2593
2633
|
|
|
2594
2634
|
@classmethod
|
|
2595
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2596
|
-
from datahub.metadata.schema_classes import
|
|
2635
|
+
def underlying_key_aspect_type(cls) -> Type["TagKeyClass"]:
|
|
2636
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
2597
2637
|
|
|
2598
|
-
return
|
|
2638
|
+
return TagKeyClass
|
|
2599
2639
|
|
|
2600
|
-
def to_key_aspect(self) -> "
|
|
2601
|
-
from datahub.metadata.schema_classes import
|
|
2640
|
+
def to_key_aspect(self) -> "TagKeyClass":
|
|
2641
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
2602
2642
|
|
|
2603
|
-
return
|
|
2643
|
+
return TagKeyClass(name=self.name)
|
|
2604
2644
|
|
|
2605
2645
|
@classmethod
|
|
2606
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2646
|
+
def from_key_aspect(cls, key_aspect: "TagKeyClass") -> "TagUrn":
|
|
2607
2647
|
return cls(name=key_aspect.name)
|
|
2608
2648
|
|
|
2649
|
+
@classmethod
|
|
2650
|
+
@deprecated(reason="Use the constructor instead")
|
|
2651
|
+
def create_from_id(cls, id: str) -> "TagUrn":
|
|
2652
|
+
return cls(id)
|
|
2653
|
+
|
|
2609
2654
|
@property
|
|
2610
2655
|
def name(self) -> str:
|
|
2611
|
-
return self.
|
|
2656
|
+
return self._entity_ids[0]
|
|
2612
2657
|
|
|
2613
2658
|
if TYPE_CHECKING:
|
|
2614
|
-
from datahub.metadata.schema_classes import
|
|
2659
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
2615
2660
|
|
|
2616
|
-
class
|
|
2617
|
-
ENTITY_TYPE: ClassVar[
|
|
2661
|
+
class PostUrn(_SpecificUrn):
|
|
2662
|
+
ENTITY_TYPE: ClassVar[Literal["post"]] = "post"
|
|
2618
2663
|
_URN_PARTS: ClassVar[int] = 1
|
|
2619
2664
|
|
|
2620
|
-
def __init__(self, id: Union["
|
|
2665
|
+
def __init__(self, id: Union["PostUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2621
2666
|
if _allow_coercion:
|
|
2622
2667
|
# Field coercion logic (if any is required).
|
|
2623
2668
|
if isinstance(id, str):
|
|
2624
2669
|
if id.startswith('urn:li:'):
|
|
2625
2670
|
try:
|
|
2626
|
-
id =
|
|
2671
|
+
id = PostUrn.from_string(id)
|
|
2627
2672
|
except InvalidUrnError:
|
|
2628
|
-
raise InvalidUrnError(f'Expecting a
|
|
2673
|
+
raise InvalidUrnError(f'Expecting a PostUrn but got {id}')
|
|
2629
2674
|
else:
|
|
2630
2675
|
id = UrnEncoder.encode_string(id)
|
|
2631
2676
|
|
|
2632
2677
|
# Validation logic.
|
|
2633
2678
|
if not id:
|
|
2634
|
-
raise InvalidUrnError("
|
|
2635
|
-
if isinstance(id,
|
|
2679
|
+
raise InvalidUrnError("PostUrn id cannot be empty")
|
|
2680
|
+
if isinstance(id, PostUrn):
|
|
2636
2681
|
id = id.id
|
|
2637
2682
|
elif isinstance(id, Urn):
|
|
2638
|
-
raise InvalidUrnError(f'Expecting a
|
|
2683
|
+
raise InvalidUrnError(f'Expecting a PostUrn but got {id}')
|
|
2639
2684
|
if UrnEncoder.contains_reserved_char(id):
|
|
2640
|
-
raise InvalidUrnError(f'
|
|
2685
|
+
raise InvalidUrnError(f'PostUrn id contains reserved characters')
|
|
2641
2686
|
|
|
2642
2687
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2643
2688
|
|
|
2644
2689
|
@classmethod
|
|
2645
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2690
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "PostUrn":
|
|
2646
2691
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2647
|
-
raise InvalidUrnError(f"
|
|
2692
|
+
raise InvalidUrnError(f"PostUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2648
2693
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2649
2694
|
|
|
2650
2695
|
@classmethod
|
|
2651
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2652
|
-
from datahub.metadata.schema_classes import
|
|
2696
|
+
def underlying_key_aspect_type(cls) -> Type["PostKeyClass"]:
|
|
2697
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
2653
2698
|
|
|
2654
|
-
return
|
|
2699
|
+
return PostKeyClass
|
|
2655
2700
|
|
|
2656
|
-
def to_key_aspect(self) -> "
|
|
2657
|
-
from datahub.metadata.schema_classes import
|
|
2701
|
+
def to_key_aspect(self) -> "PostKeyClass":
|
|
2702
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
2658
2703
|
|
|
2659
|
-
return
|
|
2704
|
+
return PostKeyClass(id=self.id)
|
|
2660
2705
|
|
|
2661
2706
|
@classmethod
|
|
2662
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2707
|
+
def from_key_aspect(cls, key_aspect: "PostKeyClass") -> "PostUrn":
|
|
2663
2708
|
return cls(id=key_aspect.id)
|
|
2664
2709
|
|
|
2665
2710
|
@property
|
|
2666
2711
|
def id(self) -> str:
|
|
2667
|
-
return self.
|
|
2712
|
+
return self._entity_ids[0]
|
|
2668
2713
|
|
|
2669
2714
|
if TYPE_CHECKING:
|
|
2670
|
-
from datahub.metadata.schema_classes import
|
|
2715
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2671
2716
|
|
|
2672
|
-
class
|
|
2673
|
-
ENTITY_TYPE: ClassVar[
|
|
2717
|
+
class DataHubIngestionSourceUrn(_SpecificUrn):
|
|
2718
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubIngestionSource"]] = "dataHubIngestionSource"
|
|
2674
2719
|
_URN_PARTS: ClassVar[int] = 1
|
|
2675
2720
|
|
|
2676
|
-
def __init__(self, id: Union["
|
|
2721
|
+
def __init__(self, id: Union["DataHubIngestionSourceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2677
2722
|
if _allow_coercion:
|
|
2678
2723
|
# Field coercion logic (if any is required).
|
|
2679
2724
|
if isinstance(id, str):
|
|
2680
2725
|
if id.startswith('urn:li:'):
|
|
2681
2726
|
try:
|
|
2682
|
-
id =
|
|
2727
|
+
id = DataHubIngestionSourceUrn.from_string(id)
|
|
2683
2728
|
except InvalidUrnError:
|
|
2684
|
-
raise InvalidUrnError(f'Expecting a
|
|
2729
|
+
raise InvalidUrnError(f'Expecting a DataHubIngestionSourceUrn but got {id}')
|
|
2685
2730
|
else:
|
|
2686
2731
|
id = UrnEncoder.encode_string(id)
|
|
2687
2732
|
|
|
2688
2733
|
# Validation logic.
|
|
2689
2734
|
if not id:
|
|
2690
|
-
raise InvalidUrnError("
|
|
2691
|
-
if isinstance(id,
|
|
2735
|
+
raise InvalidUrnError("DataHubIngestionSourceUrn id cannot be empty")
|
|
2736
|
+
if isinstance(id, DataHubIngestionSourceUrn):
|
|
2692
2737
|
id = id.id
|
|
2693
2738
|
elif isinstance(id, Urn):
|
|
2694
|
-
raise InvalidUrnError(f'Expecting a
|
|
2739
|
+
raise InvalidUrnError(f'Expecting a DataHubIngestionSourceUrn but got {id}')
|
|
2695
2740
|
if UrnEncoder.contains_reserved_char(id):
|
|
2696
|
-
raise InvalidUrnError(f'
|
|
2741
|
+
raise InvalidUrnError(f'DataHubIngestionSourceUrn id contains reserved characters')
|
|
2697
2742
|
|
|
2698
2743
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2699
2744
|
|
|
2700
2745
|
@classmethod
|
|
2701
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2746
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubIngestionSourceUrn":
|
|
2702
2747
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2703
|
-
raise InvalidUrnError(f"
|
|
2748
|
+
raise InvalidUrnError(f"DataHubIngestionSourceUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2704
2749
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2705
2750
|
|
|
2706
2751
|
@classmethod
|
|
2707
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2708
|
-
from datahub.metadata.schema_classes import
|
|
2752
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubIngestionSourceKeyClass"]:
|
|
2753
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2709
2754
|
|
|
2710
|
-
return
|
|
2755
|
+
return DataHubIngestionSourceKeyClass
|
|
2711
2756
|
|
|
2712
|
-
def to_key_aspect(self) -> "
|
|
2713
|
-
from datahub.metadata.schema_classes import
|
|
2757
|
+
def to_key_aspect(self) -> "DataHubIngestionSourceKeyClass":
|
|
2758
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2714
2759
|
|
|
2715
|
-
return
|
|
2760
|
+
return DataHubIngestionSourceKeyClass(id=self.id)
|
|
2716
2761
|
|
|
2717
2762
|
@classmethod
|
|
2718
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2763
|
+
def from_key_aspect(cls, key_aspect: "DataHubIngestionSourceKeyClass") -> "DataHubIngestionSourceUrn":
|
|
2719
2764
|
return cls(id=key_aspect.id)
|
|
2720
2765
|
|
|
2721
2766
|
@property
|
|
2722
2767
|
def id(self) -> str:
|
|
2723
|
-
return self.
|
|
2768
|
+
return self._entity_ids[0]
|
|
2724
2769
|
|
|
2725
2770
|
if TYPE_CHECKING:
|
|
2726
|
-
from datahub.metadata.schema_classes import
|
|
2771
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2727
2772
|
|
|
2728
|
-
class
|
|
2729
|
-
ENTITY_TYPE: ClassVar[
|
|
2773
|
+
class InviteTokenUrn(_SpecificUrn):
|
|
2774
|
+
ENTITY_TYPE: ClassVar[Literal["inviteToken"]] = "inviteToken"
|
|
2730
2775
|
_URN_PARTS: ClassVar[int] = 1
|
|
2731
2776
|
|
|
2732
|
-
def __init__(self, id: Union["
|
|
2777
|
+
def __init__(self, id: Union["InviteTokenUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2733
2778
|
if _allow_coercion:
|
|
2734
2779
|
# Field coercion logic (if any is required).
|
|
2735
2780
|
if isinstance(id, str):
|
|
2736
2781
|
if id.startswith('urn:li:'):
|
|
2737
2782
|
try:
|
|
2738
|
-
id =
|
|
2783
|
+
id = InviteTokenUrn.from_string(id)
|
|
2739
2784
|
except InvalidUrnError:
|
|
2740
|
-
raise InvalidUrnError(f'Expecting a
|
|
2785
|
+
raise InvalidUrnError(f'Expecting a InviteTokenUrn but got {id}')
|
|
2741
2786
|
else:
|
|
2742
2787
|
id = UrnEncoder.encode_string(id)
|
|
2743
2788
|
|
|
2744
2789
|
# Validation logic.
|
|
2745
2790
|
if not id:
|
|
2746
|
-
raise InvalidUrnError("
|
|
2747
|
-
if isinstance(id,
|
|
2791
|
+
raise InvalidUrnError("InviteTokenUrn id cannot be empty")
|
|
2792
|
+
if isinstance(id, InviteTokenUrn):
|
|
2748
2793
|
id = id.id
|
|
2749
2794
|
elif isinstance(id, Urn):
|
|
2750
|
-
raise InvalidUrnError(f'Expecting a
|
|
2795
|
+
raise InvalidUrnError(f'Expecting a InviteTokenUrn but got {id}')
|
|
2751
2796
|
if UrnEncoder.contains_reserved_char(id):
|
|
2752
|
-
raise InvalidUrnError(f'
|
|
2797
|
+
raise InvalidUrnError(f'InviteTokenUrn id contains reserved characters')
|
|
2753
2798
|
|
|
2754
2799
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2755
2800
|
|
|
2756
2801
|
@classmethod
|
|
2757
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2802
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "InviteTokenUrn":
|
|
2758
2803
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2759
|
-
raise InvalidUrnError(f"
|
|
2804
|
+
raise InvalidUrnError(f"InviteTokenUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2760
2805
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2761
2806
|
|
|
2762
2807
|
@classmethod
|
|
2763
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2764
|
-
from datahub.metadata.schema_classes import
|
|
2808
|
+
def underlying_key_aspect_type(cls) -> Type["InviteTokenKeyClass"]:
|
|
2809
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2765
2810
|
|
|
2766
|
-
return
|
|
2811
|
+
return InviteTokenKeyClass
|
|
2767
2812
|
|
|
2768
|
-
def to_key_aspect(self) -> "
|
|
2769
|
-
from datahub.metadata.schema_classes import
|
|
2813
|
+
def to_key_aspect(self) -> "InviteTokenKeyClass":
|
|
2814
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2770
2815
|
|
|
2771
|
-
return
|
|
2816
|
+
return InviteTokenKeyClass(id=self.id)
|
|
2772
2817
|
|
|
2773
2818
|
@classmethod
|
|
2774
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2819
|
+
def from_key_aspect(cls, key_aspect: "InviteTokenKeyClass") -> "InviteTokenUrn":
|
|
2775
2820
|
return cls(id=key_aspect.id)
|
|
2776
2821
|
|
|
2777
2822
|
@property
|
|
2778
2823
|
def id(self) -> str:
|
|
2779
|
-
return self.
|
|
2824
|
+
return self._entity_ids[0]
|
|
2780
2825
|
|
|
2781
2826
|
if TYPE_CHECKING:
|
|
2782
2827
|
from datahub.metadata.schema_classes import DataHubPersonaKeyClass
|
|
2783
2828
|
|
|
2784
2829
|
class DataHubPersonaUrn(_SpecificUrn):
|
|
2785
|
-
ENTITY_TYPE: ClassVar[
|
|
2830
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubPersona"]] = "dataHubPersona"
|
|
2786
2831
|
_URN_PARTS: ClassVar[int] = 1
|
|
2787
2832
|
|
|
2788
2833
|
def __init__(self, id: Union["DataHubPersonaUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
@@ -2832,527 +2877,506 @@ class DataHubPersonaUrn(_SpecificUrn):
|
|
|
2832
2877
|
|
|
2833
2878
|
@property
|
|
2834
2879
|
def id(self) -> str:
|
|
2835
|
-
return self.
|
|
2880
|
+
return self._entity_ids[0]
|
|
2836
2881
|
|
|
2837
2882
|
if TYPE_CHECKING:
|
|
2838
|
-
from datahub.metadata.schema_classes import
|
|
2883
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
2839
2884
|
|
|
2840
|
-
class
|
|
2841
|
-
ENTITY_TYPE: ClassVar[
|
|
2842
|
-
_URN_PARTS: ClassVar[int] =
|
|
2885
|
+
class ContainerUrn(_SpecificUrn):
|
|
2886
|
+
ENTITY_TYPE: ClassVar[Literal["container"]] = "container"
|
|
2887
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
2843
2888
|
|
|
2844
|
-
def __init__(self,
|
|
2889
|
+
def __init__(self, guid: Union["ContainerUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2845
2890
|
if _allow_coercion:
|
|
2846
2891
|
# Field coercion logic (if any is required).
|
|
2847
|
-
|
|
2848
|
-
|
|
2892
|
+
if isinstance(guid, str):
|
|
2893
|
+
if guid.startswith('urn:li:'):
|
|
2894
|
+
try:
|
|
2895
|
+
guid = ContainerUrn.from_string(guid)
|
|
2896
|
+
except InvalidUrnError:
|
|
2897
|
+
raise InvalidUrnError(f'Expecting a ContainerUrn but got {guid}')
|
|
2898
|
+
else:
|
|
2899
|
+
guid = UrnEncoder.encode_string(guid)
|
|
2849
2900
|
|
|
2850
2901
|
# Validation logic.
|
|
2851
|
-
if not
|
|
2852
|
-
raise InvalidUrnError("
|
|
2853
|
-
if
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
raise InvalidUrnError(
|
|
2857
|
-
if UrnEncoder.contains_reserved_char(
|
|
2858
|
-
raise InvalidUrnError(f'
|
|
2902
|
+
if not guid:
|
|
2903
|
+
raise InvalidUrnError("ContainerUrn guid cannot be empty")
|
|
2904
|
+
if isinstance(guid, ContainerUrn):
|
|
2905
|
+
guid = guid.guid
|
|
2906
|
+
elif isinstance(guid, Urn):
|
|
2907
|
+
raise InvalidUrnError(f'Expecting a ContainerUrn but got {guid}')
|
|
2908
|
+
if UrnEncoder.contains_reserved_char(guid):
|
|
2909
|
+
raise InvalidUrnError(f'ContainerUrn guid contains reserved characters')
|
|
2859
2910
|
|
|
2860
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2911
|
+
super().__init__(self.ENTITY_TYPE, [guid])
|
|
2861
2912
|
|
|
2862
2913
|
@classmethod
|
|
2863
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2914
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ContainerUrn":
|
|
2864
2915
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2865
|
-
raise InvalidUrnError(f"
|
|
2866
|
-
return cls(
|
|
2916
|
+
raise InvalidUrnError(f"ContainerUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2917
|
+
return cls(guid=entity_ids[0], _allow_coercion=False)
|
|
2867
2918
|
|
|
2868
2919
|
@classmethod
|
|
2869
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2870
|
-
from datahub.metadata.schema_classes import
|
|
2920
|
+
def underlying_key_aspect_type(cls) -> Type["ContainerKeyClass"]:
|
|
2921
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
2871
2922
|
|
|
2872
|
-
return
|
|
2923
|
+
return ContainerKeyClass
|
|
2873
2924
|
|
|
2874
|
-
def to_key_aspect(self) -> "
|
|
2875
|
-
from datahub.metadata.schema_classes import
|
|
2925
|
+
def to_key_aspect(self) -> "ContainerKeyClass":
|
|
2926
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
2876
2927
|
|
|
2877
|
-
return
|
|
2928
|
+
return ContainerKeyClass(guid=self.guid)
|
|
2878
2929
|
|
|
2879
2930
|
@classmethod
|
|
2880
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2881
|
-
return cls(
|
|
2882
|
-
|
|
2883
|
-
@property
|
|
2884
|
-
def dashboard_tool(self) -> str:
|
|
2885
|
-
return self.entity_ids[0]
|
|
2931
|
+
def from_key_aspect(cls, key_aspect: "ContainerKeyClass") -> "ContainerUrn":
|
|
2932
|
+
return cls(guid=key_aspect.guid)
|
|
2886
2933
|
|
|
2887
2934
|
@property
|
|
2888
|
-
def
|
|
2889
|
-
return self.
|
|
2935
|
+
def guid(self) -> str:
|
|
2936
|
+
return self._entity_ids[0]
|
|
2890
2937
|
|
|
2891
2938
|
if TYPE_CHECKING:
|
|
2892
|
-
from datahub.metadata.schema_classes import
|
|
2939
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2893
2940
|
|
|
2894
|
-
class
|
|
2895
|
-
ENTITY_TYPE: ClassVar[
|
|
2896
|
-
_URN_PARTS: ClassVar[int] =
|
|
2941
|
+
class IncidentUrn(_SpecificUrn):
|
|
2942
|
+
ENTITY_TYPE: ClassVar[Literal["incident"]] = "incident"
|
|
2943
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
2897
2944
|
|
|
2898
|
-
def __init__(self, id:
|
|
2945
|
+
def __init__(self, id: Union["IncidentUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2899
2946
|
if _allow_coercion:
|
|
2900
2947
|
# Field coercion logic (if any is required).
|
|
2901
|
-
|
|
2902
|
-
|
|
2948
|
+
if isinstance(id, str):
|
|
2949
|
+
if id.startswith('urn:li:'):
|
|
2950
|
+
try:
|
|
2951
|
+
id = IncidentUrn.from_string(id)
|
|
2952
|
+
except InvalidUrnError:
|
|
2953
|
+
raise InvalidUrnError(f'Expecting a IncidentUrn but got {id}')
|
|
2954
|
+
else:
|
|
2955
|
+
id = UrnEncoder.encode_string(id)
|
|
2903
2956
|
|
|
2904
2957
|
# Validation logic.
|
|
2905
2958
|
if not id:
|
|
2906
|
-
raise InvalidUrnError("
|
|
2959
|
+
raise InvalidUrnError("IncidentUrn id cannot be empty")
|
|
2960
|
+
if isinstance(id, IncidentUrn):
|
|
2961
|
+
id = id.id
|
|
2962
|
+
elif isinstance(id, Urn):
|
|
2963
|
+
raise InvalidUrnError(f'Expecting a IncidentUrn but got {id}')
|
|
2907
2964
|
if UrnEncoder.contains_reserved_char(id):
|
|
2908
|
-
raise InvalidUrnError(f'
|
|
2909
|
-
if not entity_type:
|
|
2910
|
-
raise InvalidUrnError("VersionSetUrn entity_type cannot be empty")
|
|
2911
|
-
if UrnEncoder.contains_reserved_char(entity_type):
|
|
2912
|
-
raise InvalidUrnError(f'VersionSetUrn entity_type contains reserved characters')
|
|
2965
|
+
raise InvalidUrnError(f'IncidentUrn id contains reserved characters')
|
|
2913
2966
|
|
|
2914
|
-
super().__init__(self.ENTITY_TYPE, [id
|
|
2967
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2915
2968
|
|
|
2916
2969
|
@classmethod
|
|
2917
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2970
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "IncidentUrn":
|
|
2918
2971
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2919
|
-
raise InvalidUrnError(f"
|
|
2920
|
-
return cls(id=entity_ids[0],
|
|
2972
|
+
raise InvalidUrnError(f"IncidentUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2973
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2921
2974
|
|
|
2922
2975
|
@classmethod
|
|
2923
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2924
|
-
from datahub.metadata.schema_classes import
|
|
2976
|
+
def underlying_key_aspect_type(cls) -> Type["IncidentKeyClass"]:
|
|
2977
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2925
2978
|
|
|
2926
|
-
return
|
|
2979
|
+
return IncidentKeyClass
|
|
2927
2980
|
|
|
2928
|
-
def to_key_aspect(self) -> "
|
|
2929
|
-
from datahub.metadata.schema_classes import
|
|
2981
|
+
def to_key_aspect(self) -> "IncidentKeyClass":
|
|
2982
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2930
2983
|
|
|
2931
|
-
return
|
|
2984
|
+
return IncidentKeyClass(id=self.id)
|
|
2932
2985
|
|
|
2933
2986
|
@classmethod
|
|
2934
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2935
|
-
return cls(id=key_aspect.id
|
|
2987
|
+
def from_key_aspect(cls, key_aspect: "IncidentKeyClass") -> "IncidentUrn":
|
|
2988
|
+
return cls(id=key_aspect.id)
|
|
2936
2989
|
|
|
2937
2990
|
@property
|
|
2938
2991
|
def id(self) -> str:
|
|
2939
|
-
return self.
|
|
2940
|
-
|
|
2941
|
-
@property
|
|
2942
|
-
def entity_type(self) -> str:
|
|
2943
|
-
return self.entity_ids[1]
|
|
2992
|
+
return self._entity_ids[0]
|
|
2944
2993
|
|
|
2945
2994
|
if TYPE_CHECKING:
|
|
2946
|
-
from datahub.metadata.schema_classes import
|
|
2995
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
2947
2996
|
|
|
2948
|
-
class
|
|
2949
|
-
ENTITY_TYPE: ClassVar[
|
|
2950
|
-
_URN_PARTS: ClassVar[int] =
|
|
2997
|
+
class DataPlatformInstanceUrn(_SpecificUrn):
|
|
2998
|
+
ENTITY_TYPE: ClassVar[Literal["dataPlatformInstance"]] = "dataPlatformInstance"
|
|
2999
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
2951
3000
|
|
|
2952
|
-
def __init__(self,
|
|
3001
|
+
def __init__(self, platform: Union["DataPlatformUrn", str], instance: str, *, _allow_coercion: bool = True) -> None:
|
|
2953
3002
|
if _allow_coercion:
|
|
2954
3003
|
# Field coercion logic (if any is required).
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
try:
|
|
2958
|
-
id = DataHubAccessTokenUrn.from_string(id)
|
|
2959
|
-
except InvalidUrnError:
|
|
2960
|
-
raise InvalidUrnError(f'Expecting a DataHubAccessTokenUrn but got {id}')
|
|
2961
|
-
else:
|
|
2962
|
-
id = UrnEncoder.encode_string(id)
|
|
3004
|
+
platform = DataPlatformUrn(platform).urn()
|
|
3005
|
+
instance = UrnEncoder.encode_string(instance)
|
|
2963
3006
|
|
|
2964
3007
|
# Validation logic.
|
|
2965
|
-
if not
|
|
2966
|
-
raise InvalidUrnError("
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
raise InvalidUrnError(
|
|
2971
|
-
if UrnEncoder.contains_reserved_char(
|
|
2972
|
-
raise InvalidUrnError(f'
|
|
3008
|
+
if not platform:
|
|
3009
|
+
raise InvalidUrnError("DataPlatformInstanceUrn platform cannot be empty")
|
|
3010
|
+
platform = str(platform) # convert urn type to str
|
|
3011
|
+
assert DataPlatformUrn.from_string(platform)
|
|
3012
|
+
if not instance:
|
|
3013
|
+
raise InvalidUrnError("DataPlatformInstanceUrn instance cannot be empty")
|
|
3014
|
+
if UrnEncoder.contains_reserved_char(instance):
|
|
3015
|
+
raise InvalidUrnError(f'DataPlatformInstanceUrn instance contains reserved characters')
|
|
2973
3016
|
|
|
2974
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
3017
|
+
super().__init__(self.ENTITY_TYPE, [platform, instance])
|
|
2975
3018
|
|
|
2976
3019
|
@classmethod
|
|
2977
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3020
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataPlatformInstanceUrn":
|
|
2978
3021
|
if len(entity_ids) != cls._URN_PARTS:
|
|
2979
|
-
raise InvalidUrnError(f"
|
|
2980
|
-
return cls(
|
|
3022
|
+
raise InvalidUrnError(f"DataPlatformInstanceUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3023
|
+
return cls(platform=entity_ids[0], instance=entity_ids[1], _allow_coercion=False)
|
|
2981
3024
|
|
|
2982
3025
|
@classmethod
|
|
2983
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2984
|
-
from datahub.metadata.schema_classes import
|
|
3026
|
+
def underlying_key_aspect_type(cls) -> Type["DataPlatformInstanceKeyClass"]:
|
|
3027
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
2985
3028
|
|
|
2986
|
-
return
|
|
3029
|
+
return DataPlatformInstanceKeyClass
|
|
2987
3030
|
|
|
2988
|
-
def to_key_aspect(self) -> "
|
|
2989
|
-
from datahub.metadata.schema_classes import
|
|
3031
|
+
def to_key_aspect(self) -> "DataPlatformInstanceKeyClass":
|
|
3032
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
2990
3033
|
|
|
2991
|
-
return
|
|
3034
|
+
return DataPlatformInstanceKeyClass(platform=self.platform, instance=self.instance)
|
|
2992
3035
|
|
|
2993
3036
|
@classmethod
|
|
2994
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2995
|
-
return cls(
|
|
3037
|
+
def from_key_aspect(cls, key_aspect: "DataPlatformInstanceKeyClass") -> "DataPlatformInstanceUrn":
|
|
3038
|
+
return cls(platform=key_aspect.platform, instance=key_aspect.instance)
|
|
2996
3039
|
|
|
2997
3040
|
@property
|
|
2998
|
-
def
|
|
2999
|
-
return self.
|
|
3041
|
+
def platform(self) -> str:
|
|
3042
|
+
return self._entity_ids[0]
|
|
3043
|
+
|
|
3044
|
+
@property
|
|
3045
|
+
def instance(self) -> str:
|
|
3046
|
+
return self._entity_ids[1]
|
|
3000
3047
|
|
|
3001
3048
|
if TYPE_CHECKING:
|
|
3002
|
-
from datahub.metadata.schema_classes import
|
|
3049
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
3003
3050
|
|
|
3004
|
-
class
|
|
3005
|
-
ENTITY_TYPE: ClassVar[
|
|
3051
|
+
class TestUrn(_SpecificUrn):
|
|
3052
|
+
ENTITY_TYPE: ClassVar[Literal["test"]] = "test"
|
|
3006
3053
|
_URN_PARTS: ClassVar[int] = 1
|
|
3007
3054
|
|
|
3008
|
-
def __init__(self, id: Union["
|
|
3055
|
+
def __init__(self, id: Union["TestUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
3009
3056
|
if _allow_coercion:
|
|
3010
3057
|
# Field coercion logic (if any is required).
|
|
3011
3058
|
if isinstance(id, str):
|
|
3012
3059
|
if id.startswith('urn:li:'):
|
|
3013
3060
|
try:
|
|
3014
|
-
id =
|
|
3061
|
+
id = TestUrn.from_string(id)
|
|
3015
3062
|
except InvalidUrnError:
|
|
3016
|
-
raise InvalidUrnError(f'Expecting a
|
|
3063
|
+
raise InvalidUrnError(f'Expecting a TestUrn but got {id}')
|
|
3017
3064
|
else:
|
|
3018
3065
|
id = UrnEncoder.encode_string(id)
|
|
3019
3066
|
|
|
3020
3067
|
# Validation logic.
|
|
3021
3068
|
if not id:
|
|
3022
|
-
raise InvalidUrnError("
|
|
3023
|
-
if isinstance(id,
|
|
3069
|
+
raise InvalidUrnError("TestUrn id cannot be empty")
|
|
3070
|
+
if isinstance(id, TestUrn):
|
|
3024
3071
|
id = id.id
|
|
3025
3072
|
elif isinstance(id, Urn):
|
|
3026
|
-
raise InvalidUrnError(f'Expecting a
|
|
3073
|
+
raise InvalidUrnError(f'Expecting a TestUrn but got {id}')
|
|
3027
3074
|
if UrnEncoder.contains_reserved_char(id):
|
|
3028
|
-
raise InvalidUrnError(f'
|
|
3075
|
+
raise InvalidUrnError(f'TestUrn id contains reserved characters')
|
|
3029
3076
|
|
|
3030
3077
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
3031
3078
|
|
|
3032
3079
|
@classmethod
|
|
3033
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3080
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TestUrn":
|
|
3034
3081
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3035
|
-
raise InvalidUrnError(f"
|
|
3082
|
+
raise InvalidUrnError(f"TestUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3036
3083
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
3037
3084
|
|
|
3038
3085
|
@classmethod
|
|
3039
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3040
|
-
from datahub.metadata.schema_classes import
|
|
3086
|
+
def underlying_key_aspect_type(cls) -> Type["TestKeyClass"]:
|
|
3087
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
3041
3088
|
|
|
3042
|
-
return
|
|
3089
|
+
return TestKeyClass
|
|
3043
3090
|
|
|
3044
|
-
def to_key_aspect(self) -> "
|
|
3045
|
-
from datahub.metadata.schema_classes import
|
|
3091
|
+
def to_key_aspect(self) -> "TestKeyClass":
|
|
3092
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
3046
3093
|
|
|
3047
|
-
return
|
|
3094
|
+
return TestKeyClass(id=self.id)
|
|
3048
3095
|
|
|
3049
3096
|
@classmethod
|
|
3050
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3097
|
+
def from_key_aspect(cls, key_aspect: "TestKeyClass") -> "TestUrn":
|
|
3051
3098
|
return cls(id=key_aspect.id)
|
|
3052
3099
|
|
|
3053
|
-
@classmethod
|
|
3054
|
-
@deprecated(reason="Use the constructor instead")
|
|
3055
|
-
def create_from_id(cls, id: str) -> "DataProcessInstanceUrn":
|
|
3056
|
-
return cls(id)
|
|
3057
|
-
|
|
3058
|
-
@deprecated(reason="Use .id instead")
|
|
3059
|
-
def get_dataprocessinstance_id(self) -> str:
|
|
3060
|
-
return self.id
|
|
3061
|
-
|
|
3062
3100
|
@property
|
|
3063
3101
|
def id(self) -> str:
|
|
3064
|
-
return self.
|
|
3102
|
+
return self._entity_ids[0]
|
|
3065
3103
|
|
|
3066
3104
|
if TYPE_CHECKING:
|
|
3067
|
-
from datahub.metadata.schema_classes import
|
|
3105
|
+
from datahub.metadata.schema_classes import VersionSetKeyClass
|
|
3068
3106
|
|
|
3069
|
-
class
|
|
3070
|
-
ENTITY_TYPE: ClassVar[
|
|
3071
|
-
_URN_PARTS: ClassVar[int] =
|
|
3107
|
+
class VersionSetUrn(_SpecificUrn):
|
|
3108
|
+
ENTITY_TYPE: ClassVar[Literal["versionSet"]] = "versionSet"
|
|
3109
|
+
_URN_PARTS: ClassVar[int] = 2
|
|
3072
3110
|
|
|
3073
|
-
def __init__(self,
|
|
3111
|
+
def __init__(self, id: str, entity_type: str, *, _allow_coercion: bool = True) -> None:
|
|
3074
3112
|
if _allow_coercion:
|
|
3075
3113
|
# Field coercion logic (if any is required).
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
try:
|
|
3079
|
-
name = CorpGroupUrn.from_string(name)
|
|
3080
|
-
except InvalidUrnError:
|
|
3081
|
-
raise InvalidUrnError(f'Expecting a CorpGroupUrn but got {name}')
|
|
3082
|
-
else:
|
|
3083
|
-
name = UrnEncoder.encode_string(name)
|
|
3114
|
+
id = UrnEncoder.encode_string(id)
|
|
3115
|
+
entity_type = UrnEncoder.encode_string(entity_type)
|
|
3084
3116
|
|
|
3085
3117
|
# Validation logic.
|
|
3086
|
-
if not
|
|
3087
|
-
raise InvalidUrnError("
|
|
3088
|
-
if
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
raise InvalidUrnError(
|
|
3092
|
-
if UrnEncoder.contains_reserved_char(
|
|
3093
|
-
raise InvalidUrnError(f'
|
|
3118
|
+
if not id:
|
|
3119
|
+
raise InvalidUrnError("VersionSetUrn id cannot be empty")
|
|
3120
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
3121
|
+
raise InvalidUrnError(f'VersionSetUrn id contains reserved characters')
|
|
3122
|
+
if not entity_type:
|
|
3123
|
+
raise InvalidUrnError("VersionSetUrn entity_type cannot be empty")
|
|
3124
|
+
if UrnEncoder.contains_reserved_char(entity_type):
|
|
3125
|
+
raise InvalidUrnError(f'VersionSetUrn entity_type contains reserved characters')
|
|
3094
3126
|
|
|
3095
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
3127
|
+
super().__init__(self.ENTITY_TYPE, [id, entity_type])
|
|
3096
3128
|
|
|
3097
3129
|
@classmethod
|
|
3098
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3130
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "VersionSetUrn":
|
|
3099
3131
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3100
|
-
raise InvalidUrnError(f"
|
|
3101
|
-
return cls(
|
|
3132
|
+
raise InvalidUrnError(f"VersionSetUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3133
|
+
return cls(id=entity_ids[0], entity_type=entity_ids[1], _allow_coercion=False)
|
|
3102
3134
|
|
|
3103
3135
|
@classmethod
|
|
3104
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3105
|
-
from datahub.metadata.schema_classes import
|
|
3136
|
+
def underlying_key_aspect_type(cls) -> Type["VersionSetKeyClass"]:
|
|
3137
|
+
from datahub.metadata.schema_classes import VersionSetKeyClass
|
|
3106
3138
|
|
|
3107
|
-
return
|
|
3139
|
+
return VersionSetKeyClass
|
|
3108
3140
|
|
|
3109
|
-
def to_key_aspect(self) -> "
|
|
3110
|
-
from datahub.metadata.schema_classes import
|
|
3141
|
+
def to_key_aspect(self) -> "VersionSetKeyClass":
|
|
3142
|
+
from datahub.metadata.schema_classes import VersionSetKeyClass
|
|
3111
3143
|
|
|
3112
|
-
return
|
|
3144
|
+
return VersionSetKeyClass(id=self.id, entityType=self.entity_type)
|
|
3113
3145
|
|
|
3114
3146
|
@classmethod
|
|
3115
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3116
|
-
return cls(
|
|
3147
|
+
def from_key_aspect(cls, key_aspect: "VersionSetKeyClass") -> "VersionSetUrn":
|
|
3148
|
+
return cls(id=key_aspect.id, entity_type=key_aspect.entityType)
|
|
3117
3149
|
|
|
3118
|
-
@
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
return cls(id)
|
|
3150
|
+
@property
|
|
3151
|
+
def id(self) -> str:
|
|
3152
|
+
return self._entity_ids[0]
|
|
3122
3153
|
|
|
3123
3154
|
@property
|
|
3124
|
-
def
|
|
3125
|
-
return self.
|
|
3155
|
+
def entity_type(self) -> str:
|
|
3156
|
+
return self._entity_ids[1]
|
|
3126
3157
|
|
|
3127
3158
|
if TYPE_CHECKING:
|
|
3128
|
-
from datahub.metadata.schema_classes import
|
|
3159
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
3129
3160
|
|
|
3130
|
-
class
|
|
3131
|
-
ENTITY_TYPE: ClassVar[
|
|
3132
|
-
_URN_PARTS: ClassVar[int] =
|
|
3161
|
+
class DataHubSecretUrn(_SpecificUrn):
|
|
3162
|
+
ENTITY_TYPE: ClassVar[Literal["dataHubSecret"]] = "dataHubSecret"
|
|
3163
|
+
_URN_PARTS: ClassVar[int] = 1
|
|
3133
3164
|
|
|
3134
|
-
def __init__(self,
|
|
3165
|
+
def __init__(self, id: Union["DataHubSecretUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
3135
3166
|
if _allow_coercion:
|
|
3136
3167
|
# Field coercion logic (if any is required).
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3168
|
+
if isinstance(id, str):
|
|
3169
|
+
if id.startswith('urn:li:'):
|
|
3170
|
+
try:
|
|
3171
|
+
id = DataHubSecretUrn.from_string(id)
|
|
3172
|
+
except InvalidUrnError:
|
|
3173
|
+
raise InvalidUrnError(f'Expecting a DataHubSecretUrn but got {id}')
|
|
3174
|
+
else:
|
|
3175
|
+
id = UrnEncoder.encode_string(id)
|
|
3140
3176
|
|
|
3141
3177
|
# Validation logic.
|
|
3142
|
-
if not
|
|
3143
|
-
raise InvalidUrnError("
|
|
3144
|
-
if
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
raise InvalidUrnError(
|
|
3148
|
-
if UrnEncoder.contains_reserved_char(
|
|
3149
|
-
raise InvalidUrnError(f'
|
|
3150
|
-
if not env:
|
|
3151
|
-
raise InvalidUrnError("DataProcessUrn env cannot be empty")
|
|
3152
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
3153
|
-
raise InvalidUrnError(f'DataProcessUrn env contains reserved characters')
|
|
3178
|
+
if not id:
|
|
3179
|
+
raise InvalidUrnError("DataHubSecretUrn id cannot be empty")
|
|
3180
|
+
if isinstance(id, DataHubSecretUrn):
|
|
3181
|
+
id = id.id
|
|
3182
|
+
elif isinstance(id, Urn):
|
|
3183
|
+
raise InvalidUrnError(f'Expecting a DataHubSecretUrn but got {id}')
|
|
3184
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
3185
|
+
raise InvalidUrnError(f'DataHubSecretUrn id contains reserved characters')
|
|
3154
3186
|
|
|
3155
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
3187
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
3156
3188
|
|
|
3157
3189
|
@classmethod
|
|
3158
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3190
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubSecretUrn":
|
|
3159
3191
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3160
|
-
raise InvalidUrnError(f"
|
|
3161
|
-
return cls(
|
|
3192
|
+
raise InvalidUrnError(f"DataHubSecretUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3193
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
3162
3194
|
|
|
3163
3195
|
@classmethod
|
|
3164
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3165
|
-
from datahub.metadata.schema_classes import
|
|
3196
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubSecretKeyClass"]:
|
|
3197
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
3166
3198
|
|
|
3167
|
-
return
|
|
3199
|
+
return DataHubSecretKeyClass
|
|
3168
3200
|
|
|
3169
|
-
def to_key_aspect(self) -> "
|
|
3170
|
-
from datahub.metadata.schema_classes import
|
|
3201
|
+
def to_key_aspect(self) -> "DataHubSecretKeyClass":
|
|
3202
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
3171
3203
|
|
|
3172
|
-
return
|
|
3204
|
+
return DataHubSecretKeyClass(id=self.id)
|
|
3173
3205
|
|
|
3174
3206
|
@classmethod
|
|
3175
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3176
|
-
return cls(
|
|
3177
|
-
|
|
3178
|
-
@property
|
|
3179
|
-
def name(self) -> str:
|
|
3180
|
-
return self.entity_ids[0]
|
|
3181
|
-
|
|
3182
|
-
@property
|
|
3183
|
-
def orchestrator(self) -> str:
|
|
3184
|
-
return self.entity_ids[1]
|
|
3207
|
+
def from_key_aspect(cls, key_aspect: "DataHubSecretKeyClass") -> "DataHubSecretUrn":
|
|
3208
|
+
return cls(id=key_aspect.id)
|
|
3185
3209
|
|
|
3186
3210
|
@property
|
|
3187
|
-
def
|
|
3188
|
-
return self.
|
|
3211
|
+
def id(self) -> str:
|
|
3212
|
+
return self._entity_ids[0]
|
|
3189
3213
|
|
|
3190
3214
|
if TYPE_CHECKING:
|
|
3191
|
-
from datahub.metadata.schema_classes import
|
|
3215
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
3192
3216
|
|
|
3193
|
-
class
|
|
3194
|
-
ENTITY_TYPE: ClassVar[
|
|
3217
|
+
class EntityTypeUrn(_SpecificUrn):
|
|
3218
|
+
ENTITY_TYPE: ClassVar[Literal["entityType"]] = "entityType"
|
|
3195
3219
|
_URN_PARTS: ClassVar[int] = 1
|
|
3196
3220
|
|
|
3197
|
-
def __init__(self, id: Union["
|
|
3221
|
+
def __init__(self, id: Union["EntityTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
3198
3222
|
if _allow_coercion:
|
|
3199
3223
|
# Field coercion logic (if any is required).
|
|
3200
3224
|
if isinstance(id, str):
|
|
3201
3225
|
if id.startswith('urn:li:'):
|
|
3202
3226
|
try:
|
|
3203
|
-
id =
|
|
3227
|
+
id = EntityTypeUrn.from_string(id)
|
|
3204
3228
|
except InvalidUrnError:
|
|
3205
|
-
raise InvalidUrnError(f'Expecting a
|
|
3229
|
+
raise InvalidUrnError(f'Expecting a EntityTypeUrn but got {id}')
|
|
3206
3230
|
else:
|
|
3207
3231
|
id = UrnEncoder.encode_string(id)
|
|
3208
3232
|
|
|
3209
3233
|
# Validation logic.
|
|
3210
3234
|
if not id:
|
|
3211
|
-
raise InvalidUrnError("
|
|
3212
|
-
if isinstance(id,
|
|
3235
|
+
raise InvalidUrnError("EntityTypeUrn id cannot be empty")
|
|
3236
|
+
if isinstance(id, EntityTypeUrn):
|
|
3213
3237
|
id = id.id
|
|
3214
3238
|
elif isinstance(id, Urn):
|
|
3215
|
-
raise InvalidUrnError(f'Expecting a
|
|
3239
|
+
raise InvalidUrnError(f'Expecting a EntityTypeUrn but got {id}')
|
|
3216
3240
|
if UrnEncoder.contains_reserved_char(id):
|
|
3217
|
-
raise InvalidUrnError(f'
|
|
3241
|
+
raise InvalidUrnError(f'EntityTypeUrn id contains reserved characters')
|
|
3218
3242
|
|
|
3219
3243
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
3220
3244
|
|
|
3221
3245
|
@classmethod
|
|
3222
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3246
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "EntityTypeUrn":
|
|
3223
3247
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3224
|
-
raise InvalidUrnError(f"
|
|
3248
|
+
raise InvalidUrnError(f"EntityTypeUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3225
3249
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
3226
3250
|
|
|
3227
3251
|
@classmethod
|
|
3228
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3229
|
-
from datahub.metadata.schema_classes import
|
|
3252
|
+
def underlying_key_aspect_type(cls) -> Type["EntityTypeKeyClass"]:
|
|
3253
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
3230
3254
|
|
|
3231
|
-
return
|
|
3255
|
+
return EntityTypeKeyClass
|
|
3232
3256
|
|
|
3233
|
-
def to_key_aspect(self) -> "
|
|
3234
|
-
from datahub.metadata.schema_classes import
|
|
3257
|
+
def to_key_aspect(self) -> "EntityTypeKeyClass":
|
|
3258
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
3235
3259
|
|
|
3236
|
-
return
|
|
3260
|
+
return EntityTypeKeyClass(id=self.id)
|
|
3237
3261
|
|
|
3238
3262
|
@classmethod
|
|
3239
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3263
|
+
def from_key_aspect(cls, key_aspect: "EntityTypeKeyClass") -> "EntityTypeUrn":
|
|
3240
3264
|
return cls(id=key_aspect.id)
|
|
3241
3265
|
|
|
3242
3266
|
@property
|
|
3243
3267
|
def id(self) -> str:
|
|
3244
|
-
return self.
|
|
3268
|
+
return self._entity_ids[0]
|
|
3245
3269
|
|
|
3246
3270
|
if TYPE_CHECKING:
|
|
3247
|
-
from datahub.metadata.schema_classes import
|
|
3271
|
+
from datahub.metadata.schema_classes import StructuredPropertyKeyClass
|
|
3248
3272
|
|
|
3249
|
-
class
|
|
3250
|
-
ENTITY_TYPE: ClassVar[
|
|
3273
|
+
class StructuredPropertyUrn(_SpecificUrn):
|
|
3274
|
+
ENTITY_TYPE: ClassVar[Literal["structuredProperty"]] = "structuredProperty"
|
|
3251
3275
|
_URN_PARTS: ClassVar[int] = 1
|
|
3252
3276
|
|
|
3253
|
-
def __init__(self, id: Union["
|
|
3277
|
+
def __init__(self, id: Union["StructuredPropertyUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
3254
3278
|
if _allow_coercion:
|
|
3255
3279
|
# Field coercion logic (if any is required).
|
|
3256
3280
|
if isinstance(id, str):
|
|
3257
3281
|
if id.startswith('urn:li:'):
|
|
3258
3282
|
try:
|
|
3259
|
-
id =
|
|
3283
|
+
id = StructuredPropertyUrn.from_string(id)
|
|
3260
3284
|
except InvalidUrnError:
|
|
3261
|
-
raise InvalidUrnError(f'Expecting a
|
|
3285
|
+
raise InvalidUrnError(f'Expecting a StructuredPropertyUrn but got {id}')
|
|
3262
3286
|
else:
|
|
3263
3287
|
id = UrnEncoder.encode_string(id)
|
|
3264
3288
|
|
|
3265
3289
|
# Validation logic.
|
|
3266
3290
|
if not id:
|
|
3267
|
-
raise InvalidUrnError("
|
|
3268
|
-
if isinstance(id,
|
|
3291
|
+
raise InvalidUrnError("StructuredPropertyUrn id cannot be empty")
|
|
3292
|
+
if isinstance(id, StructuredPropertyUrn):
|
|
3269
3293
|
id = id.id
|
|
3270
3294
|
elif isinstance(id, Urn):
|
|
3271
|
-
raise InvalidUrnError(f'Expecting a
|
|
3295
|
+
raise InvalidUrnError(f'Expecting a StructuredPropertyUrn but got {id}')
|
|
3272
3296
|
if UrnEncoder.contains_reserved_char(id):
|
|
3273
|
-
raise InvalidUrnError(f'
|
|
3297
|
+
raise InvalidUrnError(f'StructuredPropertyUrn id contains reserved characters')
|
|
3274
3298
|
|
|
3275
3299
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
3276
3300
|
|
|
3277
3301
|
@classmethod
|
|
3278
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3302
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "StructuredPropertyUrn":
|
|
3279
3303
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3280
|
-
raise InvalidUrnError(f"
|
|
3304
|
+
raise InvalidUrnError(f"StructuredPropertyUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3281
3305
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
3282
3306
|
|
|
3283
3307
|
@classmethod
|
|
3284
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3285
|
-
from datahub.metadata.schema_classes import
|
|
3308
|
+
def underlying_key_aspect_type(cls) -> Type["StructuredPropertyKeyClass"]:
|
|
3309
|
+
from datahub.metadata.schema_classes import StructuredPropertyKeyClass
|
|
3286
3310
|
|
|
3287
|
-
return
|
|
3311
|
+
return StructuredPropertyKeyClass
|
|
3288
3312
|
|
|
3289
|
-
def to_key_aspect(self) -> "
|
|
3290
|
-
from datahub.metadata.schema_classes import
|
|
3313
|
+
def to_key_aspect(self) -> "StructuredPropertyKeyClass":
|
|
3314
|
+
from datahub.metadata.schema_classes import StructuredPropertyKeyClass
|
|
3291
3315
|
|
|
3292
|
-
return
|
|
3316
|
+
return StructuredPropertyKeyClass(id=self.id)
|
|
3293
3317
|
|
|
3294
3318
|
@classmethod
|
|
3295
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3319
|
+
def from_key_aspect(cls, key_aspect: "StructuredPropertyKeyClass") -> "StructuredPropertyUrn":
|
|
3296
3320
|
return cls(id=key_aspect.id)
|
|
3297
3321
|
|
|
3298
3322
|
@property
|
|
3299
3323
|
def id(self) -> str:
|
|
3300
|
-
return self.
|
|
3324
|
+
return self._entity_ids[0]
|
|
3301
3325
|
|
|
3302
3326
|
if TYPE_CHECKING:
|
|
3303
|
-
from datahub.metadata.schema_classes import
|
|
3327
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
3304
3328
|
|
|
3305
|
-
class
|
|
3306
|
-
ENTITY_TYPE: ClassVar[
|
|
3329
|
+
class PlatformResourceUrn(_SpecificUrn):
|
|
3330
|
+
ENTITY_TYPE: ClassVar[Literal["platformResource"]] = "platformResource"
|
|
3307
3331
|
_URN_PARTS: ClassVar[int] = 1
|
|
3308
3332
|
|
|
3309
|
-
def __init__(self, id: Union["
|
|
3333
|
+
def __init__(self, id: Union["PlatformResourceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
3310
3334
|
if _allow_coercion:
|
|
3311
3335
|
# Field coercion logic (if any is required).
|
|
3312
3336
|
if isinstance(id, str):
|
|
3313
3337
|
if id.startswith('urn:li:'):
|
|
3314
3338
|
try:
|
|
3315
|
-
id =
|
|
3339
|
+
id = PlatformResourceUrn.from_string(id)
|
|
3316
3340
|
except InvalidUrnError:
|
|
3317
|
-
raise InvalidUrnError(f'Expecting a
|
|
3341
|
+
raise InvalidUrnError(f'Expecting a PlatformResourceUrn but got {id}')
|
|
3318
3342
|
else:
|
|
3319
3343
|
id = UrnEncoder.encode_string(id)
|
|
3320
3344
|
|
|
3321
3345
|
# Validation logic.
|
|
3322
3346
|
if not id:
|
|
3323
|
-
raise InvalidUrnError("
|
|
3324
|
-
if isinstance(id,
|
|
3347
|
+
raise InvalidUrnError("PlatformResourceUrn id cannot be empty")
|
|
3348
|
+
if isinstance(id, PlatformResourceUrn):
|
|
3325
3349
|
id = id.id
|
|
3326
3350
|
elif isinstance(id, Urn):
|
|
3327
|
-
raise InvalidUrnError(f'Expecting a
|
|
3351
|
+
raise InvalidUrnError(f'Expecting a PlatformResourceUrn but got {id}')
|
|
3328
3352
|
if UrnEncoder.contains_reserved_char(id):
|
|
3329
|
-
raise InvalidUrnError(f'
|
|
3353
|
+
raise InvalidUrnError(f'PlatformResourceUrn id contains reserved characters')
|
|
3330
3354
|
|
|
3331
3355
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
3332
3356
|
|
|
3333
3357
|
@classmethod
|
|
3334
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
3358
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "PlatformResourceUrn":
|
|
3335
3359
|
if len(entity_ids) != cls._URN_PARTS:
|
|
3336
|
-
raise InvalidUrnError(f"
|
|
3360
|
+
raise InvalidUrnError(f"PlatformResourceUrn should have {cls._URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
3337
3361
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
3338
3362
|
|
|
3339
3363
|
@classmethod
|
|
3340
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
3341
|
-
from datahub.metadata.schema_classes import
|
|
3364
|
+
def underlying_key_aspect_type(cls) -> Type["PlatformResourceKeyClass"]:
|
|
3365
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
3342
3366
|
|
|
3343
|
-
return
|
|
3367
|
+
return PlatformResourceKeyClass
|
|
3344
3368
|
|
|
3345
|
-
def to_key_aspect(self) -> "
|
|
3346
|
-
from datahub.metadata.schema_classes import
|
|
3369
|
+
def to_key_aspect(self) -> "PlatformResourceKeyClass":
|
|
3370
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
3347
3371
|
|
|
3348
|
-
return
|
|
3372
|
+
return PlatformResourceKeyClass(id=self.id)
|
|
3349
3373
|
|
|
3350
3374
|
@classmethod
|
|
3351
|
-
def from_key_aspect(cls, key_aspect: "
|
|
3375
|
+
def from_key_aspect(cls, key_aspect: "PlatformResourceKeyClass") -> "PlatformResourceUrn":
|
|
3352
3376
|
return cls(id=key_aspect.id)
|
|
3353
3377
|
|
|
3354
3378
|
@property
|
|
3355
3379
|
def id(self) -> str:
|
|
3356
|
-
return self.
|
|
3380
|
+
return self._entity_ids[0]
|
|
3357
3381
|
|
|
3358
3382
|
# fmt: on
|