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