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