acryl-datahub 0.14.1.13rc9__py3-none-any.whl → 0.15.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.14.1.13rc9.dist-info → acryl_datahub-0.15.0.dist-info}/METADATA +2348 -2298
- {acryl_datahub-0.14.1.13rc9.dist-info → acryl_datahub-0.15.0.dist-info}/RECORD +130 -125
- {acryl_datahub-0.14.1.13rc9.dist-info → acryl_datahub-0.15.0.dist-info}/entry_points.txt +2 -1
- datahub/__init__.py +1 -1
- datahub/api/entities/structuredproperties/structuredproperties.py +123 -146
- datahub/cli/cli_utils.py +2 -0
- datahub/cli/delete_cli.py +103 -24
- datahub/cli/ingest_cli.py +110 -0
- datahub/cli/put_cli.py +1 -1
- datahub/cli/specific/dataproduct_cli.py +1 -1
- datahub/cli/specific/structuredproperties_cli.py +2 -1
- datahub/configuration/common.py +3 -3
- datahub/configuration/git.py +7 -1
- datahub/configuration/kafka_consumer_config.py +31 -1
- datahub/emitter/mcp_patch_builder.py +43 -0
- datahub/emitter/rest_emitter.py +17 -4
- datahub/ingestion/api/incremental_properties_helper.py +69 -0
- datahub/ingestion/api/source.py +6 -1
- datahub/ingestion/api/source_helpers.py +4 -2
- datahub/ingestion/graph/client.py +2 -0
- datahub/ingestion/reporting/datahub_ingestion_run_summary_provider.py +2 -2
- datahub/ingestion/run/pipeline.py +6 -5
- datahub/ingestion/run/pipeline_config.py +6 -0
- datahub/ingestion/sink/datahub_rest.py +15 -4
- datahub/ingestion/source/abs/source.py +4 -0
- datahub/ingestion/source/aws/aws_common.py +13 -1
- datahub/ingestion/source/aws/sagemaker.py +8 -0
- datahub/ingestion/source/aws/sagemaker_processors/common.py +6 -0
- datahub/ingestion/source/aws/sagemaker_processors/feature_groups.py +9 -4
- datahub/ingestion/source/aws/sagemaker_processors/jobs.py +12 -1
- datahub/ingestion/source/aws/sagemaker_processors/lineage.py +11 -4
- datahub/ingestion/source/aws/sagemaker_processors/models.py +30 -1
- datahub/ingestion/source/bigquery_v2/bigquery_audit.py +1 -1
- datahub/ingestion/source/common/subtypes.py +2 -0
- datahub/ingestion/source/csv_enricher.py +1 -1
- datahub/ingestion/source/datahub/datahub_database_reader.py +41 -21
- datahub/ingestion/source/datahub/datahub_source.py +8 -1
- datahub/ingestion/source/dbt/dbt_common.py +7 -61
- datahub/ingestion/source/dremio/dremio_api.py +204 -86
- datahub/ingestion/source/dremio/dremio_aspects.py +19 -15
- datahub/ingestion/source/dremio/dremio_config.py +5 -0
- datahub/ingestion/source/dremio/dremio_datahub_source_mapping.py +2 -0
- datahub/ingestion/source/dremio/dremio_entities.py +4 -0
- datahub/ingestion/source/dremio/dremio_reporting.py +15 -0
- datahub/ingestion/source/dremio/dremio_source.py +7 -2
- datahub/ingestion/source/elastic_search.py +1 -1
- datahub/ingestion/source/feast.py +97 -6
- datahub/ingestion/source/gc/datahub_gc.py +46 -35
- datahub/ingestion/source/gc/dataprocess_cleanup.py +110 -50
- datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py +7 -2
- datahub/ingestion/source/ge_data_profiler.py +23 -1
- datahub/ingestion/source/iceberg/iceberg.py +12 -5
- datahub/ingestion/source/kafka/kafka.py +39 -19
- datahub/ingestion/source/kafka/kafka_connect.py +81 -51
- datahub/ingestion/source/looker/looker_liquid_tag.py +8 -1
- datahub/ingestion/source/looker/lookml_concept_context.py +1 -2
- datahub/ingestion/source/looker/view_upstream.py +65 -30
- datahub/ingestion/source/metadata/business_glossary.py +35 -18
- datahub/ingestion/source/mode.py +0 -23
- datahub/ingestion/source/neo4j/__init__.py +0 -0
- datahub/ingestion/source/neo4j/neo4j_source.py +331 -0
- datahub/ingestion/source/powerbi/__init__.py +0 -1
- datahub/ingestion/source/powerbi/config.py +3 -3
- datahub/ingestion/source/powerbi/m_query/data_classes.py +36 -15
- datahub/ingestion/source/powerbi/m_query/parser.py +6 -3
- datahub/ingestion/source/powerbi/m_query/pattern_handler.py +912 -0
- datahub/ingestion/source/powerbi/m_query/resolver.py +23 -947
- datahub/ingestion/source/powerbi/m_query/tree_function.py +3 -3
- datahub/ingestion/source/powerbi/m_query/validator.py +9 -3
- datahub/ingestion/source/powerbi/powerbi.py +12 -6
- datahub/ingestion/source/preset.py +1 -0
- datahub/ingestion/source/pulsar.py +21 -2
- datahub/ingestion/source/qlik_sense/data_classes.py +1 -0
- datahub/ingestion/source/redash.py +13 -63
- datahub/ingestion/source/redshift/config.py +1 -0
- datahub/ingestion/source/redshift/redshift.py +3 -0
- datahub/ingestion/source/s3/source.py +2 -3
- datahub/ingestion/source/snowflake/snowflake_config.py +8 -3
- datahub/ingestion/source/snowflake/snowflake_connection.py +28 -0
- datahub/ingestion/source/snowflake/snowflake_lineage_v2.py +6 -1
- datahub/ingestion/source/snowflake/snowflake_query.py +21 -4
- datahub/ingestion/source/snowflake/snowflake_report.py +1 -0
- datahub/ingestion/source/snowflake/snowflake_schema.py +28 -0
- datahub/ingestion/source/snowflake/snowflake_schema_gen.py +41 -2
- datahub/ingestion/source/snowflake/snowflake_utils.py +46 -6
- datahub/ingestion/source/snowflake/snowflake_v2.py +6 -0
- datahub/ingestion/source/sql/athena.py +46 -22
- datahub/ingestion/source/sql/mssql/source.py +0 -2
- datahub/ingestion/source/sql/sql_common.py +34 -21
- datahub/ingestion/source/sql/sql_report.py +1 -0
- datahub/ingestion/source/sql/sql_types.py +85 -8
- datahub/ingestion/source/state/redundant_run_skip_handler.py +1 -1
- datahub/ingestion/source/superset.py +215 -65
- datahub/ingestion/source/tableau/tableau.py +237 -76
- datahub/ingestion/source/tableau/tableau_common.py +12 -6
- datahub/ingestion/source/tableau/tableau_constant.py +2 -0
- datahub/ingestion/source/tableau/tableau_server_wrapper.py +33 -0
- datahub/ingestion/source/tableau/tableau_validation.py +48 -0
- datahub/ingestion/source/unity/proxy_types.py +1 -0
- datahub/ingestion/source/unity/source.py +4 -0
- datahub/ingestion/source/unity/usage.py +20 -11
- datahub/ingestion/transformer/add_dataset_tags.py +1 -1
- datahub/ingestion/transformer/generic_aspect_transformer.py +1 -1
- datahub/integrations/assertion/common.py +1 -1
- datahub/lite/duckdb_lite.py +12 -17
- datahub/metadata/_schema_classes.py +512 -392
- datahub/metadata/_urns/urn_defs.py +1355 -1355
- datahub/metadata/com/linkedin/pegasus2avro/structured/__init__.py +2 -0
- datahub/metadata/schema.avsc +17222 -17499
- datahub/metadata/schemas/FormInfo.avsc +4 -0
- datahub/metadata/schemas/StructuredPropertyDefinition.avsc +1 -1
- datahub/metadata/schemas/StructuredPropertyKey.avsc +1 -0
- datahub/metadata/schemas/StructuredPropertySettings.avsc +114 -0
- datahub/specific/chart.py +0 -39
- datahub/specific/dashboard.py +0 -39
- datahub/specific/datajob.py +7 -57
- datahub/sql_parsing/schema_resolver.py +23 -0
- datahub/sql_parsing/sql_parsing_aggregator.py +1 -2
- datahub/sql_parsing/sqlglot_lineage.py +55 -14
- datahub/sql_parsing/sqlglot_utils.py +8 -2
- datahub/telemetry/telemetry.py +23 -9
- datahub/testing/compare_metadata_json.py +1 -1
- datahub/testing/doctest.py +12 -0
- datahub/utilities/file_backed_collections.py +35 -2
- datahub/utilities/partition_executor.py +1 -1
- datahub/utilities/urn_encoder.py +2 -1
- datahub/utilities/urns/_urn_base.py +1 -1
- datahub/utilities/urns/structured_properties_urn.py +1 -1
- datahub/utilities/sql_lineage_parser_impl.py +0 -160
- datahub/utilities/sql_parser.py +0 -94
- datahub/utilities/sql_parser_base.py +0 -21
- {acryl_datahub-0.14.1.13rc9.dist-info → acryl_datahub-0.15.0.dist-info}/WHEEL +0 -0
- {acryl_datahub-0.14.1.13rc9.dist-info → acryl_datahub-0.15.0.dist-info}/top_level.txt +0 -0
|
@@ -22,10 +22,10 @@ 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 StructuredPropertyKeyClass
|
|
26
26
|
|
|
27
|
-
class
|
|
28
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
27
|
+
class StructuredPropertyUrn(_SpecificUrn):
|
|
28
|
+
ENTITY_TYPE: ClassVar[str] = "structuredProperty"
|
|
29
29
|
URN_PARTS: ClassVar[int] = 1
|
|
30
30
|
|
|
31
31
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -35,31 +35,31 @@ class DataHubConnectionUrn(_SpecificUrn):
|
|
|
35
35
|
|
|
36
36
|
# Validation logic.
|
|
37
37
|
if not id:
|
|
38
|
-
raise InvalidUrnError("
|
|
38
|
+
raise InvalidUrnError("StructuredPropertyUrn id cannot be empty")
|
|
39
39
|
if UrnEncoder.contains_reserved_char(id):
|
|
40
|
-
raise InvalidUrnError(f'
|
|
40
|
+
raise InvalidUrnError(f'StructuredPropertyUrn id contains reserved characters')
|
|
41
41
|
|
|
42
42
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
43
43
|
|
|
44
44
|
@classmethod
|
|
45
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
45
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "StructuredPropertyUrn":
|
|
46
46
|
if len(entity_ids) != cls.URN_PARTS:
|
|
47
|
-
raise InvalidUrnError(f"
|
|
47
|
+
raise InvalidUrnError(f"StructuredPropertyUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
48
48
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
49
49
|
|
|
50
50
|
@classmethod
|
|
51
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
52
|
-
from datahub.metadata.schema_classes import
|
|
51
|
+
def underlying_key_aspect_type(cls) -> Type["StructuredPropertyKeyClass"]:
|
|
52
|
+
from datahub.metadata.schema_classes import StructuredPropertyKeyClass
|
|
53
53
|
|
|
54
|
-
return
|
|
54
|
+
return StructuredPropertyKeyClass
|
|
55
55
|
|
|
56
|
-
def to_key_aspect(self) -> "
|
|
57
|
-
from datahub.metadata.schema_classes import
|
|
56
|
+
def to_key_aspect(self) -> "StructuredPropertyKeyClass":
|
|
57
|
+
from datahub.metadata.schema_classes import StructuredPropertyKeyClass
|
|
58
58
|
|
|
59
|
-
return
|
|
59
|
+
return StructuredPropertyKeyClass(id=self.id)
|
|
60
60
|
|
|
61
61
|
@classmethod
|
|
62
|
-
def from_key_aspect(cls, key_aspect: "
|
|
62
|
+
def from_key_aspect(cls, key_aspect: "StructuredPropertyKeyClass") -> "StructuredPropertyUrn":
|
|
63
63
|
return cls(id=key_aspect.id)
|
|
64
64
|
|
|
65
65
|
@property
|
|
@@ -67,10 +67,10 @@ class DataHubConnectionUrn(_SpecificUrn):
|
|
|
67
67
|
return self.entity_ids[0]
|
|
68
68
|
|
|
69
69
|
if TYPE_CHECKING:
|
|
70
|
-
from datahub.metadata.schema_classes import
|
|
70
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
71
71
|
|
|
72
|
-
class
|
|
73
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
72
|
+
class DataTypeUrn(_SpecificUrn):
|
|
73
|
+
ENTITY_TYPE: ClassVar[str] = "dataType"
|
|
74
74
|
URN_PARTS: ClassVar[int] = 1
|
|
75
75
|
|
|
76
76
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -80,31 +80,31 @@ class DataHubRoleUrn(_SpecificUrn):
|
|
|
80
80
|
|
|
81
81
|
# Validation logic.
|
|
82
82
|
if not id:
|
|
83
|
-
raise InvalidUrnError("
|
|
83
|
+
raise InvalidUrnError("DataTypeUrn id cannot be empty")
|
|
84
84
|
if UrnEncoder.contains_reserved_char(id):
|
|
85
|
-
raise InvalidUrnError(f'
|
|
85
|
+
raise InvalidUrnError(f'DataTypeUrn id contains reserved characters')
|
|
86
86
|
|
|
87
87
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
88
88
|
|
|
89
89
|
@classmethod
|
|
90
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
90
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataTypeUrn":
|
|
91
91
|
if len(entity_ids) != cls.URN_PARTS:
|
|
92
|
-
raise InvalidUrnError(f"
|
|
92
|
+
raise InvalidUrnError(f"DataTypeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
93
93
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
94
94
|
|
|
95
95
|
@classmethod
|
|
96
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
97
|
-
from datahub.metadata.schema_classes import
|
|
96
|
+
def underlying_key_aspect_type(cls) -> Type["DataTypeKeyClass"]:
|
|
97
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
98
98
|
|
|
99
|
-
return
|
|
99
|
+
return DataTypeKeyClass
|
|
100
100
|
|
|
101
|
-
def to_key_aspect(self) -> "
|
|
102
|
-
from datahub.metadata.schema_classes import
|
|
101
|
+
def to_key_aspect(self) -> "DataTypeKeyClass":
|
|
102
|
+
from datahub.metadata.schema_classes import DataTypeKeyClass
|
|
103
103
|
|
|
104
|
-
return
|
|
104
|
+
return DataTypeKeyClass(id=self.id)
|
|
105
105
|
|
|
106
106
|
@classmethod
|
|
107
|
-
def from_key_aspect(cls, key_aspect: "
|
|
107
|
+
def from_key_aspect(cls, key_aspect: "DataTypeKeyClass") -> "DataTypeUrn":
|
|
108
108
|
return cls(id=key_aspect.id)
|
|
109
109
|
|
|
110
110
|
@property
|
|
@@ -112,55 +112,60 @@ class DataHubRoleUrn(_SpecificUrn):
|
|
|
112
112
|
return self.entity_ids[0]
|
|
113
113
|
|
|
114
114
|
if TYPE_CHECKING:
|
|
115
|
-
from datahub.metadata.schema_classes import
|
|
115
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
116
116
|
|
|
117
|
-
class
|
|
118
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
117
|
+
class CorpGroupUrn(_SpecificUrn):
|
|
118
|
+
ENTITY_TYPE: ClassVar[str] = "corpGroup"
|
|
119
119
|
URN_PARTS: ClassVar[int] = 1
|
|
120
120
|
|
|
121
|
-
def __init__(self,
|
|
121
|
+
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
122
122
|
if _allow_coercion:
|
|
123
123
|
# Field coercion logic (if any is required).
|
|
124
|
-
|
|
124
|
+
name = UrnEncoder.encode_string(name)
|
|
125
125
|
|
|
126
126
|
# Validation logic.
|
|
127
|
-
if not
|
|
128
|
-
raise InvalidUrnError("
|
|
129
|
-
if UrnEncoder.contains_reserved_char(
|
|
130
|
-
raise InvalidUrnError(f'
|
|
127
|
+
if not name:
|
|
128
|
+
raise InvalidUrnError("CorpGroupUrn name cannot be empty")
|
|
129
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
130
|
+
raise InvalidUrnError(f'CorpGroupUrn name contains reserved characters')
|
|
131
131
|
|
|
132
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
132
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
133
133
|
|
|
134
134
|
@classmethod
|
|
135
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
135
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "CorpGroupUrn":
|
|
136
136
|
if len(entity_ids) != cls.URN_PARTS:
|
|
137
|
-
raise InvalidUrnError(f"
|
|
138
|
-
return cls(
|
|
137
|
+
raise InvalidUrnError(f"CorpGroupUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
138
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
139
139
|
|
|
140
140
|
@classmethod
|
|
141
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
142
|
-
from datahub.metadata.schema_classes import
|
|
141
|
+
def underlying_key_aspect_type(cls) -> Type["CorpGroupKeyClass"]:
|
|
142
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
143
143
|
|
|
144
|
-
return
|
|
144
|
+
return CorpGroupKeyClass
|
|
145
145
|
|
|
146
|
-
def to_key_aspect(self) -> "
|
|
147
|
-
from datahub.metadata.schema_classes import
|
|
146
|
+
def to_key_aspect(self) -> "CorpGroupKeyClass":
|
|
147
|
+
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
148
148
|
|
|
149
|
-
return
|
|
149
|
+
return CorpGroupKeyClass(name=self.name)
|
|
150
150
|
|
|
151
151
|
@classmethod
|
|
152
|
-
def from_key_aspect(cls, key_aspect: "
|
|
153
|
-
return cls(
|
|
152
|
+
def from_key_aspect(cls, key_aspect: "CorpGroupKeyClass") -> "CorpGroupUrn":
|
|
153
|
+
return cls(name=key_aspect.name)
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
@deprecated(reason="Use the constructor instead")
|
|
157
|
+
def create_from_id(cls, id: str) -> "CorpGroupUrn":
|
|
158
|
+
return cls(id)
|
|
154
159
|
|
|
155
160
|
@property
|
|
156
|
-
def
|
|
161
|
+
def name(self) -> str:
|
|
157
162
|
return self.entity_ids[0]
|
|
158
163
|
|
|
159
164
|
if TYPE_CHECKING:
|
|
160
|
-
from datahub.metadata.schema_classes import
|
|
165
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
161
166
|
|
|
162
|
-
class
|
|
163
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
167
|
+
class GlobalSettingsUrn(_SpecificUrn):
|
|
168
|
+
ENTITY_TYPE: ClassVar[str] = "globalSettings"
|
|
164
169
|
URN_PARTS: ClassVar[int] = 1
|
|
165
170
|
|
|
166
171
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -170,31 +175,31 @@ class FormUrn(_SpecificUrn):
|
|
|
170
175
|
|
|
171
176
|
# Validation logic.
|
|
172
177
|
if not id:
|
|
173
|
-
raise InvalidUrnError("
|
|
178
|
+
raise InvalidUrnError("GlobalSettingsUrn id cannot be empty")
|
|
174
179
|
if UrnEncoder.contains_reserved_char(id):
|
|
175
|
-
raise InvalidUrnError(f'
|
|
180
|
+
raise InvalidUrnError(f'GlobalSettingsUrn id contains reserved characters')
|
|
176
181
|
|
|
177
182
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
178
183
|
|
|
179
184
|
@classmethod
|
|
180
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
185
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlobalSettingsUrn":
|
|
181
186
|
if len(entity_ids) != cls.URN_PARTS:
|
|
182
|
-
raise InvalidUrnError(f"
|
|
187
|
+
raise InvalidUrnError(f"GlobalSettingsUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
183
188
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
184
189
|
|
|
185
190
|
@classmethod
|
|
186
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
187
|
-
from datahub.metadata.schema_classes import
|
|
191
|
+
def underlying_key_aspect_type(cls) -> Type["GlobalSettingsKeyClass"]:
|
|
192
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
188
193
|
|
|
189
|
-
return
|
|
194
|
+
return GlobalSettingsKeyClass
|
|
190
195
|
|
|
191
|
-
def to_key_aspect(self) -> "
|
|
192
|
-
from datahub.metadata.schema_classes import
|
|
196
|
+
def to_key_aspect(self) -> "GlobalSettingsKeyClass":
|
|
197
|
+
from datahub.metadata.schema_classes import GlobalSettingsKeyClass
|
|
193
198
|
|
|
194
|
-
return
|
|
199
|
+
return GlobalSettingsKeyClass(id=self.id)
|
|
195
200
|
|
|
196
201
|
@classmethod
|
|
197
|
-
def from_key_aspect(cls, key_aspect: "
|
|
202
|
+
def from_key_aspect(cls, key_aspect: "GlobalSettingsKeyClass") -> "GlobalSettingsUrn":
|
|
198
203
|
return cls(id=key_aspect.id)
|
|
199
204
|
|
|
200
205
|
@property
|
|
@@ -202,171 +207,158 @@ class FormUrn(_SpecificUrn):
|
|
|
202
207
|
return self.entity_ids[0]
|
|
203
208
|
|
|
204
209
|
if TYPE_CHECKING:
|
|
205
|
-
from datahub.metadata.schema_classes import
|
|
210
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
206
211
|
|
|
207
|
-
class
|
|
208
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
212
|
+
class SchemaFieldUrn(_SpecificUrn):
|
|
213
|
+
ENTITY_TYPE: ClassVar[str] = "schemaField"
|
|
209
214
|
URN_PARTS: ClassVar[int] = 2
|
|
210
215
|
|
|
211
|
-
def __init__(self,
|
|
216
|
+
def __init__(self, parent: str, field_path: str, *, _allow_coercion: bool = True) -> None:
|
|
212
217
|
if _allow_coercion:
|
|
213
218
|
# Field coercion logic (if any is required).
|
|
214
|
-
|
|
215
|
-
notebook_id = UrnEncoder.encode_string(notebook_id)
|
|
219
|
+
field_path = UrnEncoder.encode_string(field_path)
|
|
216
220
|
|
|
217
221
|
# Validation logic.
|
|
218
|
-
if not
|
|
219
|
-
raise InvalidUrnError("
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if not
|
|
223
|
-
raise InvalidUrnError("
|
|
224
|
-
if UrnEncoder.contains_reserved_char(
|
|
225
|
-
raise InvalidUrnError(f'
|
|
222
|
+
if not parent:
|
|
223
|
+
raise InvalidUrnError("SchemaFieldUrn parent cannot be empty")
|
|
224
|
+
parent = str(parent)
|
|
225
|
+
assert Urn.from_string(parent)
|
|
226
|
+
if not field_path:
|
|
227
|
+
raise InvalidUrnError("SchemaFieldUrn field_path cannot be empty")
|
|
228
|
+
if UrnEncoder.contains_reserved_char(field_path):
|
|
229
|
+
raise InvalidUrnError(f'SchemaFieldUrn field_path contains reserved characters')
|
|
226
230
|
|
|
227
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
231
|
+
super().__init__(self.ENTITY_TYPE, [parent, field_path])
|
|
228
232
|
|
|
229
233
|
@classmethod
|
|
230
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
234
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "SchemaFieldUrn":
|
|
231
235
|
if len(entity_ids) != cls.URN_PARTS:
|
|
232
|
-
raise InvalidUrnError(f"
|
|
233
|
-
return cls(
|
|
236
|
+
raise InvalidUrnError(f"SchemaFieldUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
237
|
+
return cls(parent=entity_ids[0], field_path=entity_ids[1], _allow_coercion=False)
|
|
234
238
|
|
|
235
239
|
@classmethod
|
|
236
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
237
|
-
from datahub.metadata.schema_classes import
|
|
240
|
+
def underlying_key_aspect_type(cls) -> Type["SchemaFieldKeyClass"]:
|
|
241
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
238
242
|
|
|
239
|
-
return
|
|
243
|
+
return SchemaFieldKeyClass
|
|
240
244
|
|
|
241
|
-
def to_key_aspect(self) -> "
|
|
242
|
-
from datahub.metadata.schema_classes import
|
|
245
|
+
def to_key_aspect(self) -> "SchemaFieldKeyClass":
|
|
246
|
+
from datahub.metadata.schema_classes import SchemaFieldKeyClass
|
|
243
247
|
|
|
244
|
-
return
|
|
248
|
+
return SchemaFieldKeyClass(parent=self.parent, fieldPath=self.field_path)
|
|
245
249
|
|
|
246
250
|
@classmethod
|
|
247
|
-
def from_key_aspect(cls, key_aspect: "
|
|
248
|
-
return cls(
|
|
249
|
-
|
|
250
|
-
@deprecated(reason="Use .notebook_tool instead")
|
|
251
|
-
def get_platform_id(self) -> str:
|
|
252
|
-
return self.notebook_tool
|
|
253
|
-
|
|
254
|
-
@deprecated(reason="Use .notebook_id instead")
|
|
255
|
-
def get_notebook_id(self) -> str:
|
|
256
|
-
return self.notebook_id
|
|
251
|
+
def from_key_aspect(cls, key_aspect: "SchemaFieldKeyClass") -> "SchemaFieldUrn":
|
|
252
|
+
return cls(parent=key_aspect.parent, field_path=key_aspect.fieldPath)
|
|
257
253
|
|
|
258
254
|
@property
|
|
259
|
-
def
|
|
255
|
+
def parent(self) -> str:
|
|
260
256
|
return self.entity_ids[0]
|
|
261
257
|
|
|
262
258
|
@property
|
|
263
|
-
def
|
|
259
|
+
def field_path(self) -> str:
|
|
264
260
|
return self.entity_ids[1]
|
|
265
261
|
|
|
266
262
|
if TYPE_CHECKING:
|
|
267
|
-
from datahub.metadata.schema_classes import
|
|
263
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
268
264
|
|
|
269
|
-
class
|
|
270
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
265
|
+
class DataHubStepStateUrn(_SpecificUrn):
|
|
266
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubStepState"
|
|
271
267
|
URN_PARTS: ClassVar[int] = 1
|
|
272
268
|
|
|
273
|
-
def __init__(self,
|
|
269
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
274
270
|
if _allow_coercion:
|
|
275
271
|
# Field coercion logic (if any is required).
|
|
276
|
-
|
|
272
|
+
id = UrnEncoder.encode_string(id)
|
|
277
273
|
|
|
278
274
|
# Validation logic.
|
|
279
|
-
if not
|
|
280
|
-
raise InvalidUrnError("
|
|
281
|
-
if UrnEncoder.contains_reserved_char(
|
|
282
|
-
raise InvalidUrnError(f'
|
|
275
|
+
if not id:
|
|
276
|
+
raise InvalidUrnError("DataHubStepStateUrn id cannot be empty")
|
|
277
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
278
|
+
raise InvalidUrnError(f'DataHubStepStateUrn id contains reserved characters')
|
|
283
279
|
|
|
284
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
280
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
285
281
|
|
|
286
282
|
@classmethod
|
|
287
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
283
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubStepStateUrn":
|
|
288
284
|
if len(entity_ids) != cls.URN_PARTS:
|
|
289
|
-
raise InvalidUrnError(f"
|
|
290
|
-
return cls(
|
|
285
|
+
raise InvalidUrnError(f"DataHubStepStateUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
286
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
291
287
|
|
|
292
288
|
@classmethod
|
|
293
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
294
|
-
from datahub.metadata.schema_classes import
|
|
289
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubStepStateKeyClass"]:
|
|
290
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
295
291
|
|
|
296
|
-
return
|
|
292
|
+
return DataHubStepStateKeyClass
|
|
297
293
|
|
|
298
|
-
def to_key_aspect(self) -> "
|
|
299
|
-
from datahub.metadata.schema_classes import
|
|
294
|
+
def to_key_aspect(self) -> "DataHubStepStateKeyClass":
|
|
295
|
+
from datahub.metadata.schema_classes import DataHubStepStateKeyClass
|
|
300
296
|
|
|
301
|
-
return
|
|
297
|
+
return DataHubStepStateKeyClass(id=self.id)
|
|
302
298
|
|
|
303
299
|
@classmethod
|
|
304
|
-
def from_key_aspect(cls, key_aspect: "
|
|
305
|
-
return cls(
|
|
300
|
+
def from_key_aspect(cls, key_aspect: "DataHubStepStateKeyClass") -> "DataHubStepStateUrn":
|
|
301
|
+
return cls(id=key_aspect.id)
|
|
306
302
|
|
|
307
303
|
@property
|
|
308
|
-
def
|
|
304
|
+
def id(self) -> str:
|
|
309
305
|
return self.entity_ids[0]
|
|
310
306
|
|
|
311
307
|
if TYPE_CHECKING:
|
|
312
|
-
from datahub.metadata.schema_classes import
|
|
308
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
313
309
|
|
|
314
|
-
class
|
|
315
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
316
|
-
URN_PARTS: ClassVar[int] =
|
|
310
|
+
class CorpUserUrn(_SpecificUrn):
|
|
311
|
+
ENTITY_TYPE: ClassVar[str] = "corpuser"
|
|
312
|
+
URN_PARTS: ClassVar[int] = 1
|
|
317
313
|
|
|
318
|
-
def __init__(self,
|
|
314
|
+
def __init__(self, username: str, *, _allow_coercion: bool = True) -> None:
|
|
319
315
|
if _allow_coercion:
|
|
320
316
|
# Field coercion logic (if any is required).
|
|
321
|
-
|
|
322
|
-
instance = UrnEncoder.encode_string(instance)
|
|
317
|
+
username = UrnEncoder.encode_string(username)
|
|
323
318
|
|
|
324
319
|
# Validation logic.
|
|
325
|
-
if not
|
|
326
|
-
raise InvalidUrnError("
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
if not instance:
|
|
330
|
-
raise InvalidUrnError("DataPlatformInstanceUrn instance cannot be empty")
|
|
331
|
-
if UrnEncoder.contains_reserved_char(instance):
|
|
332
|
-
raise InvalidUrnError(f'DataPlatformInstanceUrn instance contains reserved characters')
|
|
320
|
+
if not username:
|
|
321
|
+
raise InvalidUrnError("CorpUserUrn username cannot be empty")
|
|
322
|
+
if UrnEncoder.contains_reserved_char(username):
|
|
323
|
+
raise InvalidUrnError(f'CorpUserUrn username contains reserved characters')
|
|
333
324
|
|
|
334
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
325
|
+
super().__init__(self.ENTITY_TYPE, [username])
|
|
335
326
|
|
|
336
327
|
@classmethod
|
|
337
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
328
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "CorpUserUrn":
|
|
338
329
|
if len(entity_ids) != cls.URN_PARTS:
|
|
339
|
-
raise InvalidUrnError(f"
|
|
340
|
-
return cls(
|
|
330
|
+
raise InvalidUrnError(f"CorpUserUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
331
|
+
return cls(username=entity_ids[0], _allow_coercion=False)
|
|
341
332
|
|
|
342
333
|
@classmethod
|
|
343
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
344
|
-
from datahub.metadata.schema_classes import
|
|
334
|
+
def underlying_key_aspect_type(cls) -> Type["CorpUserKeyClass"]:
|
|
335
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
345
336
|
|
|
346
|
-
return
|
|
337
|
+
return CorpUserKeyClass
|
|
347
338
|
|
|
348
|
-
def to_key_aspect(self) -> "
|
|
349
|
-
from datahub.metadata.schema_classes import
|
|
339
|
+
def to_key_aspect(self) -> "CorpUserKeyClass":
|
|
340
|
+
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
350
341
|
|
|
351
|
-
return
|
|
342
|
+
return CorpUserKeyClass(username=self.username)
|
|
352
343
|
|
|
353
344
|
@classmethod
|
|
354
|
-
def from_key_aspect(cls, key_aspect: "
|
|
355
|
-
return cls(
|
|
345
|
+
def from_key_aspect(cls, key_aspect: "CorpUserKeyClass") -> "CorpUserUrn":
|
|
346
|
+
return cls(username=key_aspect.username)
|
|
356
347
|
|
|
357
|
-
@
|
|
358
|
-
|
|
359
|
-
|
|
348
|
+
@classmethod
|
|
349
|
+
@deprecated(reason="Use the constructor instead")
|
|
350
|
+
def create_from_id(cls, id: str) -> "CorpUserUrn":
|
|
351
|
+
return cls(id)
|
|
360
352
|
|
|
361
353
|
@property
|
|
362
|
-
def
|
|
363
|
-
return self.entity_ids[
|
|
354
|
+
def username(self) -> str:
|
|
355
|
+
return self.entity_ids[0]
|
|
364
356
|
|
|
365
357
|
if TYPE_CHECKING:
|
|
366
|
-
from datahub.metadata.schema_classes import
|
|
358
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
367
359
|
|
|
368
|
-
class
|
|
369
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
360
|
+
class DataHubConnectionUrn(_SpecificUrn):
|
|
361
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubConnection"
|
|
370
362
|
URN_PARTS: ClassVar[int] = 1
|
|
371
363
|
|
|
372
364
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -376,31 +368,31 @@ class RoleUrn(_SpecificUrn):
|
|
|
376
368
|
|
|
377
369
|
# Validation logic.
|
|
378
370
|
if not id:
|
|
379
|
-
raise InvalidUrnError("
|
|
371
|
+
raise InvalidUrnError("DataHubConnectionUrn id cannot be empty")
|
|
380
372
|
if UrnEncoder.contains_reserved_char(id):
|
|
381
|
-
raise InvalidUrnError(f'
|
|
373
|
+
raise InvalidUrnError(f'DataHubConnectionUrn id contains reserved characters')
|
|
382
374
|
|
|
383
375
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
384
376
|
|
|
385
377
|
@classmethod
|
|
386
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
378
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubConnectionUrn":
|
|
387
379
|
if len(entity_ids) != cls.URN_PARTS:
|
|
388
|
-
raise InvalidUrnError(f"
|
|
380
|
+
raise InvalidUrnError(f"DataHubConnectionUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
389
381
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
390
382
|
|
|
391
383
|
@classmethod
|
|
392
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
393
|
-
from datahub.metadata.schema_classes import
|
|
384
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubConnectionKeyClass"]:
|
|
385
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
394
386
|
|
|
395
|
-
return
|
|
387
|
+
return DataHubConnectionKeyClass
|
|
396
388
|
|
|
397
|
-
def to_key_aspect(self) -> "
|
|
398
|
-
from datahub.metadata.schema_classes import
|
|
389
|
+
def to_key_aspect(self) -> "DataHubConnectionKeyClass":
|
|
390
|
+
from datahub.metadata.schema_classes import DataHubConnectionKeyClass
|
|
399
391
|
|
|
400
|
-
return
|
|
392
|
+
return DataHubConnectionKeyClass(id=self.id)
|
|
401
393
|
|
|
402
394
|
@classmethod
|
|
403
|
-
def from_key_aspect(cls, key_aspect: "
|
|
395
|
+
def from_key_aspect(cls, key_aspect: "DataHubConnectionKeyClass") -> "DataHubConnectionUrn":
|
|
404
396
|
return cls(id=key_aspect.id)
|
|
405
397
|
|
|
406
398
|
@property
|
|
@@ -408,64 +400,64 @@ class RoleUrn(_SpecificUrn):
|
|
|
408
400
|
return self.entity_ids[0]
|
|
409
401
|
|
|
410
402
|
if TYPE_CHECKING:
|
|
411
|
-
from datahub.metadata.schema_classes import
|
|
403
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
412
404
|
|
|
413
|
-
class
|
|
414
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
405
|
+
class DashboardUrn(_SpecificUrn):
|
|
406
|
+
ENTITY_TYPE: ClassVar[str] = "dashboard"
|
|
415
407
|
URN_PARTS: ClassVar[int] = 2
|
|
416
408
|
|
|
417
|
-
def __init__(self, dashboard_tool: str,
|
|
409
|
+
def __init__(self, dashboard_tool: str, dashboard_id: str, *, _allow_coercion: bool = True) -> None:
|
|
418
410
|
if _allow_coercion:
|
|
419
411
|
# Field coercion logic (if any is required).
|
|
420
412
|
dashboard_tool = UrnEncoder.encode_string(dashboard_tool)
|
|
421
|
-
|
|
413
|
+
dashboard_id = UrnEncoder.encode_string(dashboard_id)
|
|
422
414
|
|
|
423
415
|
# Validation logic.
|
|
424
416
|
if not dashboard_tool:
|
|
425
|
-
raise InvalidUrnError("
|
|
417
|
+
raise InvalidUrnError("DashboardUrn dashboard_tool cannot be empty")
|
|
426
418
|
if UrnEncoder.contains_reserved_char(dashboard_tool):
|
|
427
|
-
raise InvalidUrnError(f'
|
|
428
|
-
if not
|
|
429
|
-
raise InvalidUrnError("
|
|
430
|
-
if UrnEncoder.contains_reserved_char(
|
|
431
|
-
raise InvalidUrnError(f'
|
|
419
|
+
raise InvalidUrnError(f'DashboardUrn dashboard_tool contains reserved characters')
|
|
420
|
+
if not dashboard_id:
|
|
421
|
+
raise InvalidUrnError("DashboardUrn dashboard_id cannot be empty")
|
|
422
|
+
if UrnEncoder.contains_reserved_char(dashboard_id):
|
|
423
|
+
raise InvalidUrnError(f'DashboardUrn dashboard_id contains reserved characters')
|
|
432
424
|
|
|
433
|
-
super().__init__(self.ENTITY_TYPE, [dashboard_tool,
|
|
425
|
+
super().__init__(self.ENTITY_TYPE, [dashboard_tool, dashboard_id])
|
|
434
426
|
|
|
435
427
|
@classmethod
|
|
436
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
428
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DashboardUrn":
|
|
437
429
|
if len(entity_ids) != cls.URN_PARTS:
|
|
438
|
-
raise InvalidUrnError(f"
|
|
439
|
-
return cls(dashboard_tool=entity_ids[0],
|
|
430
|
+
raise InvalidUrnError(f"DashboardUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
431
|
+
return cls(dashboard_tool=entity_ids[0], dashboard_id=entity_ids[1], _allow_coercion=False)
|
|
440
432
|
|
|
441
433
|
@classmethod
|
|
442
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
443
|
-
from datahub.metadata.schema_classes import
|
|
434
|
+
def underlying_key_aspect_type(cls) -> Type["DashboardKeyClass"]:
|
|
435
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
444
436
|
|
|
445
|
-
return
|
|
437
|
+
return DashboardKeyClass
|
|
446
438
|
|
|
447
|
-
def to_key_aspect(self) -> "
|
|
448
|
-
from datahub.metadata.schema_classes import
|
|
439
|
+
def to_key_aspect(self) -> "DashboardKeyClass":
|
|
440
|
+
from datahub.metadata.schema_classes import DashboardKeyClass
|
|
449
441
|
|
|
450
|
-
return
|
|
442
|
+
return DashboardKeyClass(dashboardTool=self.dashboard_tool, dashboardId=self.dashboard_id)
|
|
451
443
|
|
|
452
444
|
@classmethod
|
|
453
|
-
def from_key_aspect(cls, key_aspect: "
|
|
454
|
-
return cls(dashboard_tool=key_aspect.dashboardTool,
|
|
445
|
+
def from_key_aspect(cls, key_aspect: "DashboardKeyClass") -> "DashboardUrn":
|
|
446
|
+
return cls(dashboard_tool=key_aspect.dashboardTool, dashboard_id=key_aspect.dashboardId)
|
|
455
447
|
|
|
456
448
|
@property
|
|
457
449
|
def dashboard_tool(self) -> str:
|
|
458
450
|
return self.entity_ids[0]
|
|
459
451
|
|
|
460
452
|
@property
|
|
461
|
-
def
|
|
453
|
+
def dashboard_id(self) -> str:
|
|
462
454
|
return self.entity_ids[1]
|
|
463
455
|
|
|
464
456
|
if TYPE_CHECKING:
|
|
465
|
-
from datahub.metadata.schema_classes import
|
|
457
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
466
458
|
|
|
467
|
-
class
|
|
468
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
459
|
+
class DataHubRoleUrn(_SpecificUrn):
|
|
460
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubRole"
|
|
469
461
|
URN_PARTS: ClassVar[int] = 1
|
|
470
462
|
|
|
471
463
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -475,31 +467,31 @@ class ErModelRelationshipUrn(_SpecificUrn):
|
|
|
475
467
|
|
|
476
468
|
# Validation logic.
|
|
477
469
|
if not id:
|
|
478
|
-
raise InvalidUrnError("
|
|
470
|
+
raise InvalidUrnError("DataHubRoleUrn id cannot be empty")
|
|
479
471
|
if UrnEncoder.contains_reserved_char(id):
|
|
480
|
-
raise InvalidUrnError(f'
|
|
472
|
+
raise InvalidUrnError(f'DataHubRoleUrn id contains reserved characters')
|
|
481
473
|
|
|
482
474
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
483
475
|
|
|
484
476
|
@classmethod
|
|
485
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
477
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubRoleUrn":
|
|
486
478
|
if len(entity_ids) != cls.URN_PARTS:
|
|
487
|
-
raise InvalidUrnError(f"
|
|
479
|
+
raise InvalidUrnError(f"DataHubRoleUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
488
480
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
489
481
|
|
|
490
482
|
@classmethod
|
|
491
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
492
|
-
from datahub.metadata.schema_classes import
|
|
483
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubRoleKeyClass"]:
|
|
484
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
493
485
|
|
|
494
|
-
return
|
|
486
|
+
return DataHubRoleKeyClass
|
|
495
487
|
|
|
496
|
-
def to_key_aspect(self) -> "
|
|
497
|
-
from datahub.metadata.schema_classes import
|
|
488
|
+
def to_key_aspect(self) -> "DataHubRoleKeyClass":
|
|
489
|
+
from datahub.metadata.schema_classes import DataHubRoleKeyClass
|
|
498
490
|
|
|
499
|
-
return
|
|
491
|
+
return DataHubRoleKeyClass(id=self.id)
|
|
500
492
|
|
|
501
493
|
@classmethod
|
|
502
|
-
def from_key_aspect(cls, key_aspect: "
|
|
494
|
+
def from_key_aspect(cls, key_aspect: "DataHubRoleKeyClass") -> "DataHubRoleUrn":
|
|
503
495
|
return cls(id=key_aspect.id)
|
|
504
496
|
|
|
505
497
|
@property
|
|
@@ -507,10 +499,10 @@ class ErModelRelationshipUrn(_SpecificUrn):
|
|
|
507
499
|
return self.entity_ids[0]
|
|
508
500
|
|
|
509
501
|
if TYPE_CHECKING:
|
|
510
|
-
from datahub.metadata.schema_classes import
|
|
502
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
511
503
|
|
|
512
|
-
class
|
|
513
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
504
|
+
class DataHubExecutionRequestUrn(_SpecificUrn):
|
|
505
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubExecutionRequest"
|
|
514
506
|
URN_PARTS: ClassVar[int] = 1
|
|
515
507
|
|
|
516
508
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -520,31 +512,31 @@ class QueryUrn(_SpecificUrn):
|
|
|
520
512
|
|
|
521
513
|
# Validation logic.
|
|
522
514
|
if not id:
|
|
523
|
-
raise InvalidUrnError("
|
|
515
|
+
raise InvalidUrnError("DataHubExecutionRequestUrn id cannot be empty")
|
|
524
516
|
if UrnEncoder.contains_reserved_char(id):
|
|
525
|
-
raise InvalidUrnError(f'
|
|
517
|
+
raise InvalidUrnError(f'DataHubExecutionRequestUrn id contains reserved characters')
|
|
526
518
|
|
|
527
519
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
528
520
|
|
|
529
521
|
@classmethod
|
|
530
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
522
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubExecutionRequestUrn":
|
|
531
523
|
if len(entity_ids) != cls.URN_PARTS:
|
|
532
|
-
raise InvalidUrnError(f"
|
|
524
|
+
raise InvalidUrnError(f"DataHubExecutionRequestUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
533
525
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
534
526
|
|
|
535
527
|
@classmethod
|
|
536
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
537
|
-
from datahub.metadata.schema_classes import
|
|
528
|
+
def underlying_key_aspect_type(cls) -> Type["ExecutionRequestKeyClass"]:
|
|
529
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
538
530
|
|
|
539
|
-
return
|
|
531
|
+
return ExecutionRequestKeyClass
|
|
540
532
|
|
|
541
|
-
def to_key_aspect(self) -> "
|
|
542
|
-
from datahub.metadata.schema_classes import
|
|
533
|
+
def to_key_aspect(self) -> "ExecutionRequestKeyClass":
|
|
534
|
+
from datahub.metadata.schema_classes import ExecutionRequestKeyClass
|
|
543
535
|
|
|
544
|
-
return
|
|
536
|
+
return ExecutionRequestKeyClass(id=self.id)
|
|
545
537
|
|
|
546
538
|
@classmethod
|
|
547
|
-
def from_key_aspect(cls, key_aspect: "
|
|
539
|
+
def from_key_aspect(cls, key_aspect: "ExecutionRequestKeyClass") -> "DataHubExecutionRequestUrn":
|
|
548
540
|
return cls(id=key_aspect.id)
|
|
549
541
|
|
|
550
542
|
@property
|
|
@@ -552,10 +544,10 @@ class QueryUrn(_SpecificUrn):
|
|
|
552
544
|
return self.entity_ids[0]
|
|
553
545
|
|
|
554
546
|
if TYPE_CHECKING:
|
|
555
|
-
from datahub.metadata.schema_classes import
|
|
547
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
556
548
|
|
|
557
|
-
class
|
|
558
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
549
|
+
class DataProcessInstanceUrn(_SpecificUrn):
|
|
550
|
+
ENTITY_TYPE: ClassVar[str] = "dataProcessInstance"
|
|
559
551
|
URN_PARTS: ClassVar[int] = 1
|
|
560
552
|
|
|
561
553
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -565,430 +557,413 @@ class DataContractUrn(_SpecificUrn):
|
|
|
565
557
|
|
|
566
558
|
# Validation logic.
|
|
567
559
|
if not id:
|
|
568
|
-
raise InvalidUrnError("
|
|
560
|
+
raise InvalidUrnError("DataProcessInstanceUrn id cannot be empty")
|
|
569
561
|
if UrnEncoder.contains_reserved_char(id):
|
|
570
|
-
raise InvalidUrnError(f'
|
|
562
|
+
raise InvalidUrnError(f'DataProcessInstanceUrn id contains reserved characters')
|
|
571
563
|
|
|
572
564
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
573
565
|
|
|
574
566
|
@classmethod
|
|
575
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
567
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataProcessInstanceUrn":
|
|
576
568
|
if len(entity_ids) != cls.URN_PARTS:
|
|
577
|
-
raise InvalidUrnError(f"
|
|
569
|
+
raise InvalidUrnError(f"DataProcessInstanceUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
578
570
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
579
571
|
|
|
580
572
|
@classmethod
|
|
581
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
582
|
-
from datahub.metadata.schema_classes import
|
|
573
|
+
def underlying_key_aspect_type(cls) -> Type["DataProcessInstanceKeyClass"]:
|
|
574
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
583
575
|
|
|
584
|
-
return
|
|
576
|
+
return DataProcessInstanceKeyClass
|
|
585
577
|
|
|
586
|
-
def to_key_aspect(self) -> "
|
|
587
|
-
from datahub.metadata.schema_classes import
|
|
578
|
+
def to_key_aspect(self) -> "DataProcessInstanceKeyClass":
|
|
579
|
+
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
588
580
|
|
|
589
|
-
return
|
|
581
|
+
return DataProcessInstanceKeyClass(id=self.id)
|
|
590
582
|
|
|
591
583
|
@classmethod
|
|
592
|
-
def from_key_aspect(cls, key_aspect: "
|
|
584
|
+
def from_key_aspect(cls, key_aspect: "DataProcessInstanceKeyClass") -> "DataProcessInstanceUrn":
|
|
593
585
|
return cls(id=key_aspect.id)
|
|
594
586
|
|
|
587
|
+
@classmethod
|
|
588
|
+
@deprecated(reason="Use the constructor instead")
|
|
589
|
+
def create_from_id(cls, id: str) -> "DataProcessInstanceUrn":
|
|
590
|
+
return cls(id)
|
|
591
|
+
|
|
592
|
+
@deprecated(reason="Use .id instead")
|
|
593
|
+
def get_dataprocessinstance_id(self) -> str:
|
|
594
|
+
return self.id
|
|
595
|
+
|
|
595
596
|
@property
|
|
596
597
|
def id(self) -> str:
|
|
597
598
|
return self.entity_ids[0]
|
|
598
599
|
|
|
599
600
|
if TYPE_CHECKING:
|
|
600
|
-
from datahub.metadata.schema_classes import
|
|
601
|
+
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
601
602
|
|
|
602
|
-
class
|
|
603
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
604
|
-
URN_PARTS: ClassVar[int] =
|
|
603
|
+
class DataJobUrn(_SpecificUrn):
|
|
604
|
+
ENTITY_TYPE: ClassVar[str] = "dataJob"
|
|
605
|
+
URN_PARTS: ClassVar[int] = 2
|
|
605
606
|
|
|
606
|
-
def __init__(self,
|
|
607
|
+
def __init__(self, flow: str, job_id: str, *, _allow_coercion: bool = True) -> None:
|
|
607
608
|
if _allow_coercion:
|
|
608
609
|
# Field coercion logic (if any is required).
|
|
609
|
-
|
|
610
|
+
job_id = UrnEncoder.encode_string(job_id)
|
|
610
611
|
|
|
611
612
|
# Validation logic.
|
|
612
|
-
if not
|
|
613
|
-
raise InvalidUrnError("
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
if not flow:
|
|
614
|
+
raise InvalidUrnError("DataJobUrn flow cannot be empty")
|
|
615
|
+
flow = str(flow)
|
|
616
|
+
assert DataFlowUrn.from_string(flow)
|
|
617
|
+
if not job_id:
|
|
618
|
+
raise InvalidUrnError("DataJobUrn job_id cannot be empty")
|
|
619
|
+
if UrnEncoder.contains_reserved_char(job_id):
|
|
620
|
+
raise InvalidUrnError(f'DataJobUrn job_id contains reserved characters')
|
|
616
621
|
|
|
617
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
622
|
+
super().__init__(self.ENTITY_TYPE, [flow, job_id])
|
|
618
623
|
|
|
619
624
|
@classmethod
|
|
620
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
625
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataJobUrn":
|
|
621
626
|
if len(entity_ids) != cls.URN_PARTS:
|
|
622
|
-
raise InvalidUrnError(f"
|
|
623
|
-
return cls(
|
|
627
|
+
raise InvalidUrnError(f"DataJobUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
628
|
+
return cls(flow=entity_ids[0], job_id=entity_ids[1], _allow_coercion=False)
|
|
624
629
|
|
|
625
630
|
@classmethod
|
|
626
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
627
|
-
from datahub.metadata.schema_classes import
|
|
631
|
+
def underlying_key_aspect_type(cls) -> Type["DataJobKeyClass"]:
|
|
632
|
+
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
628
633
|
|
|
629
|
-
return
|
|
634
|
+
return DataJobKeyClass
|
|
630
635
|
|
|
631
|
-
def to_key_aspect(self) -> "
|
|
632
|
-
from datahub.metadata.schema_classes import
|
|
636
|
+
def to_key_aspect(self) -> "DataJobKeyClass":
|
|
637
|
+
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
633
638
|
|
|
634
|
-
return
|
|
635
|
-
|
|
636
|
-
@classmethod
|
|
637
|
-
def from_key_aspect(cls, key_aspect: "ContainerKeyClass") -> "ContainerUrn":
|
|
638
|
-
return cls(guid=key_aspect.guid)
|
|
639
|
-
|
|
640
|
-
@property
|
|
641
|
-
def guid(self) -> str:
|
|
642
|
-
return self.entity_ids[0]
|
|
643
|
-
|
|
644
|
-
if TYPE_CHECKING:
|
|
645
|
-
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
646
|
-
|
|
647
|
-
class DataHubRetentionUrn(_SpecificUrn):
|
|
648
|
-
ENTITY_TYPE: ClassVar[str] = "dataHubRetention"
|
|
649
|
-
URN_PARTS: ClassVar[int] = 2
|
|
650
|
-
|
|
651
|
-
def __init__(self, entity_name: str, aspect_name: str, *, _allow_coercion: bool = True) -> None:
|
|
652
|
-
if _allow_coercion:
|
|
653
|
-
# Field coercion logic (if any is required).
|
|
654
|
-
entity_name = UrnEncoder.encode_string(entity_name)
|
|
655
|
-
aspect_name = UrnEncoder.encode_string(aspect_name)
|
|
656
|
-
|
|
657
|
-
# Validation logic.
|
|
658
|
-
if not entity_name:
|
|
659
|
-
raise InvalidUrnError("DataHubRetentionUrn entity_name cannot be empty")
|
|
660
|
-
if UrnEncoder.contains_reserved_char(entity_name):
|
|
661
|
-
raise InvalidUrnError(f'DataHubRetentionUrn entity_name contains reserved characters')
|
|
662
|
-
if not aspect_name:
|
|
663
|
-
raise InvalidUrnError("DataHubRetentionUrn aspect_name cannot be empty")
|
|
664
|
-
if UrnEncoder.contains_reserved_char(aspect_name):
|
|
665
|
-
raise InvalidUrnError(f'DataHubRetentionUrn aspect_name contains reserved characters')
|
|
666
|
-
|
|
667
|
-
super().__init__(self.ENTITY_TYPE, [entity_name, aspect_name])
|
|
639
|
+
return DataJobKeyClass(flow=self.flow, jobId=self.job_id)
|
|
668
640
|
|
|
669
641
|
@classmethod
|
|
670
|
-
def
|
|
671
|
-
|
|
672
|
-
raise InvalidUrnError(f"DataHubRetentionUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
673
|
-
return cls(entity_name=entity_ids[0], aspect_name=entity_ids[1], _allow_coercion=False)
|
|
642
|
+
def from_key_aspect(cls, key_aspect: "DataJobKeyClass") -> "DataJobUrn":
|
|
643
|
+
return cls(flow=key_aspect.flow, job_id=key_aspect.jobId)
|
|
674
644
|
|
|
675
645
|
@classmethod
|
|
676
|
-
def
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return DataHubRetentionKeyClass
|
|
680
|
-
|
|
681
|
-
def to_key_aspect(self) -> "DataHubRetentionKeyClass":
|
|
682
|
-
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
646
|
+
def create_from_ids(cls, data_flow_urn: str, job_id: str) -> "DataJobUrn":
|
|
647
|
+
return cls(data_flow_urn, job_id)
|
|
683
648
|
|
|
684
|
-
|
|
649
|
+
def get_data_flow_urn(self) -> "DataFlowUrn":
|
|
650
|
+
return DataFlowUrn.from_string(self.flow)
|
|
685
651
|
|
|
686
|
-
@
|
|
687
|
-
def
|
|
688
|
-
return
|
|
652
|
+
@deprecated(reason="Use .job_id instead")
|
|
653
|
+
def get_job_id(self) -> str:
|
|
654
|
+
return self.job_id
|
|
689
655
|
|
|
690
656
|
@property
|
|
691
|
-
def
|
|
657
|
+
def flow(self) -> str:
|
|
692
658
|
return self.entity_ids[0]
|
|
693
659
|
|
|
694
660
|
@property
|
|
695
|
-
def
|
|
661
|
+
def job_id(self) -> str:
|
|
696
662
|
return self.entity_ids[1]
|
|
697
663
|
|
|
698
664
|
if TYPE_CHECKING:
|
|
699
|
-
from datahub.metadata.schema_classes import
|
|
665
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
700
666
|
|
|
701
|
-
class
|
|
702
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
703
|
-
URN_PARTS: ClassVar[int] =
|
|
667
|
+
class DataFlowUrn(_SpecificUrn):
|
|
668
|
+
ENTITY_TYPE: ClassVar[str] = "dataFlow"
|
|
669
|
+
URN_PARTS: ClassVar[int] = 3
|
|
704
670
|
|
|
705
|
-
def __init__(self,
|
|
671
|
+
def __init__(self, orchestrator: str, flow_id: str, cluster: str, *, _allow_coercion: bool = True) -> None:
|
|
706
672
|
if _allow_coercion:
|
|
707
673
|
# Field coercion logic (if any is required).
|
|
708
|
-
|
|
674
|
+
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
675
|
+
flow_id = UrnEncoder.encode_string(flow_id)
|
|
676
|
+
cluster = UrnEncoder.encode_string(cluster)
|
|
709
677
|
|
|
710
678
|
# Validation logic.
|
|
711
|
-
if not
|
|
712
|
-
raise InvalidUrnError("
|
|
713
|
-
if UrnEncoder.contains_reserved_char(
|
|
714
|
-
raise InvalidUrnError(f'
|
|
679
|
+
if not orchestrator:
|
|
680
|
+
raise InvalidUrnError("DataFlowUrn orchestrator cannot be empty")
|
|
681
|
+
if UrnEncoder.contains_reserved_char(orchestrator):
|
|
682
|
+
raise InvalidUrnError(f'DataFlowUrn orchestrator contains reserved characters')
|
|
683
|
+
if not flow_id:
|
|
684
|
+
raise InvalidUrnError("DataFlowUrn flow_id cannot be empty")
|
|
685
|
+
if UrnEncoder.contains_reserved_char(flow_id):
|
|
686
|
+
raise InvalidUrnError(f'DataFlowUrn flow_id contains reserved characters')
|
|
687
|
+
if not cluster:
|
|
688
|
+
raise InvalidUrnError("DataFlowUrn cluster cannot be empty")
|
|
689
|
+
if UrnEncoder.contains_reserved_char(cluster):
|
|
690
|
+
raise InvalidUrnError(f'DataFlowUrn cluster contains reserved characters')
|
|
715
691
|
|
|
716
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
692
|
+
super().__init__(self.ENTITY_TYPE, [orchestrator, flow_id, cluster])
|
|
717
693
|
|
|
718
694
|
@classmethod
|
|
719
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
695
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataFlowUrn":
|
|
720
696
|
if len(entity_ids) != cls.URN_PARTS:
|
|
721
|
-
raise InvalidUrnError(f"
|
|
722
|
-
return cls(
|
|
697
|
+
raise InvalidUrnError(f"DataFlowUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
698
|
+
return cls(orchestrator=entity_ids[0], flow_id=entity_ids[1], cluster=entity_ids[2], _allow_coercion=False)
|
|
723
699
|
|
|
724
700
|
@classmethod
|
|
725
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
726
|
-
from datahub.metadata.schema_classes import
|
|
701
|
+
def underlying_key_aspect_type(cls) -> Type["DataFlowKeyClass"]:
|
|
702
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
727
703
|
|
|
728
|
-
return
|
|
704
|
+
return DataFlowKeyClass
|
|
729
705
|
|
|
730
|
-
def to_key_aspect(self) -> "
|
|
731
|
-
from datahub.metadata.schema_classes import
|
|
706
|
+
def to_key_aspect(self) -> "DataFlowKeyClass":
|
|
707
|
+
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
732
708
|
|
|
733
|
-
return
|
|
709
|
+
return DataFlowKeyClass(orchestrator=self.orchestrator, flowId=self.flow_id, cluster=self.cluster)
|
|
734
710
|
|
|
735
711
|
@classmethod
|
|
736
|
-
def from_key_aspect(cls, key_aspect: "
|
|
737
|
-
return cls(
|
|
738
|
-
|
|
739
|
-
@property
|
|
740
|
-
def id(self) -> str:
|
|
741
|
-
return self.entity_ids[0]
|
|
742
|
-
|
|
743
|
-
if TYPE_CHECKING:
|
|
744
|
-
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
745
|
-
|
|
746
|
-
class DataHubSecretUrn(_SpecificUrn):
|
|
747
|
-
ENTITY_TYPE: ClassVar[str] = "dataHubSecret"
|
|
748
|
-
URN_PARTS: ClassVar[int] = 1
|
|
749
|
-
|
|
750
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
751
|
-
if _allow_coercion:
|
|
752
|
-
# Field coercion logic (if any is required).
|
|
753
|
-
id = UrnEncoder.encode_string(id)
|
|
754
|
-
|
|
755
|
-
# Validation logic.
|
|
756
|
-
if not id:
|
|
757
|
-
raise InvalidUrnError("DataHubSecretUrn id cannot be empty")
|
|
758
|
-
if UrnEncoder.contains_reserved_char(id):
|
|
759
|
-
raise InvalidUrnError(f'DataHubSecretUrn id contains reserved characters')
|
|
760
|
-
|
|
761
|
-
super().__init__(self.ENTITY_TYPE, [id])
|
|
712
|
+
def from_key_aspect(cls, key_aspect: "DataFlowKeyClass") -> "DataFlowUrn":
|
|
713
|
+
return cls(orchestrator=key_aspect.orchestrator, flow_id=key_aspect.flowId, cluster=key_aspect.cluster)
|
|
762
714
|
|
|
763
715
|
@classmethod
|
|
764
|
-
def
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
716
|
+
def create_from_ids(
|
|
717
|
+
cls,
|
|
718
|
+
orchestrator: str,
|
|
719
|
+
flow_id: str,
|
|
720
|
+
env: str,
|
|
721
|
+
platform_instance: Optional[str] = None,
|
|
722
|
+
) -> "DataFlowUrn":
|
|
723
|
+
return cls(
|
|
724
|
+
orchestrator=orchestrator,
|
|
725
|
+
flow_id=f"{platform_instance}.{flow_id}" if platform_instance else flow_id,
|
|
726
|
+
cluster=env,
|
|
727
|
+
)
|
|
768
728
|
|
|
769
|
-
@
|
|
770
|
-
def
|
|
771
|
-
|
|
729
|
+
@deprecated(reason="Use .orchestrator instead")
|
|
730
|
+
def get_orchestrator_name(self) -> str:
|
|
731
|
+
return self.orchestrator
|
|
772
732
|
|
|
773
|
-
|
|
733
|
+
@deprecated(reason="Use .flow_id instead")
|
|
734
|
+
def get_flow_id(self) -> str:
|
|
735
|
+
return self.flow_id
|
|
774
736
|
|
|
775
|
-
|
|
776
|
-
|
|
737
|
+
@deprecated(reason="Use .cluster instead")
|
|
738
|
+
def get_env(self) -> str:
|
|
739
|
+
return self.cluster
|
|
777
740
|
|
|
778
|
-
|
|
741
|
+
@property
|
|
742
|
+
def orchestrator(self) -> str:
|
|
743
|
+
return self.entity_ids[0]
|
|
779
744
|
|
|
780
|
-
@
|
|
781
|
-
def
|
|
782
|
-
return
|
|
745
|
+
@property
|
|
746
|
+
def flow_id(self) -> str:
|
|
747
|
+
return self.entity_ids[1]
|
|
783
748
|
|
|
784
749
|
@property
|
|
785
|
-
def
|
|
786
|
-
return self.entity_ids[
|
|
750
|
+
def cluster(self) -> str:
|
|
751
|
+
return self.entity_ids[2]
|
|
787
752
|
|
|
788
753
|
if TYPE_CHECKING:
|
|
789
|
-
from datahub.metadata.schema_classes import
|
|
754
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
790
755
|
|
|
791
|
-
class
|
|
792
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
756
|
+
class DataPlatformUrn(_SpecificUrn):
|
|
757
|
+
ENTITY_TYPE: ClassVar[str] = "dataPlatform"
|
|
793
758
|
URN_PARTS: ClassVar[int] = 1
|
|
794
759
|
|
|
795
|
-
def __init__(self,
|
|
760
|
+
def __init__(self, platform_name: str, *, _allow_coercion: bool = True) -> None:
|
|
796
761
|
if _allow_coercion:
|
|
797
762
|
# Field coercion logic (if any is required).
|
|
798
|
-
|
|
763
|
+
if platform_name.startswith("urn:li:dataPlatform:"):
|
|
764
|
+
platform_name = DataPlatformUrn.from_string(platform_name).platform_name
|
|
765
|
+
platform_name = UrnEncoder.encode_string(platform_name)
|
|
799
766
|
|
|
800
767
|
# Validation logic.
|
|
801
|
-
if not
|
|
802
|
-
raise InvalidUrnError("
|
|
803
|
-
if UrnEncoder.contains_reserved_char(
|
|
804
|
-
raise InvalidUrnError(f'
|
|
768
|
+
if not platform_name:
|
|
769
|
+
raise InvalidUrnError("DataPlatformUrn platform_name cannot be empty")
|
|
770
|
+
if UrnEncoder.contains_reserved_char(platform_name):
|
|
771
|
+
raise InvalidUrnError(f'DataPlatformUrn platform_name contains reserved characters')
|
|
805
772
|
|
|
806
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
773
|
+
super().__init__(self.ENTITY_TYPE, [platform_name])
|
|
807
774
|
|
|
808
775
|
@classmethod
|
|
809
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
776
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataPlatformUrn":
|
|
810
777
|
if len(entity_ids) != cls.URN_PARTS:
|
|
811
|
-
raise InvalidUrnError(f"
|
|
812
|
-
return cls(
|
|
778
|
+
raise InvalidUrnError(f"DataPlatformUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
779
|
+
return cls(platform_name=entity_ids[0], _allow_coercion=False)
|
|
813
780
|
|
|
814
781
|
@classmethod
|
|
815
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
816
|
-
from datahub.metadata.schema_classes import
|
|
782
|
+
def underlying_key_aspect_type(cls) -> Type["DataPlatformKeyClass"]:
|
|
783
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
817
784
|
|
|
818
|
-
return
|
|
785
|
+
return DataPlatformKeyClass
|
|
819
786
|
|
|
820
|
-
def to_key_aspect(self) -> "
|
|
821
|
-
from datahub.metadata.schema_classes import
|
|
787
|
+
def to_key_aspect(self) -> "DataPlatformKeyClass":
|
|
788
|
+
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
822
789
|
|
|
823
|
-
return
|
|
790
|
+
return DataPlatformKeyClass(platformName=self.platform_name)
|
|
824
791
|
|
|
825
792
|
@classmethod
|
|
826
|
-
def from_key_aspect(cls, key_aspect: "
|
|
827
|
-
return cls(
|
|
793
|
+
def from_key_aspect(cls, key_aspect: "DataPlatformKeyClass") -> "DataPlatformUrn":
|
|
794
|
+
return cls(platform_name=key_aspect.platformName)
|
|
795
|
+
|
|
796
|
+
@classmethod
|
|
797
|
+
@deprecated(reason="Use the constructor instead")
|
|
798
|
+
def create_from_id(cls, id: str) -> "DataPlatformUrn":
|
|
799
|
+
return cls(id)
|
|
828
800
|
|
|
829
801
|
@property
|
|
830
|
-
def
|
|
802
|
+
def platform_name(self) -> str:
|
|
831
803
|
return self.entity_ids[0]
|
|
832
804
|
|
|
833
805
|
if TYPE_CHECKING:
|
|
834
|
-
from datahub.metadata.schema_classes import
|
|
806
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
835
807
|
|
|
836
|
-
class
|
|
837
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
808
|
+
class TagUrn(_SpecificUrn):
|
|
809
|
+
ENTITY_TYPE: ClassVar[str] = "tag"
|
|
838
810
|
URN_PARTS: ClassVar[int] = 1
|
|
839
811
|
|
|
840
|
-
def __init__(self,
|
|
812
|
+
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
841
813
|
if _allow_coercion:
|
|
842
814
|
# Field coercion logic (if any is required).
|
|
843
|
-
|
|
815
|
+
name = UrnEncoder.encode_string(name)
|
|
844
816
|
|
|
845
817
|
# Validation logic.
|
|
846
|
-
if not
|
|
847
|
-
raise InvalidUrnError("
|
|
848
|
-
if UrnEncoder.contains_reserved_char(
|
|
849
|
-
raise InvalidUrnError(f'
|
|
818
|
+
if not name:
|
|
819
|
+
raise InvalidUrnError("TagUrn name cannot be empty")
|
|
820
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
821
|
+
raise InvalidUrnError(f'TagUrn name contains reserved characters')
|
|
850
822
|
|
|
851
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
823
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
852
824
|
|
|
853
825
|
@classmethod
|
|
854
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
826
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TagUrn":
|
|
855
827
|
if len(entity_ids) != cls.URN_PARTS:
|
|
856
|
-
raise InvalidUrnError(f"
|
|
857
|
-
return cls(
|
|
828
|
+
raise InvalidUrnError(f"TagUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
829
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
858
830
|
|
|
859
831
|
@classmethod
|
|
860
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
861
|
-
from datahub.metadata.schema_classes import
|
|
832
|
+
def underlying_key_aspect_type(cls) -> Type["TagKeyClass"]:
|
|
833
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
862
834
|
|
|
863
|
-
return
|
|
835
|
+
return TagKeyClass
|
|
864
836
|
|
|
865
|
-
def to_key_aspect(self) -> "
|
|
866
|
-
from datahub.metadata.schema_classes import
|
|
837
|
+
def to_key_aspect(self) -> "TagKeyClass":
|
|
838
|
+
from datahub.metadata.schema_classes import TagKeyClass
|
|
867
839
|
|
|
868
|
-
return
|
|
840
|
+
return TagKeyClass(name=self.name)
|
|
869
841
|
|
|
870
842
|
@classmethod
|
|
871
|
-
def from_key_aspect(cls, key_aspect: "
|
|
872
|
-
return cls(
|
|
843
|
+
def from_key_aspect(cls, key_aspect: "TagKeyClass") -> "TagUrn":
|
|
844
|
+
return cls(name=key_aspect.name)
|
|
845
|
+
|
|
846
|
+
@classmethod
|
|
847
|
+
@deprecated(reason="Use the constructor instead")
|
|
848
|
+
def create_from_id(cls, id: str) -> "TagUrn":
|
|
849
|
+
return cls(id)
|
|
873
850
|
|
|
874
851
|
@property
|
|
875
|
-
def
|
|
852
|
+
def name(self) -> str:
|
|
876
853
|
return self.entity_ids[0]
|
|
877
854
|
|
|
878
855
|
if TYPE_CHECKING:
|
|
879
|
-
from datahub.metadata.schema_classes import
|
|
856
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
880
857
|
|
|
881
|
-
class
|
|
882
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
883
|
-
URN_PARTS: ClassVar[int] =
|
|
858
|
+
class NotebookUrn(_SpecificUrn):
|
|
859
|
+
ENTITY_TYPE: ClassVar[str] = "notebook"
|
|
860
|
+
URN_PARTS: ClassVar[int] = 2
|
|
884
861
|
|
|
885
|
-
def __init__(self,
|
|
862
|
+
def __init__(self, notebook_tool: str, notebook_id: str, *, _allow_coercion: bool = True) -> None:
|
|
886
863
|
if _allow_coercion:
|
|
887
864
|
# Field coercion logic (if any is required).
|
|
888
|
-
|
|
865
|
+
notebook_tool = UrnEncoder.encode_string(notebook_tool)
|
|
866
|
+
notebook_id = UrnEncoder.encode_string(notebook_id)
|
|
889
867
|
|
|
890
868
|
# Validation logic.
|
|
891
|
-
if not
|
|
892
|
-
raise InvalidUrnError("
|
|
893
|
-
if UrnEncoder.contains_reserved_char(
|
|
894
|
-
raise InvalidUrnError(f'
|
|
869
|
+
if not notebook_tool:
|
|
870
|
+
raise InvalidUrnError("NotebookUrn notebook_tool cannot be empty")
|
|
871
|
+
if UrnEncoder.contains_reserved_char(notebook_tool):
|
|
872
|
+
raise InvalidUrnError(f'NotebookUrn notebook_tool contains reserved characters')
|
|
873
|
+
if not notebook_id:
|
|
874
|
+
raise InvalidUrnError("NotebookUrn notebook_id cannot be empty")
|
|
875
|
+
if UrnEncoder.contains_reserved_char(notebook_id):
|
|
876
|
+
raise InvalidUrnError(f'NotebookUrn notebook_id contains reserved characters')
|
|
895
877
|
|
|
896
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
878
|
+
super().__init__(self.ENTITY_TYPE, [notebook_tool, notebook_id])
|
|
897
879
|
|
|
898
880
|
@classmethod
|
|
899
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
881
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "NotebookUrn":
|
|
900
882
|
if len(entity_ids) != cls.URN_PARTS:
|
|
901
|
-
raise InvalidUrnError(f"
|
|
902
|
-
return cls(
|
|
883
|
+
raise InvalidUrnError(f"NotebookUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
884
|
+
return cls(notebook_tool=entity_ids[0], notebook_id=entity_ids[1], _allow_coercion=False)
|
|
903
885
|
|
|
904
886
|
@classmethod
|
|
905
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
906
|
-
from datahub.metadata.schema_classes import
|
|
887
|
+
def underlying_key_aspect_type(cls) -> Type["NotebookKeyClass"]:
|
|
888
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
907
889
|
|
|
908
|
-
return
|
|
890
|
+
return NotebookKeyClass
|
|
909
891
|
|
|
910
|
-
def to_key_aspect(self) -> "
|
|
911
|
-
from datahub.metadata.schema_classes import
|
|
892
|
+
def to_key_aspect(self) -> "NotebookKeyClass":
|
|
893
|
+
from datahub.metadata.schema_classes import NotebookKeyClass
|
|
912
894
|
|
|
913
|
-
return
|
|
895
|
+
return NotebookKeyClass(notebookTool=self.notebook_tool, notebookId=self.notebook_id)
|
|
914
896
|
|
|
915
897
|
@classmethod
|
|
916
|
-
def from_key_aspect(cls, key_aspect: "
|
|
917
|
-
return cls(
|
|
898
|
+
def from_key_aspect(cls, key_aspect: "NotebookKeyClass") -> "NotebookUrn":
|
|
899
|
+
return cls(notebook_tool=key_aspect.notebookTool, notebook_id=key_aspect.notebookId)
|
|
900
|
+
|
|
901
|
+
@deprecated(reason="Use .notebook_tool instead")
|
|
902
|
+
def get_platform_id(self) -> str:
|
|
903
|
+
return self.notebook_tool
|
|
904
|
+
|
|
905
|
+
@deprecated(reason="Use .notebook_id instead")
|
|
906
|
+
def get_notebook_id(self) -> str:
|
|
907
|
+
return self.notebook_id
|
|
918
908
|
|
|
919
909
|
@property
|
|
920
|
-
def
|
|
910
|
+
def notebook_tool(self) -> str:
|
|
921
911
|
return self.entity_ids[0]
|
|
922
912
|
|
|
913
|
+
@property
|
|
914
|
+
def notebook_id(self) -> str:
|
|
915
|
+
return self.entity_ids[1]
|
|
916
|
+
|
|
923
917
|
if TYPE_CHECKING:
|
|
924
|
-
from datahub.metadata.schema_classes import
|
|
918
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
925
919
|
|
|
926
|
-
class
|
|
927
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
928
|
-
URN_PARTS: ClassVar[int] =
|
|
920
|
+
class DataHubAccessTokenUrn(_SpecificUrn):
|
|
921
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubAccessToken"
|
|
922
|
+
URN_PARTS: ClassVar[int] = 1
|
|
929
923
|
|
|
930
|
-
def __init__(self,
|
|
924
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
931
925
|
if _allow_coercion:
|
|
932
926
|
# Field coercion logic (if any is required).
|
|
933
|
-
|
|
927
|
+
id = UrnEncoder.encode_string(id)
|
|
934
928
|
|
|
935
929
|
# Validation logic.
|
|
936
|
-
if not
|
|
937
|
-
raise InvalidUrnError("
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
if not job_id:
|
|
941
|
-
raise InvalidUrnError("DataJobUrn job_id cannot be empty")
|
|
942
|
-
if UrnEncoder.contains_reserved_char(job_id):
|
|
943
|
-
raise InvalidUrnError(f'DataJobUrn job_id contains reserved characters')
|
|
930
|
+
if not id:
|
|
931
|
+
raise InvalidUrnError("DataHubAccessTokenUrn id cannot be empty")
|
|
932
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
933
|
+
raise InvalidUrnError(f'DataHubAccessTokenUrn id contains reserved characters')
|
|
944
934
|
|
|
945
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
935
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
946
936
|
|
|
947
937
|
@classmethod
|
|
948
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
938
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubAccessTokenUrn":
|
|
949
939
|
if len(entity_ids) != cls.URN_PARTS:
|
|
950
|
-
raise InvalidUrnError(f"
|
|
951
|
-
return cls(
|
|
952
|
-
|
|
953
|
-
@classmethod
|
|
954
|
-
def underlying_key_aspect_type(cls) -> Type["DataJobKeyClass"]:
|
|
955
|
-
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
956
|
-
|
|
957
|
-
return DataJobKeyClass
|
|
958
|
-
|
|
959
|
-
def to_key_aspect(self) -> "DataJobKeyClass":
|
|
960
|
-
from datahub.metadata.schema_classes import DataJobKeyClass
|
|
961
|
-
|
|
962
|
-
return DataJobKeyClass(flow=self.flow, jobId=self.job_id)
|
|
940
|
+
raise InvalidUrnError(f"DataHubAccessTokenUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
941
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
963
942
|
|
|
964
943
|
@classmethod
|
|
965
|
-
def
|
|
966
|
-
|
|
944
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubAccessTokenKeyClass"]:
|
|
945
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
967
946
|
|
|
968
|
-
|
|
969
|
-
def create_from_ids(cls, data_flow_urn: str, job_id: str) -> "DataJobUrn":
|
|
970
|
-
return cls(data_flow_urn, job_id)
|
|
947
|
+
return DataHubAccessTokenKeyClass
|
|
971
948
|
|
|
972
|
-
def
|
|
973
|
-
|
|
949
|
+
def to_key_aspect(self) -> "DataHubAccessTokenKeyClass":
|
|
950
|
+
from datahub.metadata.schema_classes import DataHubAccessTokenKeyClass
|
|
974
951
|
|
|
975
|
-
|
|
976
|
-
def get_job_id(self) -> str:
|
|
977
|
-
return self.job_id
|
|
952
|
+
return DataHubAccessTokenKeyClass(id=self.id)
|
|
978
953
|
|
|
979
|
-
@
|
|
980
|
-
def
|
|
981
|
-
return
|
|
954
|
+
@classmethod
|
|
955
|
+
def from_key_aspect(cls, key_aspect: "DataHubAccessTokenKeyClass") -> "DataHubAccessTokenUrn":
|
|
956
|
+
return cls(id=key_aspect.id)
|
|
982
957
|
|
|
983
958
|
@property
|
|
984
|
-
def
|
|
985
|
-
return self.entity_ids[
|
|
959
|
+
def id(self) -> str:
|
|
960
|
+
return self.entity_ids[0]
|
|
986
961
|
|
|
987
962
|
if TYPE_CHECKING:
|
|
988
|
-
from datahub.metadata.schema_classes import
|
|
963
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
989
964
|
|
|
990
|
-
class
|
|
991
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
965
|
+
class ErModelRelationshipUrn(_SpecificUrn):
|
|
966
|
+
ENTITY_TYPE: ClassVar[str] = "erModelRelationship"
|
|
992
967
|
URN_PARTS: ClassVar[int] = 1
|
|
993
968
|
|
|
994
969
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -998,31 +973,31 @@ class DataHubExecutionRequestUrn(_SpecificUrn):
|
|
|
998
973
|
|
|
999
974
|
# Validation logic.
|
|
1000
975
|
if not id:
|
|
1001
|
-
raise InvalidUrnError("
|
|
976
|
+
raise InvalidUrnError("ErModelRelationshipUrn id cannot be empty")
|
|
1002
977
|
if UrnEncoder.contains_reserved_char(id):
|
|
1003
|
-
raise InvalidUrnError(f'
|
|
978
|
+
raise InvalidUrnError(f'ErModelRelationshipUrn id contains reserved characters')
|
|
1004
979
|
|
|
1005
980
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1006
981
|
|
|
1007
982
|
@classmethod
|
|
1008
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
983
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ErModelRelationshipUrn":
|
|
1009
984
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1010
|
-
raise InvalidUrnError(f"
|
|
985
|
+
raise InvalidUrnError(f"ErModelRelationshipUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1011
986
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1012
987
|
|
|
1013
988
|
@classmethod
|
|
1014
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1015
|
-
from datahub.metadata.schema_classes import
|
|
989
|
+
def underlying_key_aspect_type(cls) -> Type["ERModelRelationshipKeyClass"]:
|
|
990
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
1016
991
|
|
|
1017
|
-
return
|
|
992
|
+
return ERModelRelationshipKeyClass
|
|
1018
993
|
|
|
1019
|
-
def to_key_aspect(self) -> "
|
|
1020
|
-
from datahub.metadata.schema_classes import
|
|
994
|
+
def to_key_aspect(self) -> "ERModelRelationshipKeyClass":
|
|
995
|
+
from datahub.metadata.schema_classes import ERModelRelationshipKeyClass
|
|
1021
996
|
|
|
1022
|
-
return
|
|
997
|
+
return ERModelRelationshipKeyClass(id=self.id)
|
|
1023
998
|
|
|
1024
999
|
@classmethod
|
|
1025
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1000
|
+
def from_key_aspect(cls, key_aspect: "ERModelRelationshipKeyClass") -> "ErModelRelationshipUrn":
|
|
1026
1001
|
return cls(id=key_aspect.id)
|
|
1027
1002
|
|
|
1028
1003
|
@property
|
|
@@ -1030,10 +1005,10 @@ class DataHubExecutionRequestUrn(_SpecificUrn):
|
|
|
1030
1005
|
return self.entity_ids[0]
|
|
1031
1006
|
|
|
1032
1007
|
if TYPE_CHECKING:
|
|
1033
|
-
from datahub.metadata.schema_classes import
|
|
1008
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1034
1009
|
|
|
1035
|
-
class
|
|
1036
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1010
|
+
class OwnershipTypeUrn(_SpecificUrn):
|
|
1011
|
+
ENTITY_TYPE: ClassVar[str] = "ownershipType"
|
|
1037
1012
|
URN_PARTS: ClassVar[int] = 1
|
|
1038
1013
|
|
|
1039
1014
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1043,31 +1018,31 @@ class TestUrn(_SpecificUrn):
|
|
|
1043
1018
|
|
|
1044
1019
|
# Validation logic.
|
|
1045
1020
|
if not id:
|
|
1046
|
-
raise InvalidUrnError("
|
|
1021
|
+
raise InvalidUrnError("OwnershipTypeUrn id cannot be empty")
|
|
1047
1022
|
if UrnEncoder.contains_reserved_char(id):
|
|
1048
|
-
raise InvalidUrnError(f'
|
|
1023
|
+
raise InvalidUrnError(f'OwnershipTypeUrn id contains reserved characters')
|
|
1049
1024
|
|
|
1050
1025
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1051
1026
|
|
|
1052
1027
|
@classmethod
|
|
1053
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1028
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "OwnershipTypeUrn":
|
|
1054
1029
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1055
|
-
raise InvalidUrnError(f"
|
|
1030
|
+
raise InvalidUrnError(f"OwnershipTypeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1056
1031
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1057
1032
|
|
|
1058
1033
|
@classmethod
|
|
1059
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1060
|
-
from datahub.metadata.schema_classes import
|
|
1034
|
+
def underlying_key_aspect_type(cls) -> Type["OwnershipTypeKeyClass"]:
|
|
1035
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1061
1036
|
|
|
1062
|
-
return
|
|
1037
|
+
return OwnershipTypeKeyClass
|
|
1063
1038
|
|
|
1064
|
-
def to_key_aspect(self) -> "
|
|
1065
|
-
from datahub.metadata.schema_classes import
|
|
1039
|
+
def to_key_aspect(self) -> "OwnershipTypeKeyClass":
|
|
1040
|
+
from datahub.metadata.schema_classes import OwnershipTypeKeyClass
|
|
1066
1041
|
|
|
1067
|
-
return
|
|
1042
|
+
return OwnershipTypeKeyClass(id=self.id)
|
|
1068
1043
|
|
|
1069
1044
|
@classmethod
|
|
1070
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1045
|
+
def from_key_aspect(cls, key_aspect: "OwnershipTypeKeyClass") -> "OwnershipTypeUrn":
|
|
1071
1046
|
return cls(id=key_aspect.id)
|
|
1072
1047
|
|
|
1073
1048
|
@property
|
|
@@ -1075,241 +1050,190 @@ class TestUrn(_SpecificUrn):
|
|
|
1075
1050
|
return self.entity_ids[0]
|
|
1076
1051
|
|
|
1077
1052
|
if TYPE_CHECKING:
|
|
1078
|
-
from datahub.metadata.schema_classes import
|
|
1053
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1079
1054
|
|
|
1080
|
-
class
|
|
1081
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1082
|
-
URN_PARTS: ClassVar[int] =
|
|
1055
|
+
class QueryUrn(_SpecificUrn):
|
|
1056
|
+
ENTITY_TYPE: ClassVar[str] = "query"
|
|
1057
|
+
URN_PARTS: ClassVar[int] = 1
|
|
1083
1058
|
|
|
1084
|
-
def __init__(self,
|
|
1059
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1085
1060
|
if _allow_coercion:
|
|
1086
1061
|
# Field coercion logic (if any is required).
|
|
1087
|
-
|
|
1088
|
-
name = UrnEncoder.encode_string(name)
|
|
1089
|
-
env = env.upper()
|
|
1090
|
-
env = UrnEncoder.encode_string(env)
|
|
1062
|
+
id = UrnEncoder.encode_string(id)
|
|
1091
1063
|
|
|
1092
1064
|
# Validation logic.
|
|
1093
|
-
if not
|
|
1094
|
-
raise InvalidUrnError("
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
if not name:
|
|
1098
|
-
raise InvalidUrnError("MlModelDeploymentUrn name cannot be empty")
|
|
1099
|
-
if UrnEncoder.contains_reserved_char(name):
|
|
1100
|
-
raise InvalidUrnError(f'MlModelDeploymentUrn name contains reserved characters')
|
|
1101
|
-
if not env:
|
|
1102
|
-
raise InvalidUrnError("MlModelDeploymentUrn env cannot be empty")
|
|
1103
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
1104
|
-
raise InvalidUrnError(f'MlModelDeploymentUrn env contains reserved characters')
|
|
1065
|
+
if not id:
|
|
1066
|
+
raise InvalidUrnError("QueryUrn id cannot be empty")
|
|
1067
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1068
|
+
raise InvalidUrnError(f'QueryUrn id contains reserved characters')
|
|
1105
1069
|
|
|
1106
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1070
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1107
1071
|
|
|
1108
1072
|
@classmethod
|
|
1109
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1073
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "QueryUrn":
|
|
1110
1074
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1111
|
-
raise InvalidUrnError(f"
|
|
1112
|
-
return cls(
|
|
1075
|
+
raise InvalidUrnError(f"QueryUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1076
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1113
1077
|
|
|
1114
1078
|
@classmethod
|
|
1115
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1116
|
-
from datahub.metadata.schema_classes import
|
|
1079
|
+
def underlying_key_aspect_type(cls) -> Type["QueryKeyClass"]:
|
|
1080
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1117
1081
|
|
|
1118
|
-
return
|
|
1082
|
+
return QueryKeyClass
|
|
1119
1083
|
|
|
1120
|
-
def to_key_aspect(self) -> "
|
|
1121
|
-
from datahub.metadata.schema_classes import
|
|
1084
|
+
def to_key_aspect(self) -> "QueryKeyClass":
|
|
1085
|
+
from datahub.metadata.schema_classes import QueryKeyClass
|
|
1122
1086
|
|
|
1123
|
-
return
|
|
1087
|
+
return QueryKeyClass(id=self.id)
|
|
1124
1088
|
|
|
1125
1089
|
@classmethod
|
|
1126
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1127
|
-
return cls(
|
|
1090
|
+
def from_key_aspect(cls, key_aspect: "QueryKeyClass") -> "QueryUrn":
|
|
1091
|
+
return cls(id=key_aspect.id)
|
|
1128
1092
|
|
|
1129
1093
|
@property
|
|
1130
|
-
def
|
|
1094
|
+
def id(self) -> str:
|
|
1131
1095
|
return self.entity_ids[0]
|
|
1132
1096
|
|
|
1133
|
-
@property
|
|
1134
|
-
def name(self) -> str:
|
|
1135
|
-
return self.entity_ids[1]
|
|
1136
|
-
|
|
1137
|
-
@property
|
|
1138
|
-
def env(self) -> str:
|
|
1139
|
-
return self.entity_ids[2]
|
|
1140
|
-
|
|
1141
1097
|
if TYPE_CHECKING:
|
|
1142
|
-
from datahub.metadata.schema_classes import
|
|
1098
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
1143
1099
|
|
|
1144
|
-
class
|
|
1145
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1146
|
-
URN_PARTS: ClassVar[int] =
|
|
1100
|
+
class AssertionUrn(_SpecificUrn):
|
|
1101
|
+
ENTITY_TYPE: ClassVar[str] = "assertion"
|
|
1102
|
+
URN_PARTS: ClassVar[int] = 1
|
|
1147
1103
|
|
|
1148
|
-
def __init__(self,
|
|
1104
|
+
def __init__(self, assertion_id: str, *, _allow_coercion: bool = True) -> None:
|
|
1149
1105
|
if _allow_coercion:
|
|
1150
1106
|
# Field coercion logic (if any is required).
|
|
1151
|
-
|
|
1152
|
-
name = UrnEncoder.encode_string(name)
|
|
1153
|
-
env = env.upper()
|
|
1154
|
-
env = UrnEncoder.encode_string(env)
|
|
1107
|
+
assertion_id = UrnEncoder.encode_string(assertion_id)
|
|
1155
1108
|
|
|
1156
1109
|
# Validation logic.
|
|
1157
|
-
if not
|
|
1158
|
-
raise InvalidUrnError("
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
if not name:
|
|
1162
|
-
raise InvalidUrnError("MlModelGroupUrn name cannot be empty")
|
|
1163
|
-
if UrnEncoder.contains_reserved_char(name):
|
|
1164
|
-
raise InvalidUrnError(f'MlModelGroupUrn name contains reserved characters')
|
|
1165
|
-
if not env:
|
|
1166
|
-
raise InvalidUrnError("MlModelGroupUrn env cannot be empty")
|
|
1167
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
1168
|
-
raise InvalidUrnError(f'MlModelGroupUrn env contains reserved characters')
|
|
1110
|
+
if not assertion_id:
|
|
1111
|
+
raise InvalidUrnError("AssertionUrn assertion_id cannot be empty")
|
|
1112
|
+
if UrnEncoder.contains_reserved_char(assertion_id):
|
|
1113
|
+
raise InvalidUrnError(f'AssertionUrn assertion_id contains reserved characters')
|
|
1169
1114
|
|
|
1170
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1115
|
+
super().__init__(self.ENTITY_TYPE, [assertion_id])
|
|
1171
1116
|
|
|
1172
1117
|
@classmethod
|
|
1173
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1118
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "AssertionUrn":
|
|
1174
1119
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1175
|
-
raise InvalidUrnError(f"
|
|
1176
|
-
return cls(
|
|
1120
|
+
raise InvalidUrnError(f"AssertionUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1121
|
+
return cls(assertion_id=entity_ids[0], _allow_coercion=False)
|
|
1177
1122
|
|
|
1178
1123
|
@classmethod
|
|
1179
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1180
|
-
from datahub.metadata.schema_classes import
|
|
1124
|
+
def underlying_key_aspect_type(cls) -> Type["AssertionKeyClass"]:
|
|
1125
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
1181
1126
|
|
|
1182
|
-
return
|
|
1127
|
+
return AssertionKeyClass
|
|
1183
1128
|
|
|
1184
|
-
def to_key_aspect(self) -> "
|
|
1185
|
-
from datahub.metadata.schema_classes import
|
|
1129
|
+
def to_key_aspect(self) -> "AssertionKeyClass":
|
|
1130
|
+
from datahub.metadata.schema_classes import AssertionKeyClass
|
|
1186
1131
|
|
|
1187
|
-
return
|
|
1132
|
+
return AssertionKeyClass(assertionId=self.assertion_id)
|
|
1188
1133
|
|
|
1189
1134
|
@classmethod
|
|
1190
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1191
|
-
return cls(
|
|
1135
|
+
def from_key_aspect(cls, key_aspect: "AssertionKeyClass") -> "AssertionUrn":
|
|
1136
|
+
return cls(assertion_id=key_aspect.assertionId)
|
|
1192
1137
|
|
|
1193
1138
|
@property
|
|
1194
|
-
def
|
|
1139
|
+
def assertion_id(self) -> str:
|
|
1195
1140
|
return self.entity_ids[0]
|
|
1196
1141
|
|
|
1197
|
-
@property
|
|
1198
|
-
def name(self) -> str:
|
|
1199
|
-
return self.entity_ids[1]
|
|
1200
|
-
|
|
1201
|
-
@property
|
|
1202
|
-
def env(self) -> str:
|
|
1203
|
-
return self.entity_ids[2]
|
|
1204
|
-
|
|
1205
1142
|
if TYPE_CHECKING:
|
|
1206
|
-
from datahub.metadata.schema_classes import
|
|
1143
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
1207
1144
|
|
|
1208
|
-
class
|
|
1209
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1210
|
-
URN_PARTS: ClassVar[int] =
|
|
1145
|
+
class DataContractUrn(_SpecificUrn):
|
|
1146
|
+
ENTITY_TYPE: ClassVar[str] = "dataContract"
|
|
1147
|
+
URN_PARTS: ClassVar[int] = 1
|
|
1211
1148
|
|
|
1212
|
-
def __init__(self,
|
|
1149
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1213
1150
|
if _allow_coercion:
|
|
1214
1151
|
# Field coercion logic (if any is required).
|
|
1215
|
-
|
|
1152
|
+
id = UrnEncoder.encode_string(id)
|
|
1216
1153
|
|
|
1217
1154
|
# Validation logic.
|
|
1218
|
-
if not
|
|
1219
|
-
raise InvalidUrnError("
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
if not field_path:
|
|
1223
|
-
raise InvalidUrnError("SchemaFieldUrn field_path cannot be empty")
|
|
1224
|
-
if UrnEncoder.contains_reserved_char(field_path):
|
|
1225
|
-
raise InvalidUrnError(f'SchemaFieldUrn field_path contains reserved characters')
|
|
1155
|
+
if not id:
|
|
1156
|
+
raise InvalidUrnError("DataContractUrn id cannot be empty")
|
|
1157
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1158
|
+
raise InvalidUrnError(f'DataContractUrn id contains reserved characters')
|
|
1226
1159
|
|
|
1227
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1160
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1228
1161
|
|
|
1229
1162
|
@classmethod
|
|
1230
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1163
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataContractUrn":
|
|
1231
1164
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1232
|
-
raise InvalidUrnError(f"
|
|
1233
|
-
return cls(
|
|
1165
|
+
raise InvalidUrnError(f"DataContractUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1166
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1234
1167
|
|
|
1235
1168
|
@classmethod
|
|
1236
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1237
|
-
from datahub.metadata.schema_classes import
|
|
1169
|
+
def underlying_key_aspect_type(cls) -> Type["DataContractKeyClass"]:
|
|
1170
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
1238
1171
|
|
|
1239
|
-
return
|
|
1172
|
+
return DataContractKeyClass
|
|
1240
1173
|
|
|
1241
|
-
def to_key_aspect(self) -> "
|
|
1242
|
-
from datahub.metadata.schema_classes import
|
|
1174
|
+
def to_key_aspect(self) -> "DataContractKeyClass":
|
|
1175
|
+
from datahub.metadata.schema_classes import DataContractKeyClass
|
|
1243
1176
|
|
|
1244
|
-
return
|
|
1177
|
+
return DataContractKeyClass(id=self.id)
|
|
1245
1178
|
|
|
1246
1179
|
@classmethod
|
|
1247
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1248
|
-
return cls(
|
|
1180
|
+
def from_key_aspect(cls, key_aspect: "DataContractKeyClass") -> "DataContractUrn":
|
|
1181
|
+
return cls(id=key_aspect.id)
|
|
1249
1182
|
|
|
1250
1183
|
@property
|
|
1251
|
-
def
|
|
1184
|
+
def id(self) -> str:
|
|
1252
1185
|
return self.entity_ids[0]
|
|
1253
1186
|
|
|
1254
|
-
@property
|
|
1255
|
-
def field_path(self) -> str:
|
|
1256
|
-
return self.entity_ids[1]
|
|
1257
|
-
|
|
1258
1187
|
if TYPE_CHECKING:
|
|
1259
|
-
from datahub.metadata.schema_classes import
|
|
1260
|
-
|
|
1261
|
-
class
|
|
1262
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1188
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
1189
|
+
|
|
1190
|
+
class DataHubPolicyUrn(_SpecificUrn):
|
|
1191
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubPolicy"
|
|
1263
1192
|
URN_PARTS: ClassVar[int] = 1
|
|
1264
1193
|
|
|
1265
|
-
def __init__(self,
|
|
1194
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1266
1195
|
if _allow_coercion:
|
|
1267
1196
|
# Field coercion logic (if any is required).
|
|
1268
|
-
|
|
1197
|
+
id = UrnEncoder.encode_string(id)
|
|
1269
1198
|
|
|
1270
1199
|
# Validation logic.
|
|
1271
|
-
if not
|
|
1272
|
-
raise InvalidUrnError("
|
|
1273
|
-
if UrnEncoder.contains_reserved_char(
|
|
1274
|
-
raise InvalidUrnError(f'
|
|
1200
|
+
if not id:
|
|
1201
|
+
raise InvalidUrnError("DataHubPolicyUrn id cannot be empty")
|
|
1202
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1203
|
+
raise InvalidUrnError(f'DataHubPolicyUrn id contains reserved characters')
|
|
1275
1204
|
|
|
1276
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1205
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1277
1206
|
|
|
1278
1207
|
@classmethod
|
|
1279
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1208
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubPolicyUrn":
|
|
1280
1209
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1281
|
-
raise InvalidUrnError(f"
|
|
1282
|
-
return cls(
|
|
1210
|
+
raise InvalidUrnError(f"DataHubPolicyUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1211
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1283
1212
|
|
|
1284
1213
|
@classmethod
|
|
1285
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1286
|
-
from datahub.metadata.schema_classes import
|
|
1287
|
-
|
|
1288
|
-
return CorpGroupKeyClass
|
|
1214
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubPolicyKeyClass"]:
|
|
1215
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
1289
1216
|
|
|
1290
|
-
|
|
1291
|
-
from datahub.metadata.schema_classes import CorpGroupKeyClass
|
|
1217
|
+
return DataHubPolicyKeyClass
|
|
1292
1218
|
|
|
1293
|
-
|
|
1219
|
+
def to_key_aspect(self) -> "DataHubPolicyKeyClass":
|
|
1220
|
+
from datahub.metadata.schema_classes import DataHubPolicyKeyClass
|
|
1294
1221
|
|
|
1295
|
-
|
|
1296
|
-
def from_key_aspect(cls, key_aspect: "CorpGroupKeyClass") -> "CorpGroupUrn":
|
|
1297
|
-
return cls(name=key_aspect.name)
|
|
1222
|
+
return DataHubPolicyKeyClass(id=self.id)
|
|
1298
1223
|
|
|
1299
1224
|
@classmethod
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
return cls(id)
|
|
1225
|
+
def from_key_aspect(cls, key_aspect: "DataHubPolicyKeyClass") -> "DataHubPolicyUrn":
|
|
1226
|
+
return cls(id=key_aspect.id)
|
|
1303
1227
|
|
|
1304
1228
|
@property
|
|
1305
|
-
def
|
|
1229
|
+
def id(self) -> str:
|
|
1306
1230
|
return self.entity_ids[0]
|
|
1307
1231
|
|
|
1308
1232
|
if TYPE_CHECKING:
|
|
1309
|
-
from datahub.metadata.schema_classes import
|
|
1233
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1310
1234
|
|
|
1311
|
-
class
|
|
1312
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1235
|
+
class DataHubActionUrn(_SpecificUrn):
|
|
1236
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubAction"
|
|
1313
1237
|
URN_PARTS: ClassVar[int] = 1
|
|
1314
1238
|
|
|
1315
1239
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1319,31 +1243,31 @@ class DataHubUpgradeUrn(_SpecificUrn):
|
|
|
1319
1243
|
|
|
1320
1244
|
# Validation logic.
|
|
1321
1245
|
if not id:
|
|
1322
|
-
raise InvalidUrnError("
|
|
1246
|
+
raise InvalidUrnError("DataHubActionUrn id cannot be empty")
|
|
1323
1247
|
if UrnEncoder.contains_reserved_char(id):
|
|
1324
|
-
raise InvalidUrnError(f'
|
|
1248
|
+
raise InvalidUrnError(f'DataHubActionUrn id contains reserved characters')
|
|
1325
1249
|
|
|
1326
1250
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1327
1251
|
|
|
1328
1252
|
@classmethod
|
|
1329
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1253
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubActionUrn":
|
|
1330
1254
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1331
|
-
raise InvalidUrnError(f"
|
|
1255
|
+
raise InvalidUrnError(f"DataHubActionUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1332
1256
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1333
1257
|
|
|
1334
1258
|
@classmethod
|
|
1335
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1336
|
-
from datahub.metadata.schema_classes import
|
|
1259
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubActionKeyClass"]:
|
|
1260
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1337
1261
|
|
|
1338
|
-
return
|
|
1262
|
+
return DataHubActionKeyClass
|
|
1339
1263
|
|
|
1340
|
-
def to_key_aspect(self) -> "
|
|
1341
|
-
from datahub.metadata.schema_classes import
|
|
1264
|
+
def to_key_aspect(self) -> "DataHubActionKeyClass":
|
|
1265
|
+
from datahub.metadata.schema_classes import DataHubActionKeyClass
|
|
1342
1266
|
|
|
1343
|
-
return
|
|
1267
|
+
return DataHubActionKeyClass(id=self.id)
|
|
1344
1268
|
|
|
1345
1269
|
@classmethod
|
|
1346
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1270
|
+
def from_key_aspect(cls, key_aspect: "DataHubActionKeyClass") -> "DataHubActionUrn":
|
|
1347
1271
|
return cls(id=key_aspect.id)
|
|
1348
1272
|
|
|
1349
1273
|
@property
|
|
@@ -1351,109 +1275,119 @@ class DataHubUpgradeUrn(_SpecificUrn):
|
|
|
1351
1275
|
return self.entity_ids[0]
|
|
1352
1276
|
|
|
1353
1277
|
if TYPE_CHECKING:
|
|
1354
|
-
from datahub.metadata.schema_classes import
|
|
1278
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
1355
1279
|
|
|
1356
|
-
class
|
|
1357
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1280
|
+
class ContainerUrn(_SpecificUrn):
|
|
1281
|
+
ENTITY_TYPE: ClassVar[str] = "container"
|
|
1358
1282
|
URN_PARTS: ClassVar[int] = 1
|
|
1359
1283
|
|
|
1360
|
-
def __init__(self,
|
|
1284
|
+
def __init__(self, guid: str, *, _allow_coercion: bool = True) -> None:
|
|
1361
1285
|
if _allow_coercion:
|
|
1362
1286
|
# Field coercion logic (if any is required).
|
|
1363
|
-
|
|
1287
|
+
guid = UrnEncoder.encode_string(guid)
|
|
1364
1288
|
|
|
1365
1289
|
# Validation logic.
|
|
1366
|
-
if not
|
|
1367
|
-
raise InvalidUrnError("
|
|
1368
|
-
if UrnEncoder.contains_reserved_char(
|
|
1369
|
-
raise InvalidUrnError(f'
|
|
1290
|
+
if not guid:
|
|
1291
|
+
raise InvalidUrnError("ContainerUrn guid cannot be empty")
|
|
1292
|
+
if UrnEncoder.contains_reserved_char(guid):
|
|
1293
|
+
raise InvalidUrnError(f'ContainerUrn guid contains reserved characters')
|
|
1370
1294
|
|
|
1371
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1295
|
+
super().__init__(self.ENTITY_TYPE, [guid])
|
|
1372
1296
|
|
|
1373
1297
|
@classmethod
|
|
1374
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1298
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ContainerUrn":
|
|
1375
1299
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1376
|
-
raise InvalidUrnError(f"
|
|
1377
|
-
return cls(
|
|
1300
|
+
raise InvalidUrnError(f"ContainerUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1301
|
+
return cls(guid=entity_ids[0], _allow_coercion=False)
|
|
1378
1302
|
|
|
1379
1303
|
@classmethod
|
|
1380
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1381
|
-
from datahub.metadata.schema_classes import
|
|
1304
|
+
def underlying_key_aspect_type(cls) -> Type["ContainerKeyClass"]:
|
|
1305
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
1382
1306
|
|
|
1383
|
-
return
|
|
1307
|
+
return ContainerKeyClass
|
|
1384
1308
|
|
|
1385
|
-
def to_key_aspect(self) -> "
|
|
1386
|
-
from datahub.metadata.schema_classes import
|
|
1309
|
+
def to_key_aspect(self) -> "ContainerKeyClass":
|
|
1310
|
+
from datahub.metadata.schema_classes import ContainerKeyClass
|
|
1387
1311
|
|
|
1388
|
-
return
|
|
1312
|
+
return ContainerKeyClass(guid=self.guid)
|
|
1389
1313
|
|
|
1390
1314
|
@classmethod
|
|
1391
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1392
|
-
return cls(
|
|
1315
|
+
def from_key_aspect(cls, key_aspect: "ContainerKeyClass") -> "ContainerUrn":
|
|
1316
|
+
return cls(guid=key_aspect.guid)
|
|
1393
1317
|
|
|
1394
1318
|
@property
|
|
1395
|
-
def
|
|
1319
|
+
def guid(self) -> str:
|
|
1396
1320
|
return self.entity_ids[0]
|
|
1397
1321
|
|
|
1398
1322
|
if TYPE_CHECKING:
|
|
1399
|
-
from datahub.metadata.schema_classes import
|
|
1323
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
1400
1324
|
|
|
1401
|
-
class
|
|
1402
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1403
|
-
URN_PARTS: ClassVar[int] =
|
|
1325
|
+
class DataProcessUrn(_SpecificUrn):
|
|
1326
|
+
ENTITY_TYPE: ClassVar[str] = "dataProcess"
|
|
1327
|
+
URN_PARTS: ClassVar[int] = 3
|
|
1404
1328
|
|
|
1405
|
-
def __init__(self,
|
|
1329
|
+
def __init__(self, name: str, orchestrator: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
1406
1330
|
if _allow_coercion:
|
|
1407
1331
|
# Field coercion logic (if any is required).
|
|
1408
|
-
platform = DataPlatformUrn(platform).urn()
|
|
1409
1332
|
name = UrnEncoder.encode_string(name)
|
|
1333
|
+
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
1334
|
+
env = env.upper()
|
|
1335
|
+
env = UrnEncoder.encode_string(env)
|
|
1410
1336
|
|
|
1411
1337
|
# Validation logic.
|
|
1412
|
-
if not platform:
|
|
1413
|
-
raise InvalidUrnError("MlFeatureTableUrn platform cannot be empty")
|
|
1414
|
-
platform = str(platform)
|
|
1415
|
-
assert DataPlatformUrn.from_string(platform)
|
|
1416
1338
|
if not name:
|
|
1417
|
-
raise InvalidUrnError("
|
|
1339
|
+
raise InvalidUrnError("DataProcessUrn name cannot be empty")
|
|
1418
1340
|
if UrnEncoder.contains_reserved_char(name):
|
|
1419
|
-
raise InvalidUrnError(f'
|
|
1341
|
+
raise InvalidUrnError(f'DataProcessUrn name contains reserved characters')
|
|
1342
|
+
if not orchestrator:
|
|
1343
|
+
raise InvalidUrnError("DataProcessUrn orchestrator cannot be empty")
|
|
1344
|
+
if UrnEncoder.contains_reserved_char(orchestrator):
|
|
1345
|
+
raise InvalidUrnError(f'DataProcessUrn orchestrator contains reserved characters')
|
|
1346
|
+
if not env:
|
|
1347
|
+
raise InvalidUrnError("DataProcessUrn env cannot be empty")
|
|
1348
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
1349
|
+
raise InvalidUrnError(f'DataProcessUrn env contains reserved characters')
|
|
1420
1350
|
|
|
1421
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1351
|
+
super().__init__(self.ENTITY_TYPE, [name, orchestrator, env])
|
|
1422
1352
|
|
|
1423
1353
|
@classmethod
|
|
1424
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1354
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataProcessUrn":
|
|
1425
1355
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1426
|
-
raise InvalidUrnError(f"
|
|
1427
|
-
return cls(
|
|
1356
|
+
raise InvalidUrnError(f"DataProcessUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1357
|
+
return cls(name=entity_ids[0], orchestrator=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1428
1358
|
|
|
1429
1359
|
@classmethod
|
|
1430
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1431
|
-
from datahub.metadata.schema_classes import
|
|
1360
|
+
def underlying_key_aspect_type(cls) -> Type["DataProcessKeyClass"]:
|
|
1361
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
1432
1362
|
|
|
1433
|
-
return
|
|
1363
|
+
return DataProcessKeyClass
|
|
1434
1364
|
|
|
1435
|
-
def to_key_aspect(self) -> "
|
|
1436
|
-
from datahub.metadata.schema_classes import
|
|
1365
|
+
def to_key_aspect(self) -> "DataProcessKeyClass":
|
|
1366
|
+
from datahub.metadata.schema_classes import DataProcessKeyClass
|
|
1437
1367
|
|
|
1438
|
-
return
|
|
1368
|
+
return DataProcessKeyClass(name=self.name, orchestrator=self.orchestrator, origin=self.env)
|
|
1439
1369
|
|
|
1440
1370
|
@classmethod
|
|
1441
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1442
|
-
return cls(
|
|
1371
|
+
def from_key_aspect(cls, key_aspect: "DataProcessKeyClass") -> "DataProcessUrn":
|
|
1372
|
+
return cls(name=key_aspect.name, orchestrator=key_aspect.orchestrator, env=key_aspect.origin)
|
|
1443
1373
|
|
|
1444
1374
|
@property
|
|
1445
|
-
def
|
|
1375
|
+
def name(self) -> str:
|
|
1446
1376
|
return self.entity_ids[0]
|
|
1447
1377
|
|
|
1448
1378
|
@property
|
|
1449
|
-
def
|
|
1379
|
+
def orchestrator(self) -> str:
|
|
1450
1380
|
return self.entity_ids[1]
|
|
1451
1381
|
|
|
1382
|
+
@property
|
|
1383
|
+
def env(self) -> str:
|
|
1384
|
+
return self.entity_ids[2]
|
|
1385
|
+
|
|
1452
1386
|
if TYPE_CHECKING:
|
|
1453
|
-
from datahub.metadata.schema_classes import
|
|
1387
|
+
from datahub.metadata.schema_classes import DataHubViewKeyClass
|
|
1454
1388
|
|
|
1455
|
-
class
|
|
1456
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1389
|
+
class DataHubViewUrn(_SpecificUrn):
|
|
1390
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubView"
|
|
1457
1391
|
URN_PARTS: ClassVar[int] = 1
|
|
1458
1392
|
|
|
1459
1393
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1463,135 +1397,179 @@ class DataHubPersonaUrn(_SpecificUrn):
|
|
|
1463
1397
|
|
|
1464
1398
|
# Validation logic.
|
|
1465
1399
|
if not id:
|
|
1466
|
-
raise InvalidUrnError("
|
|
1400
|
+
raise InvalidUrnError("DataHubViewUrn id cannot be empty")
|
|
1467
1401
|
if UrnEncoder.contains_reserved_char(id):
|
|
1468
|
-
raise InvalidUrnError(f'
|
|
1402
|
+
raise InvalidUrnError(f'DataHubViewUrn id contains reserved characters')
|
|
1469
1403
|
|
|
1470
1404
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1471
1405
|
|
|
1472
1406
|
@classmethod
|
|
1473
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1407
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubViewUrn":
|
|
1474
1408
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1475
|
-
raise InvalidUrnError(f"
|
|
1409
|
+
raise InvalidUrnError(f"DataHubViewUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1476
1410
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1477
1411
|
|
|
1478
1412
|
@classmethod
|
|
1479
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1480
|
-
from datahub.metadata.schema_classes import
|
|
1413
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubViewKeyClass"]:
|
|
1414
|
+
from datahub.metadata.schema_classes import DataHubViewKeyClass
|
|
1481
1415
|
|
|
1482
|
-
return
|
|
1416
|
+
return DataHubViewKeyClass
|
|
1483
1417
|
|
|
1484
|
-
def to_key_aspect(self) -> "
|
|
1485
|
-
from datahub.metadata.schema_classes import
|
|
1418
|
+
def to_key_aspect(self) -> "DataHubViewKeyClass":
|
|
1419
|
+
from datahub.metadata.schema_classes import DataHubViewKeyClass
|
|
1486
1420
|
|
|
1487
|
-
return
|
|
1421
|
+
return DataHubViewKeyClass(id=self.id)
|
|
1488
1422
|
|
|
1489
1423
|
@classmethod
|
|
1490
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1424
|
+
def from_key_aspect(cls, key_aspect: "DataHubViewKeyClass") -> "DataHubViewUrn":
|
|
1491
1425
|
return cls(id=key_aspect.id)
|
|
1492
1426
|
|
|
1493
1427
|
@property
|
|
1494
|
-
def id(self) -> str:
|
|
1428
|
+
def id(self) -> str:
|
|
1429
|
+
return self.entity_ids[0]
|
|
1430
|
+
|
|
1431
|
+
if TYPE_CHECKING:
|
|
1432
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
1433
|
+
|
|
1434
|
+
class DataPlatformInstanceUrn(_SpecificUrn):
|
|
1435
|
+
ENTITY_TYPE: ClassVar[str] = "dataPlatformInstance"
|
|
1436
|
+
URN_PARTS: ClassVar[int] = 2
|
|
1437
|
+
|
|
1438
|
+
def __init__(self, platform: str, instance: str, *, _allow_coercion: bool = True) -> None:
|
|
1439
|
+
if _allow_coercion:
|
|
1440
|
+
# Field coercion logic (if any is required).
|
|
1441
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1442
|
+
instance = UrnEncoder.encode_string(instance)
|
|
1443
|
+
|
|
1444
|
+
# Validation logic.
|
|
1445
|
+
if not platform:
|
|
1446
|
+
raise InvalidUrnError("DataPlatformInstanceUrn platform cannot be empty")
|
|
1447
|
+
platform = str(platform)
|
|
1448
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1449
|
+
if not instance:
|
|
1450
|
+
raise InvalidUrnError("DataPlatformInstanceUrn instance cannot be empty")
|
|
1451
|
+
if UrnEncoder.contains_reserved_char(instance):
|
|
1452
|
+
raise InvalidUrnError(f'DataPlatformInstanceUrn instance contains reserved characters')
|
|
1453
|
+
|
|
1454
|
+
super().__init__(self.ENTITY_TYPE, [platform, instance])
|
|
1455
|
+
|
|
1456
|
+
@classmethod
|
|
1457
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataPlatformInstanceUrn":
|
|
1458
|
+
if len(entity_ids) != cls.URN_PARTS:
|
|
1459
|
+
raise InvalidUrnError(f"DataPlatformInstanceUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1460
|
+
return cls(platform=entity_ids[0], instance=entity_ids[1], _allow_coercion=False)
|
|
1461
|
+
|
|
1462
|
+
@classmethod
|
|
1463
|
+
def underlying_key_aspect_type(cls) -> Type["DataPlatformInstanceKeyClass"]:
|
|
1464
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
1465
|
+
|
|
1466
|
+
return DataPlatformInstanceKeyClass
|
|
1467
|
+
|
|
1468
|
+
def to_key_aspect(self) -> "DataPlatformInstanceKeyClass":
|
|
1469
|
+
from datahub.metadata.schema_classes import DataPlatformInstanceKeyClass
|
|
1470
|
+
|
|
1471
|
+
return DataPlatformInstanceKeyClass(platform=self.platform, instance=self.instance)
|
|
1472
|
+
|
|
1473
|
+
@classmethod
|
|
1474
|
+
def from_key_aspect(cls, key_aspect: "DataPlatformInstanceKeyClass") -> "DataPlatformInstanceUrn":
|
|
1475
|
+
return cls(platform=key_aspect.platform, instance=key_aspect.instance)
|
|
1476
|
+
|
|
1477
|
+
@property
|
|
1478
|
+
def platform(self) -> str:
|
|
1495
1479
|
return self.entity_ids[0]
|
|
1496
1480
|
|
|
1481
|
+
@property
|
|
1482
|
+
def instance(self) -> str:
|
|
1483
|
+
return self.entity_ids[1]
|
|
1484
|
+
|
|
1497
1485
|
if TYPE_CHECKING:
|
|
1498
|
-
from datahub.metadata.schema_classes import
|
|
1486
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
1499
1487
|
|
|
1500
|
-
class
|
|
1501
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1488
|
+
class RoleUrn(_SpecificUrn):
|
|
1489
|
+
ENTITY_TYPE: ClassVar[str] = "role"
|
|
1502
1490
|
URN_PARTS: ClassVar[int] = 1
|
|
1503
1491
|
|
|
1504
|
-
def __init__(self,
|
|
1492
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1505
1493
|
if _allow_coercion:
|
|
1506
1494
|
# Field coercion logic (if any is required).
|
|
1507
|
-
|
|
1495
|
+
id = UrnEncoder.encode_string(id)
|
|
1508
1496
|
|
|
1509
1497
|
# Validation logic.
|
|
1510
|
-
if not
|
|
1511
|
-
raise InvalidUrnError("
|
|
1512
|
-
if UrnEncoder.contains_reserved_char(
|
|
1513
|
-
raise InvalidUrnError(f'
|
|
1498
|
+
if not id:
|
|
1499
|
+
raise InvalidUrnError("RoleUrn id cannot be empty")
|
|
1500
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1501
|
+
raise InvalidUrnError(f'RoleUrn id contains reserved characters')
|
|
1514
1502
|
|
|
1515
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1503
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1516
1504
|
|
|
1517
1505
|
@classmethod
|
|
1518
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1506
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "RoleUrn":
|
|
1519
1507
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1520
|
-
raise InvalidUrnError(f"
|
|
1521
|
-
return cls(
|
|
1508
|
+
raise InvalidUrnError(f"RoleUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1509
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1522
1510
|
|
|
1523
1511
|
@classmethod
|
|
1524
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1525
|
-
from datahub.metadata.schema_classes import
|
|
1526
|
-
|
|
1527
|
-
return TagKeyClass
|
|
1512
|
+
def underlying_key_aspect_type(cls) -> Type["RoleKeyClass"]:
|
|
1513
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
1528
1514
|
|
|
1529
|
-
|
|
1530
|
-
from datahub.metadata.schema_classes import TagKeyClass
|
|
1515
|
+
return RoleKeyClass
|
|
1531
1516
|
|
|
1532
|
-
|
|
1517
|
+
def to_key_aspect(self) -> "RoleKeyClass":
|
|
1518
|
+
from datahub.metadata.schema_classes import RoleKeyClass
|
|
1533
1519
|
|
|
1534
|
-
|
|
1535
|
-
def from_key_aspect(cls, key_aspect: "TagKeyClass") -> "TagUrn":
|
|
1536
|
-
return cls(name=key_aspect.name)
|
|
1520
|
+
return RoleKeyClass(id=self.id)
|
|
1537
1521
|
|
|
1538
1522
|
@classmethod
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
return cls(id)
|
|
1523
|
+
def from_key_aspect(cls, key_aspect: "RoleKeyClass") -> "RoleUrn":
|
|
1524
|
+
return cls(id=key_aspect.id)
|
|
1542
1525
|
|
|
1543
1526
|
@property
|
|
1544
|
-
def
|
|
1527
|
+
def id(self) -> str:
|
|
1545
1528
|
return self.entity_ids[0]
|
|
1546
1529
|
|
|
1547
1530
|
if TYPE_CHECKING:
|
|
1548
|
-
from datahub.metadata.schema_classes import
|
|
1531
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
1549
1532
|
|
|
1550
|
-
class
|
|
1551
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1533
|
+
class FormUrn(_SpecificUrn):
|
|
1534
|
+
ENTITY_TYPE: ClassVar[str] = "form"
|
|
1552
1535
|
URN_PARTS: ClassVar[int] = 1
|
|
1553
1536
|
|
|
1554
|
-
def __init__(self,
|
|
1537
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1555
1538
|
if _allow_coercion:
|
|
1556
1539
|
# Field coercion logic (if any is required).
|
|
1557
|
-
|
|
1540
|
+
id = UrnEncoder.encode_string(id)
|
|
1558
1541
|
|
|
1559
1542
|
# Validation logic.
|
|
1560
|
-
if not
|
|
1561
|
-
raise InvalidUrnError("
|
|
1562
|
-
if UrnEncoder.contains_reserved_char(
|
|
1563
|
-
raise InvalidUrnError(f'
|
|
1543
|
+
if not id:
|
|
1544
|
+
raise InvalidUrnError("FormUrn id cannot be empty")
|
|
1545
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
1546
|
+
raise InvalidUrnError(f'FormUrn id contains reserved characters')
|
|
1564
1547
|
|
|
1565
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1548
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
1566
1549
|
|
|
1567
1550
|
@classmethod
|
|
1568
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1551
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "FormUrn":
|
|
1569
1552
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1570
|
-
raise InvalidUrnError(f"
|
|
1571
|
-
return cls(
|
|
1553
|
+
raise InvalidUrnError(f"FormUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1554
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1572
1555
|
|
|
1573
1556
|
@classmethod
|
|
1574
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1575
|
-
from datahub.metadata.schema_classes import
|
|
1576
|
-
|
|
1577
|
-
return CorpUserKeyClass
|
|
1557
|
+
def underlying_key_aspect_type(cls) -> Type["FormKeyClass"]:
|
|
1558
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
1578
1559
|
|
|
1579
|
-
|
|
1580
|
-
from datahub.metadata.schema_classes import CorpUserKeyClass
|
|
1560
|
+
return FormKeyClass
|
|
1581
1561
|
|
|
1582
|
-
|
|
1562
|
+
def to_key_aspect(self) -> "FormKeyClass":
|
|
1563
|
+
from datahub.metadata.schema_classes import FormKeyClass
|
|
1583
1564
|
|
|
1584
|
-
|
|
1585
|
-
def from_key_aspect(cls, key_aspect: "CorpUserKeyClass") -> "CorpUserUrn":
|
|
1586
|
-
return cls(username=key_aspect.username)
|
|
1565
|
+
return FormKeyClass(id=self.id)
|
|
1587
1566
|
|
|
1588
1567
|
@classmethod
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
return cls(id)
|
|
1568
|
+
def from_key_aspect(cls, key_aspect: "FormKeyClass") -> "FormUrn":
|
|
1569
|
+
return cls(id=key_aspect.id)
|
|
1592
1570
|
|
|
1593
1571
|
@property
|
|
1594
|
-
def
|
|
1572
|
+
def id(self) -> str:
|
|
1595
1573
|
return self.entity_ids[0]
|
|
1596
1574
|
|
|
1597
1575
|
if TYPE_CHECKING:
|
|
@@ -1649,55 +1627,10 @@ class MlFeatureUrn(_SpecificUrn):
|
|
|
1649
1627
|
return self.entity_ids[1]
|
|
1650
1628
|
|
|
1651
1629
|
if TYPE_CHECKING:
|
|
1652
|
-
from datahub.metadata.schema_classes import
|
|
1653
|
-
|
|
1654
|
-
class IncidentUrn(_SpecificUrn):
|
|
1655
|
-
ENTITY_TYPE: ClassVar[str] = "incident"
|
|
1656
|
-
URN_PARTS: ClassVar[int] = 1
|
|
1657
|
-
|
|
1658
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1659
|
-
if _allow_coercion:
|
|
1660
|
-
# Field coercion logic (if any is required).
|
|
1661
|
-
id = UrnEncoder.encode_string(id)
|
|
1662
|
-
|
|
1663
|
-
# Validation logic.
|
|
1664
|
-
if not id:
|
|
1665
|
-
raise InvalidUrnError("IncidentUrn id cannot be empty")
|
|
1666
|
-
if UrnEncoder.contains_reserved_char(id):
|
|
1667
|
-
raise InvalidUrnError(f'IncidentUrn id contains reserved characters')
|
|
1668
|
-
|
|
1669
|
-
super().__init__(self.ENTITY_TYPE, [id])
|
|
1670
|
-
|
|
1671
|
-
@classmethod
|
|
1672
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "IncidentUrn":
|
|
1673
|
-
if len(entity_ids) != cls.URN_PARTS:
|
|
1674
|
-
raise InvalidUrnError(f"IncidentUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1675
|
-
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1676
|
-
|
|
1677
|
-
@classmethod
|
|
1678
|
-
def underlying_key_aspect_type(cls) -> Type["IncidentKeyClass"]:
|
|
1679
|
-
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
1680
|
-
|
|
1681
|
-
return IncidentKeyClass
|
|
1682
|
-
|
|
1683
|
-
def to_key_aspect(self) -> "IncidentKeyClass":
|
|
1684
|
-
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
1685
|
-
|
|
1686
|
-
return IncidentKeyClass(id=self.id)
|
|
1687
|
-
|
|
1688
|
-
@classmethod
|
|
1689
|
-
def from_key_aspect(cls, key_aspect: "IncidentKeyClass") -> "IncidentUrn":
|
|
1690
|
-
return cls(id=key_aspect.id)
|
|
1691
|
-
|
|
1692
|
-
@property
|
|
1693
|
-
def id(self) -> str:
|
|
1694
|
-
return self.entity_ids[0]
|
|
1695
|
-
|
|
1696
|
-
if TYPE_CHECKING:
|
|
1697
|
-
from datahub.metadata.schema_classes import DataProcessInstanceKeyClass
|
|
1630
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
1698
1631
|
|
|
1699
|
-
class
|
|
1700
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1632
|
+
class PostUrn(_SpecificUrn):
|
|
1633
|
+
ENTITY_TYPE: ClassVar[str] = "post"
|
|
1701
1634
|
URN_PARTS: ClassVar[int] = 1
|
|
1702
1635
|
|
|
1703
1636
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1707,104 +1640,124 @@ class DataProcessInstanceUrn(_SpecificUrn):
|
|
|
1707
1640
|
|
|
1708
1641
|
# Validation logic.
|
|
1709
1642
|
if not id:
|
|
1710
|
-
raise InvalidUrnError("
|
|
1643
|
+
raise InvalidUrnError("PostUrn id cannot be empty")
|
|
1711
1644
|
if UrnEncoder.contains_reserved_char(id):
|
|
1712
|
-
raise InvalidUrnError(f'
|
|
1645
|
+
raise InvalidUrnError(f'PostUrn id contains reserved characters')
|
|
1713
1646
|
|
|
1714
1647
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1715
1648
|
|
|
1716
1649
|
@classmethod
|
|
1717
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1650
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "PostUrn":
|
|
1718
1651
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1719
|
-
raise InvalidUrnError(f"
|
|
1652
|
+
raise InvalidUrnError(f"PostUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1720
1653
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1721
1654
|
|
|
1722
1655
|
@classmethod
|
|
1723
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1724
|
-
from datahub.metadata.schema_classes import
|
|
1656
|
+
def underlying_key_aspect_type(cls) -> Type["PostKeyClass"]:
|
|
1657
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
1725
1658
|
|
|
1726
|
-
return
|
|
1659
|
+
return PostKeyClass
|
|
1727
1660
|
|
|
1728
|
-
def to_key_aspect(self) -> "
|
|
1729
|
-
from datahub.metadata.schema_classes import
|
|
1661
|
+
def to_key_aspect(self) -> "PostKeyClass":
|
|
1662
|
+
from datahub.metadata.schema_classes import PostKeyClass
|
|
1730
1663
|
|
|
1731
|
-
return
|
|
1664
|
+
return PostKeyClass(id=self.id)
|
|
1732
1665
|
|
|
1733
1666
|
@classmethod
|
|
1734
|
-
def from_key_aspect(cls, key_aspect: "
|
|
1667
|
+
def from_key_aspect(cls, key_aspect: "PostKeyClass") -> "PostUrn":
|
|
1735
1668
|
return cls(id=key_aspect.id)
|
|
1736
1669
|
|
|
1737
|
-
@classmethod
|
|
1738
|
-
@deprecated(reason="Use the constructor instead")
|
|
1739
|
-
def create_from_id(cls, id: str) -> "DataProcessInstanceUrn":
|
|
1740
|
-
return cls(id)
|
|
1741
|
-
|
|
1742
|
-
@deprecated(reason="Use .id instead")
|
|
1743
|
-
def get_dataprocessinstance_id(self) -> str:
|
|
1744
|
-
return self.id
|
|
1745
|
-
|
|
1746
1670
|
@property
|
|
1747
1671
|
def id(self) -> str:
|
|
1748
1672
|
return self.entity_ids[0]
|
|
1749
1673
|
|
|
1750
1674
|
if TYPE_CHECKING:
|
|
1751
|
-
from datahub.metadata.schema_classes import
|
|
1675
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
1752
1676
|
|
|
1753
|
-
class
|
|
1754
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1677
|
+
class DatasetUrn(_SpecificUrn):
|
|
1678
|
+
ENTITY_TYPE: ClassVar[str] = "dataset"
|
|
1755
1679
|
URN_PARTS: ClassVar[int] = 3
|
|
1756
1680
|
|
|
1757
|
-
def __init__(self,
|
|
1681
|
+
def __init__(self, platform: str, name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
1758
1682
|
if _allow_coercion:
|
|
1759
1683
|
# Field coercion logic (if any is required).
|
|
1684
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1760
1685
|
name = UrnEncoder.encode_string(name)
|
|
1761
|
-
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
1762
1686
|
env = env.upper()
|
|
1763
1687
|
env = UrnEncoder.encode_string(env)
|
|
1764
1688
|
|
|
1765
1689
|
# Validation logic.
|
|
1690
|
+
if not platform:
|
|
1691
|
+
raise InvalidUrnError("DatasetUrn platform cannot be empty")
|
|
1692
|
+
platform = str(platform)
|
|
1693
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1766
1694
|
if not name:
|
|
1767
|
-
raise InvalidUrnError("
|
|
1695
|
+
raise InvalidUrnError("DatasetUrn name cannot be empty")
|
|
1768
1696
|
if UrnEncoder.contains_reserved_char(name):
|
|
1769
|
-
raise InvalidUrnError(f'
|
|
1770
|
-
if not orchestrator:
|
|
1771
|
-
raise InvalidUrnError("DataProcessUrn orchestrator cannot be empty")
|
|
1772
|
-
if UrnEncoder.contains_reserved_char(orchestrator):
|
|
1773
|
-
raise InvalidUrnError(f'DataProcessUrn orchestrator contains reserved characters')
|
|
1697
|
+
raise InvalidUrnError(f'DatasetUrn name contains reserved characters')
|
|
1774
1698
|
if not env:
|
|
1775
|
-
raise InvalidUrnError("
|
|
1699
|
+
raise InvalidUrnError("DatasetUrn env cannot be empty")
|
|
1776
1700
|
if UrnEncoder.contains_reserved_char(env):
|
|
1777
|
-
raise InvalidUrnError(f'
|
|
1701
|
+
raise InvalidUrnError(f'DatasetUrn env contains reserved characters')
|
|
1778
1702
|
|
|
1779
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1703
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
1780
1704
|
|
|
1781
1705
|
@classmethod
|
|
1782
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1706
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DatasetUrn":
|
|
1783
1707
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1784
|
-
raise InvalidUrnError(f"
|
|
1785
|
-
return cls(
|
|
1708
|
+
raise InvalidUrnError(f"DatasetUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1709
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1786
1710
|
|
|
1787
1711
|
@classmethod
|
|
1788
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1789
|
-
from datahub.metadata.schema_classes import
|
|
1712
|
+
def underlying_key_aspect_type(cls) -> Type["DatasetKeyClass"]:
|
|
1713
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
1790
1714
|
|
|
1791
|
-
return
|
|
1715
|
+
return DatasetKeyClass
|
|
1792
1716
|
|
|
1793
|
-
def to_key_aspect(self) -> "
|
|
1794
|
-
from datahub.metadata.schema_classes import
|
|
1717
|
+
def to_key_aspect(self) -> "DatasetKeyClass":
|
|
1718
|
+
from datahub.metadata.schema_classes import DatasetKeyClass
|
|
1719
|
+
|
|
1720
|
+
return DatasetKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
1721
|
+
|
|
1722
|
+
@classmethod
|
|
1723
|
+
def from_key_aspect(cls, key_aspect: "DatasetKeyClass") -> "DatasetUrn":
|
|
1724
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
1725
|
+
|
|
1726
|
+
@classmethod
|
|
1727
|
+
def create_from_ids(
|
|
1728
|
+
cls,
|
|
1729
|
+
platform_id: str,
|
|
1730
|
+
table_name: str,
|
|
1731
|
+
env: str,
|
|
1732
|
+
platform_instance: Optional[str] = None,
|
|
1733
|
+
) -> "DatasetUrn":
|
|
1734
|
+
return DatasetUrn(
|
|
1735
|
+
platform=platform_id,
|
|
1736
|
+
name=f"{platform_instance}.{table_name}" if platform_instance else table_name,
|
|
1737
|
+
env=env,
|
|
1738
|
+
)
|
|
1739
|
+
|
|
1740
|
+
from datahub.utilities.urns.field_paths import get_simple_field_path_from_v2_field_path as _get_simple_field_path_from_v2_field_path
|
|
1741
|
+
|
|
1742
|
+
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))
|
|
1795
1743
|
|
|
1796
|
-
|
|
1744
|
+
def get_data_platform_urn(self) -> "DataPlatformUrn":
|
|
1745
|
+
return DataPlatformUrn.from_string(self.platform)
|
|
1797
1746
|
|
|
1798
|
-
@
|
|
1799
|
-
def
|
|
1800
|
-
return
|
|
1747
|
+
@deprecated(reason="Use .name instead")
|
|
1748
|
+
def get_dataset_name(self) -> str:
|
|
1749
|
+
return self.name
|
|
1750
|
+
|
|
1751
|
+
@deprecated(reason="Use .env instead")
|
|
1752
|
+
def get_env(self) -> str:
|
|
1753
|
+
return self.env
|
|
1801
1754
|
|
|
1802
1755
|
@property
|
|
1803
|
-
def
|
|
1756
|
+
def platform(self) -> str:
|
|
1804
1757
|
return self.entity_ids[0]
|
|
1805
1758
|
|
|
1806
1759
|
@property
|
|
1807
|
-
def
|
|
1760
|
+
def name(self) -> str:
|
|
1808
1761
|
return self.entity_ids[1]
|
|
1809
1762
|
|
|
1810
1763
|
@property
|
|
@@ -1812,92 +1765,67 @@ class DataProcessUrn(_SpecificUrn):
|
|
|
1812
1765
|
return self.entity_ids[2]
|
|
1813
1766
|
|
|
1814
1767
|
if TYPE_CHECKING:
|
|
1815
|
-
from datahub.metadata.schema_classes import
|
|
1768
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
1816
1769
|
|
|
1817
|
-
class
|
|
1818
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1770
|
+
class MlModelUrn(_SpecificUrn):
|
|
1771
|
+
ENTITY_TYPE: ClassVar[str] = "mlModel"
|
|
1819
1772
|
URN_PARTS: ClassVar[int] = 3
|
|
1820
1773
|
|
|
1821
|
-
def __init__(self,
|
|
1774
|
+
def __init__(self, platform: str, name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
1822
1775
|
if _allow_coercion:
|
|
1823
1776
|
# Field coercion logic (if any is required).
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1777
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1778
|
+
name = UrnEncoder.encode_string(name)
|
|
1779
|
+
env = env.upper()
|
|
1780
|
+
env = UrnEncoder.encode_string(env)
|
|
1827
1781
|
|
|
1828
1782
|
# Validation logic.
|
|
1829
|
-
if not
|
|
1830
|
-
raise InvalidUrnError("
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
if not
|
|
1834
|
-
raise InvalidUrnError("
|
|
1835
|
-
if UrnEncoder.contains_reserved_char(
|
|
1836
|
-
raise InvalidUrnError(f'
|
|
1837
|
-
if not
|
|
1838
|
-
raise InvalidUrnError("
|
|
1839
|
-
if UrnEncoder.contains_reserved_char(
|
|
1840
|
-
raise InvalidUrnError(f'
|
|
1783
|
+
if not platform:
|
|
1784
|
+
raise InvalidUrnError("MlModelUrn platform cannot be empty")
|
|
1785
|
+
platform = str(platform)
|
|
1786
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1787
|
+
if not name:
|
|
1788
|
+
raise InvalidUrnError("MlModelUrn name cannot be empty")
|
|
1789
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1790
|
+
raise InvalidUrnError(f'MlModelUrn name contains reserved characters')
|
|
1791
|
+
if not env:
|
|
1792
|
+
raise InvalidUrnError("MlModelUrn env cannot be empty")
|
|
1793
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
1794
|
+
raise InvalidUrnError(f'MlModelUrn env contains reserved characters')
|
|
1841
1795
|
|
|
1842
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
1796
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
1843
1797
|
|
|
1844
1798
|
@classmethod
|
|
1845
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
1799
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelUrn":
|
|
1846
1800
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1847
|
-
raise InvalidUrnError(f"
|
|
1848
|
-
return cls(
|
|
1801
|
+
raise InvalidUrnError(f"MlModelUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1802
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1849
1803
|
|
|
1850
1804
|
@classmethod
|
|
1851
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1852
|
-
from datahub.metadata.schema_classes import
|
|
1853
|
-
|
|
1854
|
-
return DataFlowKeyClass
|
|
1805
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelKeyClass"]:
|
|
1806
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
1855
1807
|
|
|
1856
|
-
|
|
1857
|
-
from datahub.metadata.schema_classes import DataFlowKeyClass
|
|
1808
|
+
return MLModelKeyClass
|
|
1858
1809
|
|
|
1859
|
-
|
|
1810
|
+
def to_key_aspect(self) -> "MLModelKeyClass":
|
|
1811
|
+
from datahub.metadata.schema_classes import MLModelKeyClass
|
|
1860
1812
|
|
|
1861
|
-
|
|
1862
|
-
def from_key_aspect(cls, key_aspect: "DataFlowKeyClass") -> "DataFlowUrn":
|
|
1863
|
-
return cls(orchestrator=key_aspect.orchestrator, flow_id=key_aspect.flowId, cluster=key_aspect.cluster)
|
|
1813
|
+
return MLModelKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
1864
1814
|
|
|
1865
1815
|
@classmethod
|
|
1866
|
-
def
|
|
1867
|
-
cls,
|
|
1868
|
-
orchestrator: str,
|
|
1869
|
-
flow_id: str,
|
|
1870
|
-
env: str,
|
|
1871
|
-
platform_instance: Optional[str] = None,
|
|
1872
|
-
) -> "DataFlowUrn":
|
|
1873
|
-
return cls(
|
|
1874
|
-
orchestrator=orchestrator,
|
|
1875
|
-
flow_id=f"{platform_instance}.{flow_id}" if platform_instance else flow_id,
|
|
1876
|
-
cluster=env,
|
|
1877
|
-
)
|
|
1878
|
-
|
|
1879
|
-
@deprecated(reason="Use .orchestrator instead")
|
|
1880
|
-
def get_orchestrator_name(self) -> str:
|
|
1881
|
-
return self.orchestrator
|
|
1882
|
-
|
|
1883
|
-
@deprecated(reason="Use .flow_id instead")
|
|
1884
|
-
def get_flow_id(self) -> str:
|
|
1885
|
-
return self.flow_id
|
|
1886
|
-
|
|
1887
|
-
@deprecated(reason="Use .cluster instead")
|
|
1888
|
-
def get_env(self) -> str:
|
|
1889
|
-
return self.cluster
|
|
1816
|
+
def from_key_aspect(cls, key_aspect: "MLModelKeyClass") -> "MlModelUrn":
|
|
1817
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
1890
1818
|
|
|
1891
1819
|
@property
|
|
1892
|
-
def
|
|
1820
|
+
def platform(self) -> str:
|
|
1893
1821
|
return self.entity_ids[0]
|
|
1894
1822
|
|
|
1895
1823
|
@property
|
|
1896
|
-
def
|
|
1824
|
+
def name(self) -> str:
|
|
1897
1825
|
return self.entity_ids[1]
|
|
1898
1826
|
|
|
1899
1827
|
@property
|
|
1900
|
-
def
|
|
1828
|
+
def env(self) -> str:
|
|
1901
1829
|
return self.entity_ids[2]
|
|
1902
1830
|
|
|
1903
1831
|
if TYPE_CHECKING:
|
|
@@ -1955,10 +1883,128 @@ class MlPrimaryKeyUrn(_SpecificUrn):
|
|
|
1955
1883
|
return self.entity_ids[1]
|
|
1956
1884
|
|
|
1957
1885
|
if TYPE_CHECKING:
|
|
1958
|
-
from datahub.metadata.schema_classes import
|
|
1886
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1959
1887
|
|
|
1960
|
-
class
|
|
1961
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
1888
|
+
class MlModelDeploymentUrn(_SpecificUrn):
|
|
1889
|
+
ENTITY_TYPE: ClassVar[str] = "mlModelDeployment"
|
|
1890
|
+
URN_PARTS: ClassVar[int] = 3
|
|
1891
|
+
|
|
1892
|
+
def __init__(self, platform: str, name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
1893
|
+
if _allow_coercion:
|
|
1894
|
+
# Field coercion logic (if any is required).
|
|
1895
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1896
|
+
name = UrnEncoder.encode_string(name)
|
|
1897
|
+
env = env.upper()
|
|
1898
|
+
env = UrnEncoder.encode_string(env)
|
|
1899
|
+
|
|
1900
|
+
# Validation logic.
|
|
1901
|
+
if not platform:
|
|
1902
|
+
raise InvalidUrnError("MlModelDeploymentUrn platform cannot be empty")
|
|
1903
|
+
platform = str(platform)
|
|
1904
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1905
|
+
if not name:
|
|
1906
|
+
raise InvalidUrnError("MlModelDeploymentUrn name cannot be empty")
|
|
1907
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1908
|
+
raise InvalidUrnError(f'MlModelDeploymentUrn name contains reserved characters')
|
|
1909
|
+
if not env:
|
|
1910
|
+
raise InvalidUrnError("MlModelDeploymentUrn env cannot be empty")
|
|
1911
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
1912
|
+
raise InvalidUrnError(f'MlModelDeploymentUrn env contains reserved characters')
|
|
1913
|
+
|
|
1914
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
1915
|
+
|
|
1916
|
+
@classmethod
|
|
1917
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelDeploymentUrn":
|
|
1918
|
+
if len(entity_ids) != cls.URN_PARTS:
|
|
1919
|
+
raise InvalidUrnError(f"MlModelDeploymentUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1920
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
1921
|
+
|
|
1922
|
+
@classmethod
|
|
1923
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelDeploymentKeyClass"]:
|
|
1924
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1925
|
+
|
|
1926
|
+
return MLModelDeploymentKeyClass
|
|
1927
|
+
|
|
1928
|
+
def to_key_aspect(self) -> "MLModelDeploymentKeyClass":
|
|
1929
|
+
from datahub.metadata.schema_classes import MLModelDeploymentKeyClass
|
|
1930
|
+
|
|
1931
|
+
return MLModelDeploymentKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
1932
|
+
|
|
1933
|
+
@classmethod
|
|
1934
|
+
def from_key_aspect(cls, key_aspect: "MLModelDeploymentKeyClass") -> "MlModelDeploymentUrn":
|
|
1935
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
1936
|
+
|
|
1937
|
+
@property
|
|
1938
|
+
def platform(self) -> str:
|
|
1939
|
+
return self.entity_ids[0]
|
|
1940
|
+
|
|
1941
|
+
@property
|
|
1942
|
+
def name(self) -> str:
|
|
1943
|
+
return self.entity_ids[1]
|
|
1944
|
+
|
|
1945
|
+
@property
|
|
1946
|
+
def env(self) -> str:
|
|
1947
|
+
return self.entity_ids[2]
|
|
1948
|
+
|
|
1949
|
+
if TYPE_CHECKING:
|
|
1950
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1951
|
+
|
|
1952
|
+
class MlFeatureTableUrn(_SpecificUrn):
|
|
1953
|
+
ENTITY_TYPE: ClassVar[str] = "mlFeatureTable"
|
|
1954
|
+
URN_PARTS: ClassVar[int] = 2
|
|
1955
|
+
|
|
1956
|
+
def __init__(self, platform: str, name: str, *, _allow_coercion: bool = True) -> None:
|
|
1957
|
+
if _allow_coercion:
|
|
1958
|
+
# Field coercion logic (if any is required).
|
|
1959
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1960
|
+
name = UrnEncoder.encode_string(name)
|
|
1961
|
+
|
|
1962
|
+
# Validation logic.
|
|
1963
|
+
if not platform:
|
|
1964
|
+
raise InvalidUrnError("MlFeatureTableUrn platform cannot be empty")
|
|
1965
|
+
platform = str(platform)
|
|
1966
|
+
assert DataPlatformUrn.from_string(platform)
|
|
1967
|
+
if not name:
|
|
1968
|
+
raise InvalidUrnError("MlFeatureTableUrn name cannot be empty")
|
|
1969
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
1970
|
+
raise InvalidUrnError(f'MlFeatureTableUrn name contains reserved characters')
|
|
1971
|
+
|
|
1972
|
+
super().__init__(self.ENTITY_TYPE, [platform, name])
|
|
1973
|
+
|
|
1974
|
+
@classmethod
|
|
1975
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlFeatureTableUrn":
|
|
1976
|
+
if len(entity_ids) != cls.URN_PARTS:
|
|
1977
|
+
raise InvalidUrnError(f"MlFeatureTableUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1978
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], _allow_coercion=False)
|
|
1979
|
+
|
|
1980
|
+
@classmethod
|
|
1981
|
+
def underlying_key_aspect_type(cls) -> Type["MLFeatureTableKeyClass"]:
|
|
1982
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1983
|
+
|
|
1984
|
+
return MLFeatureTableKeyClass
|
|
1985
|
+
|
|
1986
|
+
def to_key_aspect(self) -> "MLFeatureTableKeyClass":
|
|
1987
|
+
from datahub.metadata.schema_classes import MLFeatureTableKeyClass
|
|
1988
|
+
|
|
1989
|
+
return MLFeatureTableKeyClass(platform=self.platform, name=self.name)
|
|
1990
|
+
|
|
1991
|
+
@classmethod
|
|
1992
|
+
def from_key_aspect(cls, key_aspect: "MLFeatureTableKeyClass") -> "MlFeatureTableUrn":
|
|
1993
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name)
|
|
1994
|
+
|
|
1995
|
+
@property
|
|
1996
|
+
def platform(self) -> str:
|
|
1997
|
+
return self.entity_ids[0]
|
|
1998
|
+
|
|
1999
|
+
@property
|
|
2000
|
+
def name(self) -> str:
|
|
2001
|
+
return self.entity_ids[1]
|
|
2002
|
+
|
|
2003
|
+
if TYPE_CHECKING:
|
|
2004
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
2005
|
+
|
|
2006
|
+
class DataHubUpgradeUrn(_SpecificUrn):
|
|
2007
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubUpgrade"
|
|
1962
2008
|
URN_PARTS: ClassVar[int] = 1
|
|
1963
2009
|
|
|
1964
2010
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -1968,31 +2014,31 @@ class DataHubAccessTokenUrn(_SpecificUrn):
|
|
|
1968
2014
|
|
|
1969
2015
|
# Validation logic.
|
|
1970
2016
|
if not id:
|
|
1971
|
-
raise InvalidUrnError("
|
|
2017
|
+
raise InvalidUrnError("DataHubUpgradeUrn id cannot be empty")
|
|
1972
2018
|
if UrnEncoder.contains_reserved_char(id):
|
|
1973
|
-
raise InvalidUrnError(f'
|
|
2019
|
+
raise InvalidUrnError(f'DataHubUpgradeUrn id contains reserved characters')
|
|
1974
2020
|
|
|
1975
2021
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
1976
2022
|
|
|
1977
2023
|
@classmethod
|
|
1978
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2024
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubUpgradeUrn":
|
|
1979
2025
|
if len(entity_ids) != cls.URN_PARTS:
|
|
1980
|
-
raise InvalidUrnError(f"
|
|
2026
|
+
raise InvalidUrnError(f"DataHubUpgradeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
1981
2027
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
1982
2028
|
|
|
1983
2029
|
@classmethod
|
|
1984
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
1985
|
-
from datahub.metadata.schema_classes import
|
|
2030
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubUpgradeKeyClass"]:
|
|
2031
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
1986
2032
|
|
|
1987
|
-
return
|
|
2033
|
+
return DataHubUpgradeKeyClass
|
|
1988
2034
|
|
|
1989
|
-
def to_key_aspect(self) -> "
|
|
1990
|
-
from datahub.metadata.schema_classes import
|
|
2035
|
+
def to_key_aspect(self) -> "DataHubUpgradeKeyClass":
|
|
2036
|
+
from datahub.metadata.schema_classes import DataHubUpgradeKeyClass
|
|
1991
2037
|
|
|
1992
|
-
return
|
|
2038
|
+
return DataHubUpgradeKeyClass(id=self.id)
|
|
1993
2039
|
|
|
1994
2040
|
@classmethod
|
|
1995
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2041
|
+
def from_key_aspect(cls, key_aspect: "DataHubUpgradeKeyClass") -> "DataHubUpgradeUrn":
|
|
1996
2042
|
return cls(id=key_aspect.id)
|
|
1997
2043
|
|
|
1998
2044
|
@property
|
|
@@ -2000,254 +2046,244 @@ class DataHubAccessTokenUrn(_SpecificUrn):
|
|
|
2000
2046
|
return self.entity_ids[0]
|
|
2001
2047
|
|
|
2002
2048
|
if TYPE_CHECKING:
|
|
2003
|
-
from datahub.metadata.schema_classes import
|
|
2049
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
2004
2050
|
|
|
2005
|
-
class
|
|
2006
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2051
|
+
class GlossaryNodeUrn(_SpecificUrn):
|
|
2052
|
+
ENTITY_TYPE: ClassVar[str] = "glossaryNode"
|
|
2007
2053
|
URN_PARTS: ClassVar[int] = 1
|
|
2008
2054
|
|
|
2009
|
-
def __init__(self,
|
|
2055
|
+
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
2010
2056
|
if _allow_coercion:
|
|
2011
2057
|
# Field coercion logic (if any is required).
|
|
2012
|
-
|
|
2013
|
-
platform_name = DataPlatformUrn.from_string(platform_name).platform_name
|
|
2014
|
-
platform_name = UrnEncoder.encode_string(platform_name)
|
|
2058
|
+
name = UrnEncoder.encode_string(name)
|
|
2015
2059
|
|
|
2016
2060
|
# Validation logic.
|
|
2017
|
-
if not
|
|
2018
|
-
raise InvalidUrnError("
|
|
2019
|
-
if UrnEncoder.contains_reserved_char(
|
|
2020
|
-
raise InvalidUrnError(f'
|
|
2061
|
+
if not name:
|
|
2062
|
+
raise InvalidUrnError("GlossaryNodeUrn name cannot be empty")
|
|
2063
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
2064
|
+
raise InvalidUrnError(f'GlossaryNodeUrn name contains reserved characters')
|
|
2021
2065
|
|
|
2022
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2066
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
2023
2067
|
|
|
2024
2068
|
@classmethod
|
|
2025
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2069
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlossaryNodeUrn":
|
|
2026
2070
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2027
|
-
raise InvalidUrnError(f"
|
|
2028
|
-
return cls(
|
|
2071
|
+
raise InvalidUrnError(f"GlossaryNodeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2072
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
2029
2073
|
|
|
2030
2074
|
@classmethod
|
|
2031
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2032
|
-
from datahub.metadata.schema_classes import
|
|
2033
|
-
|
|
2034
|
-
return DataPlatformKeyClass
|
|
2075
|
+
def underlying_key_aspect_type(cls) -> Type["GlossaryNodeKeyClass"]:
|
|
2076
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
2035
2077
|
|
|
2036
|
-
|
|
2037
|
-
from datahub.metadata.schema_classes import DataPlatformKeyClass
|
|
2078
|
+
return GlossaryNodeKeyClass
|
|
2038
2079
|
|
|
2039
|
-
|
|
2080
|
+
def to_key_aspect(self) -> "GlossaryNodeKeyClass":
|
|
2081
|
+
from datahub.metadata.schema_classes import GlossaryNodeKeyClass
|
|
2040
2082
|
|
|
2041
|
-
|
|
2042
|
-
def from_key_aspect(cls, key_aspect: "DataPlatformKeyClass") -> "DataPlatformUrn":
|
|
2043
|
-
return cls(platform_name=key_aspect.platformName)
|
|
2083
|
+
return GlossaryNodeKeyClass(name=self.name)
|
|
2044
2084
|
|
|
2045
2085
|
@classmethod
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
return cls(id)
|
|
2086
|
+
def from_key_aspect(cls, key_aspect: "GlossaryNodeKeyClass") -> "GlossaryNodeUrn":
|
|
2087
|
+
return cls(name=key_aspect.name)
|
|
2049
2088
|
|
|
2050
2089
|
@property
|
|
2051
|
-
def
|
|
2090
|
+
def name(self) -> str:
|
|
2052
2091
|
return self.entity_ids[0]
|
|
2053
2092
|
|
|
2054
2093
|
if TYPE_CHECKING:
|
|
2055
|
-
from datahub.metadata.schema_classes import
|
|
2094
|
+
from datahub.metadata.schema_classes import DataHubPersonaKeyClass
|
|
2056
2095
|
|
|
2057
|
-
class
|
|
2058
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2096
|
+
class DataHubPersonaUrn(_SpecificUrn):
|
|
2097
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubPersona"
|
|
2059
2098
|
URN_PARTS: ClassVar[int] = 1
|
|
2060
2099
|
|
|
2061
|
-
def __init__(self,
|
|
2100
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2062
2101
|
if _allow_coercion:
|
|
2063
2102
|
# Field coercion logic (if any is required).
|
|
2064
|
-
|
|
2103
|
+
id = UrnEncoder.encode_string(id)
|
|
2065
2104
|
|
|
2066
2105
|
# Validation logic.
|
|
2067
|
-
if not
|
|
2068
|
-
raise InvalidUrnError("
|
|
2069
|
-
if UrnEncoder.contains_reserved_char(
|
|
2070
|
-
raise InvalidUrnError(f'
|
|
2106
|
+
if not id:
|
|
2107
|
+
raise InvalidUrnError("DataHubPersonaUrn id cannot be empty")
|
|
2108
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2109
|
+
raise InvalidUrnError(f'DataHubPersonaUrn id contains reserved characters')
|
|
2071
2110
|
|
|
2072
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2111
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2073
2112
|
|
|
2074
2113
|
@classmethod
|
|
2075
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2114
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubPersonaUrn":
|
|
2076
2115
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2077
|
-
raise InvalidUrnError(f"
|
|
2078
|
-
return cls(
|
|
2116
|
+
raise InvalidUrnError(f"DataHubPersonaUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2117
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2079
2118
|
|
|
2080
2119
|
@classmethod
|
|
2081
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2082
|
-
from datahub.metadata.schema_classes import
|
|
2120
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubPersonaKeyClass"]:
|
|
2121
|
+
from datahub.metadata.schema_classes import DataHubPersonaKeyClass
|
|
2083
2122
|
|
|
2084
|
-
return
|
|
2123
|
+
return DataHubPersonaKeyClass
|
|
2085
2124
|
|
|
2086
|
-
def to_key_aspect(self) -> "
|
|
2087
|
-
from datahub.metadata.schema_classes import
|
|
2125
|
+
def to_key_aspect(self) -> "DataHubPersonaKeyClass":
|
|
2126
|
+
from datahub.metadata.schema_classes import DataHubPersonaKeyClass
|
|
2088
2127
|
|
|
2089
|
-
return
|
|
2128
|
+
return DataHubPersonaKeyClass(id=self.id)
|
|
2090
2129
|
|
|
2091
2130
|
@classmethod
|
|
2092
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2093
|
-
return cls(
|
|
2131
|
+
def from_key_aspect(cls, key_aspect: "DataHubPersonaKeyClass") -> "DataHubPersonaUrn":
|
|
2132
|
+
return cls(id=key_aspect.id)
|
|
2094
2133
|
|
|
2095
2134
|
@property
|
|
2096
|
-
def
|
|
2135
|
+
def id(self) -> str:
|
|
2097
2136
|
return self.entity_ids[0]
|
|
2098
2137
|
|
|
2099
2138
|
if TYPE_CHECKING:
|
|
2100
|
-
from datahub.metadata.schema_classes import
|
|
2139
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
2101
2140
|
|
|
2102
|
-
class
|
|
2103
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2104
|
-
URN_PARTS: ClassVar[int] =
|
|
2141
|
+
class DataHubSecretUrn(_SpecificUrn):
|
|
2142
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubSecret"
|
|
2143
|
+
URN_PARTS: ClassVar[int] = 1
|
|
2105
2144
|
|
|
2106
|
-
def __init__(self,
|
|
2145
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2107
2146
|
if _allow_coercion:
|
|
2108
2147
|
# Field coercion logic (if any is required).
|
|
2109
|
-
|
|
2110
|
-
name = UrnEncoder.encode_string(name)
|
|
2111
|
-
env = env.upper()
|
|
2112
|
-
env = UrnEncoder.encode_string(env)
|
|
2148
|
+
id = UrnEncoder.encode_string(id)
|
|
2113
2149
|
|
|
2114
2150
|
# Validation logic.
|
|
2115
|
-
if not
|
|
2116
|
-
raise InvalidUrnError("
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
if not name:
|
|
2120
|
-
raise InvalidUrnError("DatasetUrn name cannot be empty")
|
|
2121
|
-
if UrnEncoder.contains_reserved_char(name):
|
|
2122
|
-
raise InvalidUrnError(f'DatasetUrn name contains reserved characters')
|
|
2123
|
-
if not env:
|
|
2124
|
-
raise InvalidUrnError("DatasetUrn env cannot be empty")
|
|
2125
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
2126
|
-
raise InvalidUrnError(f'DatasetUrn env contains reserved characters')
|
|
2151
|
+
if not id:
|
|
2152
|
+
raise InvalidUrnError("DataHubSecretUrn id cannot be empty")
|
|
2153
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2154
|
+
raise InvalidUrnError(f'DataHubSecretUrn id contains reserved characters')
|
|
2127
2155
|
|
|
2128
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2156
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2129
2157
|
|
|
2130
2158
|
@classmethod
|
|
2131
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2159
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubSecretUrn":
|
|
2132
2160
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2133
|
-
raise InvalidUrnError(f"
|
|
2134
|
-
return cls(
|
|
2161
|
+
raise InvalidUrnError(f"DataHubSecretUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2162
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2135
2163
|
|
|
2136
2164
|
@classmethod
|
|
2137
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2138
|
-
from datahub.metadata.schema_classes import
|
|
2165
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubSecretKeyClass"]:
|
|
2166
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
2139
2167
|
|
|
2140
|
-
return
|
|
2168
|
+
return DataHubSecretKeyClass
|
|
2141
2169
|
|
|
2142
|
-
def to_key_aspect(self) -> "
|
|
2143
|
-
from datahub.metadata.schema_classes import
|
|
2170
|
+
def to_key_aspect(self) -> "DataHubSecretKeyClass":
|
|
2171
|
+
from datahub.metadata.schema_classes import DataHubSecretKeyClass
|
|
2144
2172
|
|
|
2145
|
-
return
|
|
2173
|
+
return DataHubSecretKeyClass(id=self.id)
|
|
2146
2174
|
|
|
2147
2175
|
@classmethod
|
|
2148
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2149
|
-
return cls(
|
|
2176
|
+
def from_key_aspect(cls, key_aspect: "DataHubSecretKeyClass") -> "DataHubSecretUrn":
|
|
2177
|
+
return cls(id=key_aspect.id)
|
|
2150
2178
|
|
|
2151
|
-
@
|
|
2152
|
-
def
|
|
2153
|
-
|
|
2154
|
-
platform_id: str,
|
|
2155
|
-
table_name: str,
|
|
2156
|
-
env: str,
|
|
2157
|
-
platform_instance: Optional[str] = None,
|
|
2158
|
-
) -> "DatasetUrn":
|
|
2159
|
-
return DatasetUrn(
|
|
2160
|
-
platform=platform_id,
|
|
2161
|
-
name=f"{platform_instance}.{table_name}" if platform_instance else table_name,
|
|
2162
|
-
env=env,
|
|
2163
|
-
)
|
|
2179
|
+
@property
|
|
2180
|
+
def id(self) -> str:
|
|
2181
|
+
return self.entity_ids[0]
|
|
2164
2182
|
|
|
2165
|
-
|
|
2183
|
+
if TYPE_CHECKING:
|
|
2184
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2166
2185
|
|
|
2167
|
-
|
|
2186
|
+
class DataHubIngestionSourceUrn(_SpecificUrn):
|
|
2187
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubIngestionSource"
|
|
2188
|
+
URN_PARTS: ClassVar[int] = 1
|
|
2168
2189
|
|
|
2169
|
-
def
|
|
2170
|
-
|
|
2190
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2191
|
+
if _allow_coercion:
|
|
2192
|
+
# Field coercion logic (if any is required).
|
|
2193
|
+
id = UrnEncoder.encode_string(id)
|
|
2171
2194
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2195
|
+
# Validation logic.
|
|
2196
|
+
if not id:
|
|
2197
|
+
raise InvalidUrnError("DataHubIngestionSourceUrn id cannot be empty")
|
|
2198
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2199
|
+
raise InvalidUrnError(f'DataHubIngestionSourceUrn id contains reserved characters')
|
|
2175
2200
|
|
|
2176
|
-
|
|
2177
|
-
def get_env(self) -> str:
|
|
2178
|
-
return self.env
|
|
2201
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2179
2202
|
|
|
2180
|
-
@
|
|
2181
|
-
def
|
|
2182
|
-
|
|
2203
|
+
@classmethod
|
|
2204
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubIngestionSourceUrn":
|
|
2205
|
+
if len(entity_ids) != cls.URN_PARTS:
|
|
2206
|
+
raise InvalidUrnError(f"DataHubIngestionSourceUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2207
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2183
2208
|
|
|
2184
|
-
@
|
|
2185
|
-
def
|
|
2186
|
-
|
|
2209
|
+
@classmethod
|
|
2210
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubIngestionSourceKeyClass"]:
|
|
2211
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2212
|
+
|
|
2213
|
+
return DataHubIngestionSourceKeyClass
|
|
2214
|
+
|
|
2215
|
+
def to_key_aspect(self) -> "DataHubIngestionSourceKeyClass":
|
|
2216
|
+
from datahub.metadata.schema_classes import DataHubIngestionSourceKeyClass
|
|
2217
|
+
|
|
2218
|
+
return DataHubIngestionSourceKeyClass(id=self.id)
|
|
2219
|
+
|
|
2220
|
+
@classmethod
|
|
2221
|
+
def from_key_aspect(cls, key_aspect: "DataHubIngestionSourceKeyClass") -> "DataHubIngestionSourceUrn":
|
|
2222
|
+
return cls(id=key_aspect.id)
|
|
2187
2223
|
|
|
2188
2224
|
@property
|
|
2189
|
-
def
|
|
2190
|
-
return self.entity_ids[
|
|
2225
|
+
def id(self) -> str:
|
|
2226
|
+
return self.entity_ids[0]
|
|
2191
2227
|
|
|
2192
2228
|
if TYPE_CHECKING:
|
|
2193
|
-
from datahub.metadata.schema_classes import
|
|
2229
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2194
2230
|
|
|
2195
|
-
class
|
|
2196
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2231
|
+
class DataHubRetentionUrn(_SpecificUrn):
|
|
2232
|
+
ENTITY_TYPE: ClassVar[str] = "dataHubRetention"
|
|
2197
2233
|
URN_PARTS: ClassVar[int] = 2
|
|
2198
2234
|
|
|
2199
|
-
def __init__(self,
|
|
2235
|
+
def __init__(self, entity_name: str, aspect_name: str, *, _allow_coercion: bool = True) -> None:
|
|
2200
2236
|
if _allow_coercion:
|
|
2201
2237
|
# Field coercion logic (if any is required).
|
|
2202
|
-
|
|
2203
|
-
|
|
2238
|
+
entity_name = UrnEncoder.encode_string(entity_name)
|
|
2239
|
+
aspect_name = UrnEncoder.encode_string(aspect_name)
|
|
2204
2240
|
|
|
2205
2241
|
# Validation logic.
|
|
2206
|
-
if not
|
|
2207
|
-
raise InvalidUrnError("
|
|
2208
|
-
if UrnEncoder.contains_reserved_char(
|
|
2209
|
-
raise InvalidUrnError(f'
|
|
2210
|
-
if not
|
|
2211
|
-
raise InvalidUrnError("
|
|
2212
|
-
if UrnEncoder.contains_reserved_char(
|
|
2213
|
-
raise InvalidUrnError(f'
|
|
2242
|
+
if not entity_name:
|
|
2243
|
+
raise InvalidUrnError("DataHubRetentionUrn entity_name cannot be empty")
|
|
2244
|
+
if UrnEncoder.contains_reserved_char(entity_name):
|
|
2245
|
+
raise InvalidUrnError(f'DataHubRetentionUrn entity_name contains reserved characters')
|
|
2246
|
+
if not aspect_name:
|
|
2247
|
+
raise InvalidUrnError("DataHubRetentionUrn aspect_name cannot be empty")
|
|
2248
|
+
if UrnEncoder.contains_reserved_char(aspect_name):
|
|
2249
|
+
raise InvalidUrnError(f'DataHubRetentionUrn aspect_name contains reserved characters')
|
|
2214
2250
|
|
|
2215
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2251
|
+
super().__init__(self.ENTITY_TYPE, [entity_name, aspect_name])
|
|
2216
2252
|
|
|
2217
2253
|
@classmethod
|
|
2218
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2254
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DataHubRetentionUrn":
|
|
2219
2255
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2220
|
-
raise InvalidUrnError(f"
|
|
2221
|
-
return cls(
|
|
2256
|
+
raise InvalidUrnError(f"DataHubRetentionUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2257
|
+
return cls(entity_name=entity_ids[0], aspect_name=entity_ids[1], _allow_coercion=False)
|
|
2222
2258
|
|
|
2223
2259
|
@classmethod
|
|
2224
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2225
|
-
from datahub.metadata.schema_classes import
|
|
2260
|
+
def underlying_key_aspect_type(cls) -> Type["DataHubRetentionKeyClass"]:
|
|
2261
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2226
2262
|
|
|
2227
|
-
return
|
|
2263
|
+
return DataHubRetentionKeyClass
|
|
2228
2264
|
|
|
2229
|
-
def to_key_aspect(self) -> "
|
|
2230
|
-
from datahub.metadata.schema_classes import
|
|
2265
|
+
def to_key_aspect(self) -> "DataHubRetentionKeyClass":
|
|
2266
|
+
from datahub.metadata.schema_classes import DataHubRetentionKeyClass
|
|
2231
2267
|
|
|
2232
|
-
return
|
|
2268
|
+
return DataHubRetentionKeyClass(entityName=self.entity_name, aspectName=self.aspect_name)
|
|
2233
2269
|
|
|
2234
2270
|
@classmethod
|
|
2235
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2236
|
-
return cls(
|
|
2271
|
+
def from_key_aspect(cls, key_aspect: "DataHubRetentionKeyClass") -> "DataHubRetentionUrn":
|
|
2272
|
+
return cls(entity_name=key_aspect.entityName, aspect_name=key_aspect.aspectName)
|
|
2237
2273
|
|
|
2238
2274
|
@property
|
|
2239
|
-
def
|
|
2275
|
+
def entity_name(self) -> str:
|
|
2240
2276
|
return self.entity_ids[0]
|
|
2241
2277
|
|
|
2242
2278
|
@property
|
|
2243
|
-
def
|
|
2279
|
+
def aspect_name(self) -> str:
|
|
2244
2280
|
return self.entity_ids[1]
|
|
2245
2281
|
|
|
2246
2282
|
if TYPE_CHECKING:
|
|
2247
|
-
from datahub.metadata.schema_classes import
|
|
2283
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
2248
2284
|
|
|
2249
|
-
class
|
|
2250
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2285
|
+
class TestUrn(_SpecificUrn):
|
|
2286
|
+
ENTITY_TYPE: ClassVar[str] = "test"
|
|
2251
2287
|
URN_PARTS: ClassVar[int] = 1
|
|
2252
2288
|
|
|
2253
2289
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2257,31 +2293,31 @@ class DataHubViewUrn(_SpecificUrn):
|
|
|
2257
2293
|
|
|
2258
2294
|
# Validation logic.
|
|
2259
2295
|
if not id:
|
|
2260
|
-
raise InvalidUrnError("
|
|
2296
|
+
raise InvalidUrnError("TestUrn id cannot be empty")
|
|
2261
2297
|
if UrnEncoder.contains_reserved_char(id):
|
|
2262
|
-
raise InvalidUrnError(f'
|
|
2298
|
+
raise InvalidUrnError(f'TestUrn id contains reserved characters')
|
|
2263
2299
|
|
|
2264
2300
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2265
2301
|
|
|
2266
2302
|
@classmethod
|
|
2267
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2303
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TestUrn":
|
|
2268
2304
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2269
|
-
raise InvalidUrnError(f"
|
|
2305
|
+
raise InvalidUrnError(f"TestUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2270
2306
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2271
2307
|
|
|
2272
2308
|
@classmethod
|
|
2273
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2274
|
-
from datahub.metadata.schema_classes import
|
|
2309
|
+
def underlying_key_aspect_type(cls) -> Type["TestKeyClass"]:
|
|
2310
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
2275
2311
|
|
|
2276
|
-
return
|
|
2312
|
+
return TestKeyClass
|
|
2277
2313
|
|
|
2278
|
-
def to_key_aspect(self) -> "
|
|
2279
|
-
from datahub.metadata.schema_classes import
|
|
2314
|
+
def to_key_aspect(self) -> "TestKeyClass":
|
|
2315
|
+
from datahub.metadata.schema_classes import TestKeyClass
|
|
2280
2316
|
|
|
2281
|
-
return
|
|
2317
|
+
return TestKeyClass(id=self.id)
|
|
2282
2318
|
|
|
2283
2319
|
@classmethod
|
|
2284
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2320
|
+
def from_key_aspect(cls, key_aspect: "TestKeyClass") -> "TestUrn":
|
|
2285
2321
|
return cls(id=key_aspect.id)
|
|
2286
2322
|
|
|
2287
2323
|
@property
|
|
@@ -2289,150 +2325,173 @@ class DataHubViewUrn(_SpecificUrn):
|
|
|
2289
2325
|
return self.entity_ids[0]
|
|
2290
2326
|
|
|
2291
2327
|
if TYPE_CHECKING:
|
|
2292
|
-
from datahub.metadata.schema_classes import
|
|
2328
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
2293
2329
|
|
|
2294
|
-
class
|
|
2295
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2296
|
-
URN_PARTS: ClassVar[int] =
|
|
2330
|
+
class ChartUrn(_SpecificUrn):
|
|
2331
|
+
ENTITY_TYPE: ClassVar[str] = "chart"
|
|
2332
|
+
URN_PARTS: ClassVar[int] = 2
|
|
2297
2333
|
|
|
2298
|
-
def __init__(self,
|
|
2334
|
+
def __init__(self, dashboard_tool: str, chart_id: str, *, _allow_coercion: bool = True) -> None:
|
|
2299
2335
|
if _allow_coercion:
|
|
2300
2336
|
# Field coercion logic (if any is required).
|
|
2301
|
-
|
|
2337
|
+
dashboard_tool = UrnEncoder.encode_string(dashboard_tool)
|
|
2338
|
+
chart_id = UrnEncoder.encode_string(chart_id)
|
|
2302
2339
|
|
|
2303
2340
|
# Validation logic.
|
|
2304
|
-
if not
|
|
2305
|
-
raise InvalidUrnError("
|
|
2306
|
-
if UrnEncoder.contains_reserved_char(
|
|
2307
|
-
raise InvalidUrnError(f'
|
|
2341
|
+
if not dashboard_tool:
|
|
2342
|
+
raise InvalidUrnError("ChartUrn dashboard_tool cannot be empty")
|
|
2343
|
+
if UrnEncoder.contains_reserved_char(dashboard_tool):
|
|
2344
|
+
raise InvalidUrnError(f'ChartUrn dashboard_tool contains reserved characters')
|
|
2345
|
+
if not chart_id:
|
|
2346
|
+
raise InvalidUrnError("ChartUrn chart_id cannot be empty")
|
|
2347
|
+
if UrnEncoder.contains_reserved_char(chart_id):
|
|
2348
|
+
raise InvalidUrnError(f'ChartUrn chart_id contains reserved characters')
|
|
2308
2349
|
|
|
2309
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2350
|
+
super().__init__(self.ENTITY_TYPE, [dashboard_tool, chart_id])
|
|
2310
2351
|
|
|
2311
2352
|
@classmethod
|
|
2312
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2353
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "ChartUrn":
|
|
2313
2354
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2314
|
-
raise InvalidUrnError(f"
|
|
2315
|
-
return cls(
|
|
2355
|
+
raise InvalidUrnError(f"ChartUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2356
|
+
return cls(dashboard_tool=entity_ids[0], chart_id=entity_ids[1], _allow_coercion=False)
|
|
2316
2357
|
|
|
2317
2358
|
@classmethod
|
|
2318
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2319
|
-
from datahub.metadata.schema_classes import
|
|
2359
|
+
def underlying_key_aspect_type(cls) -> Type["ChartKeyClass"]:
|
|
2360
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
2320
2361
|
|
|
2321
|
-
return
|
|
2362
|
+
return ChartKeyClass
|
|
2322
2363
|
|
|
2323
|
-
def to_key_aspect(self) -> "
|
|
2324
|
-
from datahub.metadata.schema_classes import
|
|
2364
|
+
def to_key_aspect(self) -> "ChartKeyClass":
|
|
2365
|
+
from datahub.metadata.schema_classes import ChartKeyClass
|
|
2325
2366
|
|
|
2326
|
-
return
|
|
2367
|
+
return ChartKeyClass(dashboardTool=self.dashboard_tool, chartId=self.chart_id)
|
|
2327
2368
|
|
|
2328
2369
|
@classmethod
|
|
2329
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2330
|
-
return cls(
|
|
2370
|
+
def from_key_aspect(cls, key_aspect: "ChartKeyClass") -> "ChartUrn":
|
|
2371
|
+
return cls(dashboard_tool=key_aspect.dashboardTool, chart_id=key_aspect.chartId)
|
|
2331
2372
|
|
|
2332
2373
|
@property
|
|
2333
|
-
def
|
|
2374
|
+
def dashboard_tool(self) -> str:
|
|
2334
2375
|
return self.entity_ids[0]
|
|
2335
2376
|
|
|
2377
|
+
@property
|
|
2378
|
+
def chart_id(self) -> str:
|
|
2379
|
+
return self.entity_ids[1]
|
|
2380
|
+
|
|
2336
2381
|
if TYPE_CHECKING:
|
|
2337
|
-
from datahub.metadata.schema_classes import
|
|
2382
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
2338
2383
|
|
|
2339
|
-
class
|
|
2340
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2341
|
-
URN_PARTS: ClassVar[int] =
|
|
2384
|
+
class MlModelGroupUrn(_SpecificUrn):
|
|
2385
|
+
ENTITY_TYPE: ClassVar[str] = "mlModelGroup"
|
|
2386
|
+
URN_PARTS: ClassVar[int] = 3
|
|
2342
2387
|
|
|
2343
|
-
def __init__(self,
|
|
2388
|
+
def __init__(self, platform: str, name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
2344
2389
|
if _allow_coercion:
|
|
2345
2390
|
# Field coercion logic (if any is required).
|
|
2346
|
-
|
|
2391
|
+
platform = DataPlatformUrn(platform).urn()
|
|
2392
|
+
name = UrnEncoder.encode_string(name)
|
|
2393
|
+
env = env.upper()
|
|
2394
|
+
env = UrnEncoder.encode_string(env)
|
|
2347
2395
|
|
|
2348
2396
|
# Validation logic.
|
|
2349
|
-
if not
|
|
2350
|
-
raise InvalidUrnError("
|
|
2351
|
-
|
|
2352
|
-
|
|
2397
|
+
if not platform:
|
|
2398
|
+
raise InvalidUrnError("MlModelGroupUrn platform cannot be empty")
|
|
2399
|
+
platform = str(platform)
|
|
2400
|
+
assert DataPlatformUrn.from_string(platform)
|
|
2401
|
+
if not name:
|
|
2402
|
+
raise InvalidUrnError("MlModelGroupUrn name cannot be empty")
|
|
2403
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
2404
|
+
raise InvalidUrnError(f'MlModelGroupUrn name contains reserved characters')
|
|
2405
|
+
if not env:
|
|
2406
|
+
raise InvalidUrnError("MlModelGroupUrn env cannot be empty")
|
|
2407
|
+
if UrnEncoder.contains_reserved_char(env):
|
|
2408
|
+
raise InvalidUrnError(f'MlModelGroupUrn env contains reserved characters')
|
|
2353
2409
|
|
|
2354
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2410
|
+
super().__init__(self.ENTITY_TYPE, [platform, name, env])
|
|
2355
2411
|
|
|
2356
2412
|
@classmethod
|
|
2357
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2413
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "MlModelGroupUrn":
|
|
2358
2414
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2359
|
-
raise InvalidUrnError(f"
|
|
2360
|
-
return cls(
|
|
2415
|
+
raise InvalidUrnError(f"MlModelGroupUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2416
|
+
return cls(platform=entity_ids[0], name=entity_ids[1], env=entity_ids[2], _allow_coercion=False)
|
|
2361
2417
|
|
|
2362
2418
|
@classmethod
|
|
2363
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2364
|
-
from datahub.metadata.schema_classes import
|
|
2419
|
+
def underlying_key_aspect_type(cls) -> Type["MLModelGroupKeyClass"]:
|
|
2420
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
2365
2421
|
|
|
2366
|
-
return
|
|
2422
|
+
return MLModelGroupKeyClass
|
|
2367
2423
|
|
|
2368
|
-
def to_key_aspect(self) -> "
|
|
2369
|
-
from datahub.metadata.schema_classes import
|
|
2424
|
+
def to_key_aspect(self) -> "MLModelGroupKeyClass":
|
|
2425
|
+
from datahub.metadata.schema_classes import MLModelGroupKeyClass
|
|
2370
2426
|
|
|
2371
|
-
return
|
|
2427
|
+
return MLModelGroupKeyClass(platform=self.platform, name=self.name, origin=self.env)
|
|
2372
2428
|
|
|
2373
2429
|
@classmethod
|
|
2374
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2375
|
-
return cls(
|
|
2430
|
+
def from_key_aspect(cls, key_aspect: "MLModelGroupKeyClass") -> "MlModelGroupUrn":
|
|
2431
|
+
return cls(platform=key_aspect.platform, name=key_aspect.name, env=key_aspect.origin)
|
|
2376
2432
|
|
|
2377
2433
|
@property
|
|
2378
|
-
def
|
|
2434
|
+
def platform(self) -> str:
|
|
2379
2435
|
return self.entity_ids[0]
|
|
2380
2436
|
|
|
2437
|
+
@property
|
|
2438
|
+
def name(self) -> str:
|
|
2439
|
+
return self.entity_ids[1]
|
|
2440
|
+
|
|
2441
|
+
@property
|
|
2442
|
+
def env(self) -> str:
|
|
2443
|
+
return self.entity_ids[2]
|
|
2444
|
+
|
|
2381
2445
|
if TYPE_CHECKING:
|
|
2382
|
-
from datahub.metadata.schema_classes import
|
|
2446
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
2383
2447
|
|
|
2384
|
-
class
|
|
2385
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2448
|
+
class TelemetryUrn(_SpecificUrn):
|
|
2449
|
+
ENTITY_TYPE: ClassVar[str] = "telemetry"
|
|
2386
2450
|
URN_PARTS: ClassVar[int] = 1
|
|
2387
2451
|
|
|
2388
|
-
def __init__(self,
|
|
2452
|
+
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
2389
2453
|
if _allow_coercion:
|
|
2390
2454
|
# Field coercion logic (if any is required).
|
|
2391
|
-
|
|
2455
|
+
name = UrnEncoder.encode_string(name)
|
|
2392
2456
|
|
|
2393
2457
|
# Validation logic.
|
|
2394
|
-
if not
|
|
2395
|
-
raise InvalidUrnError("
|
|
2396
|
-
if UrnEncoder.contains_reserved_char(
|
|
2397
|
-
raise InvalidUrnError(f'
|
|
2458
|
+
if not name:
|
|
2459
|
+
raise InvalidUrnError("TelemetryUrn name cannot be empty")
|
|
2460
|
+
if UrnEncoder.contains_reserved_char(name):
|
|
2461
|
+
raise InvalidUrnError(f'TelemetryUrn name contains reserved characters')
|
|
2398
2462
|
|
|
2399
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2463
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
2400
2464
|
|
|
2401
2465
|
@classmethod
|
|
2402
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2466
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "TelemetryUrn":
|
|
2403
2467
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2404
|
-
raise InvalidUrnError(f"
|
|
2405
|
-
return cls(
|
|
2468
|
+
raise InvalidUrnError(f"TelemetryUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2469
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
2406
2470
|
|
|
2407
2471
|
@classmethod
|
|
2408
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2409
|
-
from datahub.metadata.schema_classes import
|
|
2410
|
-
|
|
2411
|
-
return DomainKeyClass
|
|
2472
|
+
def underlying_key_aspect_type(cls) -> Type["TelemetryKeyClass"]:
|
|
2473
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
2412
2474
|
|
|
2413
|
-
|
|
2414
|
-
from datahub.metadata.schema_classes import DomainKeyClass
|
|
2475
|
+
return TelemetryKeyClass
|
|
2415
2476
|
|
|
2416
|
-
|
|
2477
|
+
def to_key_aspect(self) -> "TelemetryKeyClass":
|
|
2478
|
+
from datahub.metadata.schema_classes import TelemetryKeyClass
|
|
2417
2479
|
|
|
2418
|
-
|
|
2419
|
-
def from_key_aspect(cls, key_aspect: "DomainKeyClass") -> "DomainUrn":
|
|
2420
|
-
return cls(id=key_aspect.id)
|
|
2480
|
+
return TelemetryKeyClass(name=self.name)
|
|
2421
2481
|
|
|
2422
2482
|
@classmethod
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
return cls(id)
|
|
2483
|
+
def from_key_aspect(cls, key_aspect: "TelemetryKeyClass") -> "TelemetryUrn":
|
|
2484
|
+
return cls(name=key_aspect.name)
|
|
2426
2485
|
|
|
2427
2486
|
@property
|
|
2428
|
-
def
|
|
2487
|
+
def name(self) -> str:
|
|
2429
2488
|
return self.entity_ids[0]
|
|
2430
2489
|
|
|
2431
2490
|
if TYPE_CHECKING:
|
|
2432
|
-
from datahub.metadata.schema_classes import
|
|
2491
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
2433
2492
|
|
|
2434
|
-
class
|
|
2435
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2493
|
+
class DomainUrn(_SpecificUrn):
|
|
2494
|
+
ENTITY_TYPE: ClassVar[str] = "domain"
|
|
2436
2495
|
URN_PARTS: ClassVar[int] = 1
|
|
2437
2496
|
|
|
2438
2497
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2442,151 +2501,137 @@ class DataHubActionUrn(_SpecificUrn):
|
|
|
2442
2501
|
|
|
2443
2502
|
# Validation logic.
|
|
2444
2503
|
if not id:
|
|
2445
|
-
raise InvalidUrnError("
|
|
2504
|
+
raise InvalidUrnError("DomainUrn id cannot be empty")
|
|
2446
2505
|
if UrnEncoder.contains_reserved_char(id):
|
|
2447
|
-
raise InvalidUrnError(f'
|
|
2506
|
+
raise InvalidUrnError(f'DomainUrn id contains reserved characters')
|
|
2448
2507
|
|
|
2449
2508
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2450
2509
|
|
|
2451
2510
|
@classmethod
|
|
2452
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2511
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "DomainUrn":
|
|
2453
2512
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2454
|
-
raise InvalidUrnError(f"
|
|
2513
|
+
raise InvalidUrnError(f"DomainUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2455
2514
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2456
2515
|
|
|
2457
2516
|
@classmethod
|
|
2458
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2459
|
-
from datahub.metadata.schema_classes import
|
|
2517
|
+
def underlying_key_aspect_type(cls) -> Type["DomainKeyClass"]:
|
|
2518
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
2460
2519
|
|
|
2461
|
-
return
|
|
2520
|
+
return DomainKeyClass
|
|
2462
2521
|
|
|
2463
|
-
def to_key_aspect(self) -> "
|
|
2464
|
-
from datahub.metadata.schema_classes import
|
|
2522
|
+
def to_key_aspect(self) -> "DomainKeyClass":
|
|
2523
|
+
from datahub.metadata.schema_classes import DomainKeyClass
|
|
2465
2524
|
|
|
2466
|
-
return
|
|
2525
|
+
return DomainKeyClass(id=self.id)
|
|
2467
2526
|
|
|
2468
2527
|
@classmethod
|
|
2469
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2528
|
+
def from_key_aspect(cls, key_aspect: "DomainKeyClass") -> "DomainUrn":
|
|
2470
2529
|
return cls(id=key_aspect.id)
|
|
2471
2530
|
|
|
2531
|
+
@classmethod
|
|
2532
|
+
@deprecated(reason="Use the constructor instead")
|
|
2533
|
+
def create_from_id(cls, id: str) -> "DomainUrn":
|
|
2534
|
+
return cls(id)
|
|
2535
|
+
|
|
2472
2536
|
@property
|
|
2473
2537
|
def id(self) -> str:
|
|
2474
2538
|
return self.entity_ids[0]
|
|
2475
2539
|
|
|
2476
2540
|
if TYPE_CHECKING:
|
|
2477
|
-
from datahub.metadata.schema_classes import
|
|
2541
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2478
2542
|
|
|
2479
|
-
class
|
|
2480
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2543
|
+
class IncidentUrn(_SpecificUrn):
|
|
2544
|
+
ENTITY_TYPE: ClassVar[str] = "incident"
|
|
2481
2545
|
URN_PARTS: ClassVar[int] = 1
|
|
2482
2546
|
|
|
2483
|
-
def __init__(self,
|
|
2547
|
+
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2484
2548
|
if _allow_coercion:
|
|
2485
2549
|
# Field coercion logic (if any is required).
|
|
2486
|
-
|
|
2550
|
+
id = UrnEncoder.encode_string(id)
|
|
2487
2551
|
|
|
2488
2552
|
# Validation logic.
|
|
2489
|
-
if not
|
|
2490
|
-
raise InvalidUrnError("
|
|
2491
|
-
if UrnEncoder.contains_reserved_char(
|
|
2492
|
-
raise InvalidUrnError(f'
|
|
2553
|
+
if not id:
|
|
2554
|
+
raise InvalidUrnError("IncidentUrn id cannot be empty")
|
|
2555
|
+
if UrnEncoder.contains_reserved_char(id):
|
|
2556
|
+
raise InvalidUrnError(f'IncidentUrn id contains reserved characters')
|
|
2493
2557
|
|
|
2494
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2558
|
+
super().__init__(self.ENTITY_TYPE, [id])
|
|
2495
2559
|
|
|
2496
2560
|
@classmethod
|
|
2497
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2561
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "IncidentUrn":
|
|
2498
2562
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2499
|
-
raise InvalidUrnError(f"
|
|
2500
|
-
return cls(
|
|
2563
|
+
raise InvalidUrnError(f"IncidentUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2564
|
+
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2501
2565
|
|
|
2502
2566
|
@classmethod
|
|
2503
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2504
|
-
from datahub.metadata.schema_classes import
|
|
2567
|
+
def underlying_key_aspect_type(cls) -> Type["IncidentKeyClass"]:
|
|
2568
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2505
2569
|
|
|
2506
|
-
return
|
|
2570
|
+
return IncidentKeyClass
|
|
2507
2571
|
|
|
2508
|
-
def to_key_aspect(self) -> "
|
|
2509
|
-
from datahub.metadata.schema_classes import
|
|
2572
|
+
def to_key_aspect(self) -> "IncidentKeyClass":
|
|
2573
|
+
from datahub.metadata.schema_classes import IncidentKeyClass
|
|
2510
2574
|
|
|
2511
|
-
return
|
|
2575
|
+
return IncidentKeyClass(id=self.id)
|
|
2512
2576
|
|
|
2513
2577
|
@classmethod
|
|
2514
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2515
|
-
return cls(
|
|
2578
|
+
def from_key_aspect(cls, key_aspect: "IncidentKeyClass") -> "IncidentUrn":
|
|
2579
|
+
return cls(id=key_aspect.id)
|
|
2516
2580
|
|
|
2517
2581
|
@property
|
|
2518
|
-
def
|
|
2582
|
+
def id(self) -> str:
|
|
2519
2583
|
return self.entity_ids[0]
|
|
2520
2584
|
|
|
2521
2585
|
if TYPE_CHECKING:
|
|
2522
|
-
from datahub.metadata.schema_classes import
|
|
2586
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2523
2587
|
|
|
2524
|
-
class
|
|
2525
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2526
|
-
URN_PARTS: ClassVar[int] =
|
|
2588
|
+
class GlossaryTermUrn(_SpecificUrn):
|
|
2589
|
+
ENTITY_TYPE: ClassVar[str] = "glossaryTerm"
|
|
2590
|
+
URN_PARTS: ClassVar[int] = 1
|
|
2527
2591
|
|
|
2528
|
-
def __init__(self,
|
|
2592
|
+
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
2529
2593
|
if _allow_coercion:
|
|
2530
2594
|
# Field coercion logic (if any is required).
|
|
2531
|
-
platform = DataPlatformUrn(platform).urn()
|
|
2532
2595
|
name = UrnEncoder.encode_string(name)
|
|
2533
|
-
env = env.upper()
|
|
2534
|
-
env = UrnEncoder.encode_string(env)
|
|
2535
2596
|
|
|
2536
2597
|
# Validation logic.
|
|
2537
|
-
if not platform:
|
|
2538
|
-
raise InvalidUrnError("MlModelUrn platform cannot be empty")
|
|
2539
|
-
platform = str(platform)
|
|
2540
|
-
assert DataPlatformUrn.from_string(platform)
|
|
2541
2598
|
if not name:
|
|
2542
|
-
raise InvalidUrnError("
|
|
2599
|
+
raise InvalidUrnError("GlossaryTermUrn name cannot be empty")
|
|
2543
2600
|
if UrnEncoder.contains_reserved_char(name):
|
|
2544
|
-
raise InvalidUrnError(f'
|
|
2545
|
-
if not env:
|
|
2546
|
-
raise InvalidUrnError("MlModelUrn env cannot be empty")
|
|
2547
|
-
if UrnEncoder.contains_reserved_char(env):
|
|
2548
|
-
raise InvalidUrnError(f'MlModelUrn env contains reserved characters')
|
|
2601
|
+
raise InvalidUrnError(f'GlossaryTermUrn name contains reserved characters')
|
|
2549
2602
|
|
|
2550
|
-
super().__init__(self.ENTITY_TYPE, [
|
|
2603
|
+
super().__init__(self.ENTITY_TYPE, [name])
|
|
2551
2604
|
|
|
2552
2605
|
@classmethod
|
|
2553
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2606
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "GlossaryTermUrn":
|
|
2554
2607
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2555
|
-
raise InvalidUrnError(f"
|
|
2556
|
-
return cls(
|
|
2608
|
+
raise InvalidUrnError(f"GlossaryTermUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2609
|
+
return cls(name=entity_ids[0], _allow_coercion=False)
|
|
2557
2610
|
|
|
2558
2611
|
@classmethod
|
|
2559
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2560
|
-
from datahub.metadata.schema_classes import
|
|
2612
|
+
def underlying_key_aspect_type(cls) -> Type["GlossaryTermKeyClass"]:
|
|
2613
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2561
2614
|
|
|
2562
|
-
return
|
|
2615
|
+
return GlossaryTermKeyClass
|
|
2563
2616
|
|
|
2564
|
-
def to_key_aspect(self) -> "
|
|
2565
|
-
from datahub.metadata.schema_classes import
|
|
2617
|
+
def to_key_aspect(self) -> "GlossaryTermKeyClass":
|
|
2618
|
+
from datahub.metadata.schema_classes import GlossaryTermKeyClass
|
|
2566
2619
|
|
|
2567
|
-
return
|
|
2620
|
+
return GlossaryTermKeyClass(name=self.name)
|
|
2568
2621
|
|
|
2569
2622
|
@classmethod
|
|
2570
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2571
|
-
return cls(
|
|
2572
|
-
|
|
2573
|
-
@property
|
|
2574
|
-
def platform(self) -> str:
|
|
2575
|
-
return self.entity_ids[0]
|
|
2623
|
+
def from_key_aspect(cls, key_aspect: "GlossaryTermKeyClass") -> "GlossaryTermUrn":
|
|
2624
|
+
return cls(name=key_aspect.name)
|
|
2576
2625
|
|
|
2577
2626
|
@property
|
|
2578
2627
|
def name(self) -> str:
|
|
2579
|
-
return self.entity_ids[
|
|
2580
|
-
|
|
2581
|
-
@property
|
|
2582
|
-
def env(self) -> str:
|
|
2583
|
-
return self.entity_ids[2]
|
|
2628
|
+
return self.entity_ids[0]
|
|
2584
2629
|
|
|
2585
2630
|
if TYPE_CHECKING:
|
|
2586
|
-
from datahub.metadata.schema_classes import
|
|
2631
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2587
2632
|
|
|
2588
|
-
class
|
|
2589
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2633
|
+
class InviteTokenUrn(_SpecificUrn):
|
|
2634
|
+
ENTITY_TYPE: ClassVar[str] = "inviteToken"
|
|
2590
2635
|
URN_PARTS: ClassVar[int] = 1
|
|
2591
2636
|
|
|
2592
2637
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2596,31 +2641,31 @@ class StructuredPropertyUrn(_SpecificUrn):
|
|
|
2596
2641
|
|
|
2597
2642
|
# Validation logic.
|
|
2598
2643
|
if not id:
|
|
2599
|
-
raise InvalidUrnError("
|
|
2644
|
+
raise InvalidUrnError("InviteTokenUrn id cannot be empty")
|
|
2600
2645
|
if UrnEncoder.contains_reserved_char(id):
|
|
2601
|
-
raise InvalidUrnError(f'
|
|
2646
|
+
raise InvalidUrnError(f'InviteTokenUrn id contains reserved characters')
|
|
2602
2647
|
|
|
2603
2648
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2604
2649
|
|
|
2605
2650
|
@classmethod
|
|
2606
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2651
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "InviteTokenUrn":
|
|
2607
2652
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2608
|
-
raise InvalidUrnError(f"
|
|
2653
|
+
raise InvalidUrnError(f"InviteTokenUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2609
2654
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2610
2655
|
|
|
2611
2656
|
@classmethod
|
|
2612
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2613
|
-
from datahub.metadata.schema_classes import
|
|
2657
|
+
def underlying_key_aspect_type(cls) -> Type["InviteTokenKeyClass"]:
|
|
2658
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2614
2659
|
|
|
2615
|
-
return
|
|
2660
|
+
return InviteTokenKeyClass
|
|
2616
2661
|
|
|
2617
|
-
def to_key_aspect(self) -> "
|
|
2618
|
-
from datahub.metadata.schema_classes import
|
|
2662
|
+
def to_key_aspect(self) -> "InviteTokenKeyClass":
|
|
2663
|
+
from datahub.metadata.schema_classes import InviteTokenKeyClass
|
|
2619
2664
|
|
|
2620
|
-
return
|
|
2665
|
+
return InviteTokenKeyClass(id=self.id)
|
|
2621
2666
|
|
|
2622
2667
|
@classmethod
|
|
2623
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2668
|
+
def from_key_aspect(cls, key_aspect: "InviteTokenKeyClass") -> "InviteTokenUrn":
|
|
2624
2669
|
return cls(id=key_aspect.id)
|
|
2625
2670
|
|
|
2626
2671
|
@property
|
|
@@ -2628,10 +2673,10 @@ class StructuredPropertyUrn(_SpecificUrn):
|
|
|
2628
2673
|
return self.entity_ids[0]
|
|
2629
2674
|
|
|
2630
2675
|
if TYPE_CHECKING:
|
|
2631
|
-
from datahub.metadata.schema_classes import
|
|
2676
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
2632
2677
|
|
|
2633
|
-
class
|
|
2634
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2678
|
+
class PlatformResourceUrn(_SpecificUrn):
|
|
2679
|
+
ENTITY_TYPE: ClassVar[str] = "platformResource"
|
|
2635
2680
|
URN_PARTS: ClassVar[int] = 1
|
|
2636
2681
|
|
|
2637
2682
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2641,31 +2686,31 @@ class DataTypeUrn(_SpecificUrn):
|
|
|
2641
2686
|
|
|
2642
2687
|
# Validation logic.
|
|
2643
2688
|
if not id:
|
|
2644
|
-
raise InvalidUrnError("
|
|
2689
|
+
raise InvalidUrnError("PlatformResourceUrn id cannot be empty")
|
|
2645
2690
|
if UrnEncoder.contains_reserved_char(id):
|
|
2646
|
-
raise InvalidUrnError(f'
|
|
2691
|
+
raise InvalidUrnError(f'PlatformResourceUrn id contains reserved characters')
|
|
2647
2692
|
|
|
2648
2693
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2649
2694
|
|
|
2650
2695
|
@classmethod
|
|
2651
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2696
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "PlatformResourceUrn":
|
|
2652
2697
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2653
|
-
raise InvalidUrnError(f"
|
|
2698
|
+
raise InvalidUrnError(f"PlatformResourceUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2654
2699
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2655
2700
|
|
|
2656
2701
|
@classmethod
|
|
2657
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2658
|
-
from datahub.metadata.schema_classes import
|
|
2702
|
+
def underlying_key_aspect_type(cls) -> Type["PlatformResourceKeyClass"]:
|
|
2703
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
2659
2704
|
|
|
2660
|
-
return
|
|
2705
|
+
return PlatformResourceKeyClass
|
|
2661
2706
|
|
|
2662
|
-
def to_key_aspect(self) -> "
|
|
2663
|
-
from datahub.metadata.schema_classes import
|
|
2707
|
+
def to_key_aspect(self) -> "PlatformResourceKeyClass":
|
|
2708
|
+
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
2664
2709
|
|
|
2665
|
-
return
|
|
2710
|
+
return PlatformResourceKeyClass(id=self.id)
|
|
2666
2711
|
|
|
2667
2712
|
@classmethod
|
|
2668
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2713
|
+
def from_key_aspect(cls, key_aspect: "PlatformResourceKeyClass") -> "PlatformResourceUrn":
|
|
2669
2714
|
return cls(id=key_aspect.id)
|
|
2670
2715
|
|
|
2671
2716
|
@property
|
|
@@ -2673,10 +2718,10 @@ class DataTypeUrn(_SpecificUrn):
|
|
|
2673
2718
|
return self.entity_ids[0]
|
|
2674
2719
|
|
|
2675
2720
|
if TYPE_CHECKING:
|
|
2676
|
-
from datahub.metadata.schema_classes import
|
|
2721
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
2677
2722
|
|
|
2678
|
-
class
|
|
2679
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2723
|
+
class EntityTypeUrn(_SpecificUrn):
|
|
2724
|
+
ENTITY_TYPE: ClassVar[str] = "entityType"
|
|
2680
2725
|
URN_PARTS: ClassVar[int] = 1
|
|
2681
2726
|
|
|
2682
2727
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2686,31 +2731,31 @@ class BusinessAttributeUrn(_SpecificUrn):
|
|
|
2686
2731
|
|
|
2687
2732
|
# Validation logic.
|
|
2688
2733
|
if not id:
|
|
2689
|
-
raise InvalidUrnError("
|
|
2734
|
+
raise InvalidUrnError("EntityTypeUrn id cannot be empty")
|
|
2690
2735
|
if UrnEncoder.contains_reserved_char(id):
|
|
2691
|
-
raise InvalidUrnError(f'
|
|
2736
|
+
raise InvalidUrnError(f'EntityTypeUrn id contains reserved characters')
|
|
2692
2737
|
|
|
2693
2738
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2694
2739
|
|
|
2695
2740
|
@classmethod
|
|
2696
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2741
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "EntityTypeUrn":
|
|
2697
2742
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2698
|
-
raise InvalidUrnError(f"
|
|
2743
|
+
raise InvalidUrnError(f"EntityTypeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2699
2744
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2700
2745
|
|
|
2701
2746
|
@classmethod
|
|
2702
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2703
|
-
from datahub.metadata.schema_classes import
|
|
2747
|
+
def underlying_key_aspect_type(cls) -> Type["EntityTypeKeyClass"]:
|
|
2748
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
2704
2749
|
|
|
2705
|
-
return
|
|
2750
|
+
return EntityTypeKeyClass
|
|
2706
2751
|
|
|
2707
|
-
def to_key_aspect(self) -> "
|
|
2708
|
-
from datahub.metadata.schema_classes import
|
|
2752
|
+
def to_key_aspect(self) -> "EntityTypeKeyClass":
|
|
2753
|
+
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
2709
2754
|
|
|
2710
|
-
return
|
|
2755
|
+
return EntityTypeKeyClass(id=self.id)
|
|
2711
2756
|
|
|
2712
2757
|
@classmethod
|
|
2713
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2758
|
+
def from_key_aspect(cls, key_aspect: "EntityTypeKeyClass") -> "EntityTypeUrn":
|
|
2714
2759
|
return cls(id=key_aspect.id)
|
|
2715
2760
|
|
|
2716
2761
|
@property
|
|
@@ -2763,55 +2808,10 @@ class DataProductUrn(_SpecificUrn):
|
|
|
2763
2808
|
return self.entity_ids[0]
|
|
2764
2809
|
|
|
2765
2810
|
if TYPE_CHECKING:
|
|
2766
|
-
from datahub.metadata.schema_classes import
|
|
2767
|
-
|
|
2768
|
-
class EntityTypeUrn(_SpecificUrn):
|
|
2769
|
-
ENTITY_TYPE: ClassVar[str] = "entityType"
|
|
2770
|
-
URN_PARTS: ClassVar[int] = 1
|
|
2771
|
-
|
|
2772
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2773
|
-
if _allow_coercion:
|
|
2774
|
-
# Field coercion logic (if any is required).
|
|
2775
|
-
id = UrnEncoder.encode_string(id)
|
|
2776
|
-
|
|
2777
|
-
# Validation logic.
|
|
2778
|
-
if not id:
|
|
2779
|
-
raise InvalidUrnError("EntityTypeUrn id cannot be empty")
|
|
2780
|
-
if UrnEncoder.contains_reserved_char(id):
|
|
2781
|
-
raise InvalidUrnError(f'EntityTypeUrn id contains reserved characters')
|
|
2782
|
-
|
|
2783
|
-
super().__init__(self.ENTITY_TYPE, [id])
|
|
2784
|
-
|
|
2785
|
-
@classmethod
|
|
2786
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "EntityTypeUrn":
|
|
2787
|
-
if len(entity_ids) != cls.URN_PARTS:
|
|
2788
|
-
raise InvalidUrnError(f"EntityTypeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2789
|
-
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2790
|
-
|
|
2791
|
-
@classmethod
|
|
2792
|
-
def underlying_key_aspect_type(cls) -> Type["EntityTypeKeyClass"]:
|
|
2793
|
-
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
2794
|
-
|
|
2795
|
-
return EntityTypeKeyClass
|
|
2796
|
-
|
|
2797
|
-
def to_key_aspect(self) -> "EntityTypeKeyClass":
|
|
2798
|
-
from datahub.metadata.schema_classes import EntityTypeKeyClass
|
|
2799
|
-
|
|
2800
|
-
return EntityTypeKeyClass(id=self.id)
|
|
2801
|
-
|
|
2802
|
-
@classmethod
|
|
2803
|
-
def from_key_aspect(cls, key_aspect: "EntityTypeKeyClass") -> "EntityTypeUrn":
|
|
2804
|
-
return cls(id=key_aspect.id)
|
|
2805
|
-
|
|
2806
|
-
@property
|
|
2807
|
-
def id(self) -> str:
|
|
2808
|
-
return self.entity_ids[0]
|
|
2809
|
-
|
|
2810
|
-
if TYPE_CHECKING:
|
|
2811
|
-
from datahub.metadata.schema_classes import PlatformResourceKeyClass
|
|
2811
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
2812
2812
|
|
|
2813
|
-
class
|
|
2814
|
-
ENTITY_TYPE: ClassVar[str] = "
|
|
2813
|
+
class BusinessAttributeUrn(_SpecificUrn):
|
|
2814
|
+
ENTITY_TYPE: ClassVar[str] = "businessAttribute"
|
|
2815
2815
|
URN_PARTS: ClassVar[int] = 1
|
|
2816
2816
|
|
|
2817
2817
|
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
@@ -2821,31 +2821,31 @@ class PlatformResourceUrn(_SpecificUrn):
|
|
|
2821
2821
|
|
|
2822
2822
|
# Validation logic.
|
|
2823
2823
|
if not id:
|
|
2824
|
-
raise InvalidUrnError("
|
|
2824
|
+
raise InvalidUrnError("BusinessAttributeUrn id cannot be empty")
|
|
2825
2825
|
if UrnEncoder.contains_reserved_char(id):
|
|
2826
|
-
raise InvalidUrnError(f'
|
|
2826
|
+
raise InvalidUrnError(f'BusinessAttributeUrn id contains reserved characters')
|
|
2827
2827
|
|
|
2828
2828
|
super().__init__(self.ENTITY_TYPE, [id])
|
|
2829
2829
|
|
|
2830
2830
|
@classmethod
|
|
2831
|
-
def _parse_ids(cls, entity_ids: List[str]) -> "
|
|
2831
|
+
def _parse_ids(cls, entity_ids: List[str]) -> "BusinessAttributeUrn":
|
|
2832
2832
|
if len(entity_ids) != cls.URN_PARTS:
|
|
2833
|
-
raise InvalidUrnError(f"
|
|
2833
|
+
raise InvalidUrnError(f"BusinessAttributeUrn should have {cls.URN_PARTS} parts, got {len(entity_ids)}: {entity_ids}")
|
|
2834
2834
|
return cls(id=entity_ids[0], _allow_coercion=False)
|
|
2835
2835
|
|
|
2836
2836
|
@classmethod
|
|
2837
|
-
def underlying_key_aspect_type(cls) -> Type["
|
|
2838
|
-
from datahub.metadata.schema_classes import
|
|
2837
|
+
def underlying_key_aspect_type(cls) -> Type["BusinessAttributeKeyClass"]:
|
|
2838
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
2839
2839
|
|
|
2840
|
-
return
|
|
2840
|
+
return BusinessAttributeKeyClass
|
|
2841
2841
|
|
|
2842
|
-
def to_key_aspect(self) -> "
|
|
2843
|
-
from datahub.metadata.schema_classes import
|
|
2842
|
+
def to_key_aspect(self) -> "BusinessAttributeKeyClass":
|
|
2843
|
+
from datahub.metadata.schema_classes import BusinessAttributeKeyClass
|
|
2844
2844
|
|
|
2845
|
-
return
|
|
2845
|
+
return BusinessAttributeKeyClass(id=self.id)
|
|
2846
2846
|
|
|
2847
2847
|
@classmethod
|
|
2848
|
-
def from_key_aspect(cls, key_aspect: "
|
|
2848
|
+
def from_key_aspect(cls, key_aspect: "BusinessAttributeKeyClass") -> "BusinessAttributeUrn":
|
|
2849
2849
|
return cls(id=key_aspect.id)
|
|
2850
2850
|
|
|
2851
2851
|
@property
|