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