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