acryl-datahub 0.15.0.4rc1__py3-none-any.whl → 0.15.0.4rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of acryl-datahub might be problematic. Click here for more details.
- acryl_datahub-0.15.0.4rc3.dist-info/LICENSE +202 -0
- {acryl_datahub-0.15.0.4rc1.dist-info → acryl_datahub-0.15.0.4rc3.dist-info}/METADATA +2404 -2401
- {acryl_datahub-0.15.0.4rc1.dist-info → acryl_datahub-0.15.0.4rc3.dist-info}/RECORD +24 -23
- datahub/__init__.py +1 -1
- datahub/cli/container_cli.py +30 -11
- datahub/emitter/enum_helpers.py +4 -2
- datahub/emitter/mce_builder.py +4 -0
- datahub/emitter/mcp_builder.py +19 -0
- datahub/ingestion/api/decorators.py +2 -0
- datahub/ingestion/api/registry.py +3 -1
- datahub/ingestion/api/sink.py +12 -0
- datahub/ingestion/api/source.py +5 -2
- datahub/ingestion/source/aws/glue.py +11 -5
- datahub/ingestion/source/powerbi/powerbi.py +4 -4
- datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py +6 -6
- datahub/ingestion/source/powerbi/rest_api_wrapper/powerbi_api.py +24 -18
- datahub/ingestion/source/slack/slack.py +6 -0
- datahub/ingestion/source/sql/mssql/job_models.py +2 -2
- datahub/ingestion/source/sql/mssql/source.py +26 -11
- datahub/metadata/_urns/urn_defs.py +550 -101
- datahub/utilities/urns/_urn_base.py +6 -2
- {acryl_datahub-0.15.0.4rc1.dist-info → acryl_datahub-0.15.0.4rc3.dist-info}/WHEEL +0 -0
- {acryl_datahub-0.15.0.4rc1.dist-info → acryl_datahub-0.15.0.4rc3.dist-info}/entry_points.txt +0 -0
- {acryl_datahub-0.15.0.4rc1.dist-info → acryl_datahub-0.15.0.4rc3.dist-info}/top_level.txt +0 -0
|
@@ -28,14 +28,25 @@ class StructuredPropertyUrn(_SpecificUrn):
|
|
|
28
28
|
ENTITY_TYPE: ClassVar[str] = "structuredProperty"
|
|
29
29
|
_URN_PARTS: ClassVar[int] = 1
|
|
30
30
|
|
|
31
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
31
|
+
def __init__(self, id: Union["StructuredPropertyUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
32
32
|
if _allow_coercion:
|
|
33
33
|
# Field coercion logic (if any is required).
|
|
34
|
-
|
|
34
|
+
if isinstance(id, str):
|
|
35
|
+
if id.startswith('urn:li:'):
|
|
36
|
+
try:
|
|
37
|
+
id = StructuredPropertyUrn.from_string(id)
|
|
38
|
+
except InvalidUrnError:
|
|
39
|
+
raise InvalidUrnError(f'Expecting a StructuredPropertyUrn but got {id}')
|
|
40
|
+
else:
|
|
41
|
+
id = UrnEncoder.encode_string(id)
|
|
35
42
|
|
|
36
43
|
# Validation logic.
|
|
37
44
|
if not id:
|
|
38
45
|
raise InvalidUrnError("StructuredPropertyUrn id cannot be empty")
|
|
46
|
+
if isinstance(id, StructuredPropertyUrn):
|
|
47
|
+
id = id.id
|
|
48
|
+
elif isinstance(id, Urn):
|
|
49
|
+
raise InvalidUrnError(f'Expecting a StructuredPropertyUrn but got {id}')
|
|
39
50
|
if UrnEncoder.contains_reserved_char(id):
|
|
40
51
|
raise InvalidUrnError(f'StructuredPropertyUrn id contains reserved characters')
|
|
41
52
|
|
|
@@ -73,14 +84,25 @@ class BusinessAttributeUrn(_SpecificUrn):
|
|
|
73
84
|
ENTITY_TYPE: ClassVar[str] = "businessAttribute"
|
|
74
85
|
_URN_PARTS: ClassVar[int] = 1
|
|
75
86
|
|
|
76
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
87
|
+
def __init__(self, id: Union["BusinessAttributeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
77
88
|
if _allow_coercion:
|
|
78
89
|
# Field coercion logic (if any is required).
|
|
79
|
-
|
|
90
|
+
if isinstance(id, str):
|
|
91
|
+
if id.startswith('urn:li:'):
|
|
92
|
+
try:
|
|
93
|
+
id = BusinessAttributeUrn.from_string(id)
|
|
94
|
+
except InvalidUrnError:
|
|
95
|
+
raise InvalidUrnError(f'Expecting a BusinessAttributeUrn but got {id}')
|
|
96
|
+
else:
|
|
97
|
+
id = UrnEncoder.encode_string(id)
|
|
80
98
|
|
|
81
99
|
# Validation logic.
|
|
82
100
|
if not id:
|
|
83
101
|
raise InvalidUrnError("BusinessAttributeUrn id cannot be empty")
|
|
102
|
+
if isinstance(id, BusinessAttributeUrn):
|
|
103
|
+
id = id.id
|
|
104
|
+
elif isinstance(id, Urn):
|
|
105
|
+
raise InvalidUrnError(f'Expecting a BusinessAttributeUrn but got {id}')
|
|
84
106
|
if UrnEncoder.contains_reserved_char(id):
|
|
85
107
|
raise InvalidUrnError(f'BusinessAttributeUrn id contains reserved characters')
|
|
86
108
|
|
|
@@ -118,14 +140,25 @@ class DataProductUrn(_SpecificUrn):
|
|
|
118
140
|
ENTITY_TYPE: ClassVar[str] = "dataProduct"
|
|
119
141
|
_URN_PARTS: ClassVar[int] = 1
|
|
120
142
|
|
|
121
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
143
|
+
def __init__(self, id: Union["DataProductUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
122
144
|
if _allow_coercion:
|
|
123
145
|
# Field coercion logic (if any is required).
|
|
124
|
-
|
|
146
|
+
if isinstance(id, str):
|
|
147
|
+
if id.startswith('urn:li:'):
|
|
148
|
+
try:
|
|
149
|
+
id = DataProductUrn.from_string(id)
|
|
150
|
+
except InvalidUrnError:
|
|
151
|
+
raise InvalidUrnError(f'Expecting a DataProductUrn but got {id}')
|
|
152
|
+
else:
|
|
153
|
+
id = UrnEncoder.encode_string(id)
|
|
125
154
|
|
|
126
155
|
# Validation logic.
|
|
127
156
|
if not id:
|
|
128
157
|
raise InvalidUrnError("DataProductUrn id cannot be empty")
|
|
158
|
+
if isinstance(id, DataProductUrn):
|
|
159
|
+
id = id.id
|
|
160
|
+
elif isinstance(id, Urn):
|
|
161
|
+
raise InvalidUrnError(f'Expecting a DataProductUrn but got {id}')
|
|
129
162
|
if UrnEncoder.contains_reserved_char(id):
|
|
130
163
|
raise InvalidUrnError(f'DataProductUrn id contains reserved characters')
|
|
131
164
|
|
|
@@ -163,14 +196,25 @@ class DataTypeUrn(_SpecificUrn):
|
|
|
163
196
|
ENTITY_TYPE: ClassVar[str] = "dataType"
|
|
164
197
|
_URN_PARTS: ClassVar[int] = 1
|
|
165
198
|
|
|
166
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
199
|
+
def __init__(self, id: Union["DataTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
167
200
|
if _allow_coercion:
|
|
168
201
|
# Field coercion logic (if any is required).
|
|
169
|
-
|
|
202
|
+
if isinstance(id, str):
|
|
203
|
+
if id.startswith('urn:li:'):
|
|
204
|
+
try:
|
|
205
|
+
id = DataTypeUrn.from_string(id)
|
|
206
|
+
except InvalidUrnError:
|
|
207
|
+
raise InvalidUrnError(f'Expecting a DataTypeUrn but got {id}')
|
|
208
|
+
else:
|
|
209
|
+
id = UrnEncoder.encode_string(id)
|
|
170
210
|
|
|
171
211
|
# Validation logic.
|
|
172
212
|
if not id:
|
|
173
213
|
raise InvalidUrnError("DataTypeUrn id cannot be empty")
|
|
214
|
+
if isinstance(id, DataTypeUrn):
|
|
215
|
+
id = id.id
|
|
216
|
+
elif isinstance(id, Urn):
|
|
217
|
+
raise InvalidUrnError(f'Expecting a DataTypeUrn but got {id}')
|
|
174
218
|
if UrnEncoder.contains_reserved_char(id):
|
|
175
219
|
raise InvalidUrnError(f'DataTypeUrn id contains reserved characters')
|
|
176
220
|
|
|
@@ -208,14 +252,25 @@ class PlatformResourceUrn(_SpecificUrn):
|
|
|
208
252
|
ENTITY_TYPE: ClassVar[str] = "platformResource"
|
|
209
253
|
_URN_PARTS: ClassVar[int] = 1
|
|
210
254
|
|
|
211
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
255
|
+
def __init__(self, id: Union["PlatformResourceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
212
256
|
if _allow_coercion:
|
|
213
257
|
# Field coercion logic (if any is required).
|
|
214
|
-
|
|
258
|
+
if isinstance(id, str):
|
|
259
|
+
if id.startswith('urn:li:'):
|
|
260
|
+
try:
|
|
261
|
+
id = PlatformResourceUrn.from_string(id)
|
|
262
|
+
except InvalidUrnError:
|
|
263
|
+
raise InvalidUrnError(f'Expecting a PlatformResourceUrn but got {id}')
|
|
264
|
+
else:
|
|
265
|
+
id = UrnEncoder.encode_string(id)
|
|
215
266
|
|
|
216
267
|
# Validation logic.
|
|
217
268
|
if not id:
|
|
218
269
|
raise InvalidUrnError("PlatformResourceUrn id cannot be empty")
|
|
270
|
+
if isinstance(id, PlatformResourceUrn):
|
|
271
|
+
id = id.id
|
|
272
|
+
elif isinstance(id, Urn):
|
|
273
|
+
raise InvalidUrnError(f'Expecting a PlatformResourceUrn but got {id}')
|
|
219
274
|
if UrnEncoder.contains_reserved_char(id):
|
|
220
275
|
raise InvalidUrnError(f'PlatformResourceUrn id contains reserved characters')
|
|
221
276
|
|
|
@@ -256,15 +311,14 @@ class MlModelGroupUrn(_SpecificUrn):
|
|
|
256
311
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
257
312
|
if _allow_coercion:
|
|
258
313
|
# Field coercion logic (if any is required).
|
|
259
|
-
platform =
|
|
314
|
+
platform = DataPlatformUrn(platform).urn()
|
|
260
315
|
name = UrnEncoder.encode_string(name)
|
|
261
316
|
env = env.upper()
|
|
262
|
-
env = UrnEncoder.encode_string(env)
|
|
263
317
|
|
|
264
318
|
# Validation logic.
|
|
265
319
|
if not platform:
|
|
266
320
|
raise InvalidUrnError("MlModelGroupUrn platform cannot be empty")
|
|
267
|
-
platform = str(platform)
|
|
321
|
+
platform = str(platform) # convert urn type to str
|
|
268
322
|
assert DataPlatformUrn.from_string(platform)
|
|
269
323
|
if not name:
|
|
270
324
|
raise InvalidUrnError("MlModelGroupUrn name cannot be empty")
|
|
@@ -317,14 +371,25 @@ class DataHubPolicyUrn(_SpecificUrn):
|
|
|
317
371
|
ENTITY_TYPE: ClassVar[str] = "dataHubPolicy"
|
|
318
372
|
_URN_PARTS: ClassVar[int] = 1
|
|
319
373
|
|
|
320
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
374
|
+
def __init__(self, id: Union["DataHubPolicyUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
321
375
|
if _allow_coercion:
|
|
322
376
|
# Field coercion logic (if any is required).
|
|
323
|
-
|
|
377
|
+
if isinstance(id, str):
|
|
378
|
+
if id.startswith('urn:li:'):
|
|
379
|
+
try:
|
|
380
|
+
id = DataHubPolicyUrn.from_string(id)
|
|
381
|
+
except InvalidUrnError:
|
|
382
|
+
raise InvalidUrnError(f'Expecting a DataHubPolicyUrn but got {id}')
|
|
383
|
+
else:
|
|
384
|
+
id = UrnEncoder.encode_string(id)
|
|
324
385
|
|
|
325
386
|
# Validation logic.
|
|
326
387
|
if not id:
|
|
327
388
|
raise InvalidUrnError("DataHubPolicyUrn id cannot be empty")
|
|
389
|
+
if isinstance(id, DataHubPolicyUrn):
|
|
390
|
+
id = id.id
|
|
391
|
+
elif isinstance(id, Urn):
|
|
392
|
+
raise InvalidUrnError(f'Expecting a DataHubPolicyUrn but got {id}')
|
|
328
393
|
if UrnEncoder.contains_reserved_char(id):
|
|
329
394
|
raise InvalidUrnError(f'DataHubPolicyUrn id contains reserved characters')
|
|
330
395
|
|
|
@@ -362,14 +427,25 @@ class TagUrn(_SpecificUrn):
|
|
|
362
427
|
ENTITY_TYPE: ClassVar[str] = "tag"
|
|
363
428
|
_URN_PARTS: ClassVar[int] = 1
|
|
364
429
|
|
|
365
|
-
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
430
|
+
def __init__(self, name: Union["TagUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
366
431
|
if _allow_coercion:
|
|
367
432
|
# Field coercion logic (if any is required).
|
|
368
|
-
|
|
433
|
+
if isinstance(name, str):
|
|
434
|
+
if name.startswith('urn:li:'):
|
|
435
|
+
try:
|
|
436
|
+
name = TagUrn.from_string(name)
|
|
437
|
+
except InvalidUrnError:
|
|
438
|
+
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
439
|
+
else:
|
|
440
|
+
name = UrnEncoder.encode_string(name)
|
|
369
441
|
|
|
370
442
|
# Validation logic.
|
|
371
443
|
if not name:
|
|
372
444
|
raise InvalidUrnError("TagUrn name cannot be empty")
|
|
445
|
+
if isinstance(name, TagUrn):
|
|
446
|
+
name = name.name
|
|
447
|
+
elif isinstance(name, Urn):
|
|
448
|
+
raise InvalidUrnError(f'Expecting a TagUrn but got {name}')
|
|
373
449
|
if UrnEncoder.contains_reserved_char(name):
|
|
374
450
|
raise InvalidUrnError(f'TagUrn name contains reserved characters')
|
|
375
451
|
|
|
@@ -415,15 +491,14 @@ class MlModelDeploymentUrn(_SpecificUrn):
|
|
|
415
491
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
416
492
|
if _allow_coercion:
|
|
417
493
|
# Field coercion logic (if any is required).
|
|
418
|
-
platform =
|
|
494
|
+
platform = DataPlatformUrn(platform).urn()
|
|
419
495
|
name = UrnEncoder.encode_string(name)
|
|
420
496
|
env = env.upper()
|
|
421
|
-
env = UrnEncoder.encode_string(env)
|
|
422
497
|
|
|
423
498
|
# Validation logic.
|
|
424
499
|
if not platform:
|
|
425
500
|
raise InvalidUrnError("MlModelDeploymentUrn platform cannot be empty")
|
|
426
|
-
platform = str(platform)
|
|
501
|
+
platform = str(platform) # convert urn type to str
|
|
427
502
|
assert DataPlatformUrn.from_string(platform)
|
|
428
503
|
if not name:
|
|
429
504
|
raise InvalidUrnError("MlModelDeploymentUrn name cannot be empty")
|
|
@@ -476,14 +551,25 @@ class DataHubActionUrn(_SpecificUrn):
|
|
|
476
551
|
ENTITY_TYPE: ClassVar[str] = "dataHubAction"
|
|
477
552
|
_URN_PARTS: ClassVar[int] = 1
|
|
478
553
|
|
|
479
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
554
|
+
def __init__(self, id: Union["DataHubActionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
480
555
|
if _allow_coercion:
|
|
481
556
|
# Field coercion logic (if any is required).
|
|
482
|
-
|
|
557
|
+
if isinstance(id, str):
|
|
558
|
+
if id.startswith('urn:li:'):
|
|
559
|
+
try:
|
|
560
|
+
id = DataHubActionUrn.from_string(id)
|
|
561
|
+
except InvalidUrnError:
|
|
562
|
+
raise InvalidUrnError(f'Expecting a DataHubActionUrn but got {id}')
|
|
563
|
+
else:
|
|
564
|
+
id = UrnEncoder.encode_string(id)
|
|
483
565
|
|
|
484
566
|
# Validation logic.
|
|
485
567
|
if not id:
|
|
486
568
|
raise InvalidUrnError("DataHubActionUrn id cannot be empty")
|
|
569
|
+
if isinstance(id, DataHubActionUrn):
|
|
570
|
+
id = id.id
|
|
571
|
+
elif isinstance(id, Urn):
|
|
572
|
+
raise InvalidUrnError(f'Expecting a DataHubActionUrn but got {id}')
|
|
487
573
|
if UrnEncoder.contains_reserved_char(id):
|
|
488
574
|
raise InvalidUrnError(f'DataHubActionUrn id contains reserved characters')
|
|
489
575
|
|
|
@@ -521,14 +607,25 @@ class DataHubRoleUrn(_SpecificUrn):
|
|
|
521
607
|
ENTITY_TYPE: ClassVar[str] = "dataHubRole"
|
|
522
608
|
_URN_PARTS: ClassVar[int] = 1
|
|
523
609
|
|
|
524
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
610
|
+
def __init__(self, id: Union["DataHubRoleUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
525
611
|
if _allow_coercion:
|
|
526
612
|
# Field coercion logic (if any is required).
|
|
527
|
-
|
|
613
|
+
if isinstance(id, str):
|
|
614
|
+
if id.startswith('urn:li:'):
|
|
615
|
+
try:
|
|
616
|
+
id = DataHubRoleUrn.from_string(id)
|
|
617
|
+
except InvalidUrnError:
|
|
618
|
+
raise InvalidUrnError(f'Expecting a DataHubRoleUrn but got {id}')
|
|
619
|
+
else:
|
|
620
|
+
id = UrnEncoder.encode_string(id)
|
|
528
621
|
|
|
529
622
|
# Validation logic.
|
|
530
623
|
if not id:
|
|
531
624
|
raise InvalidUrnError("DataHubRoleUrn id cannot be empty")
|
|
625
|
+
if isinstance(id, DataHubRoleUrn):
|
|
626
|
+
id = id.id
|
|
627
|
+
elif isinstance(id, Urn):
|
|
628
|
+
raise InvalidUrnError(f'Expecting a DataHubRoleUrn but got {id}')
|
|
532
629
|
if UrnEncoder.contains_reserved_char(id):
|
|
533
630
|
raise InvalidUrnError(f'DataHubRoleUrn id contains reserved characters')
|
|
534
631
|
|
|
@@ -566,14 +663,25 @@ class DataHubUpgradeUrn(_SpecificUrn):
|
|
|
566
663
|
ENTITY_TYPE: ClassVar[str] = "dataHubUpgrade"
|
|
567
664
|
_URN_PARTS: ClassVar[int] = 1
|
|
568
665
|
|
|
569
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
666
|
+
def __init__(self, id: Union["DataHubUpgradeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
570
667
|
if _allow_coercion:
|
|
571
668
|
# Field coercion logic (if any is required).
|
|
572
|
-
|
|
669
|
+
if isinstance(id, str):
|
|
670
|
+
if id.startswith('urn:li:'):
|
|
671
|
+
try:
|
|
672
|
+
id = DataHubUpgradeUrn.from_string(id)
|
|
673
|
+
except InvalidUrnError:
|
|
674
|
+
raise InvalidUrnError(f'Expecting a DataHubUpgradeUrn but got {id}')
|
|
675
|
+
else:
|
|
676
|
+
id = UrnEncoder.encode_string(id)
|
|
573
677
|
|
|
574
678
|
# Validation logic.
|
|
575
679
|
if not id:
|
|
576
680
|
raise InvalidUrnError("DataHubUpgradeUrn id cannot be empty")
|
|
681
|
+
if isinstance(id, DataHubUpgradeUrn):
|
|
682
|
+
id = id.id
|
|
683
|
+
elif isinstance(id, Urn):
|
|
684
|
+
raise InvalidUrnError(f'Expecting a DataHubUpgradeUrn but got {id}')
|
|
577
685
|
if UrnEncoder.contains_reserved_char(id):
|
|
578
686
|
raise InvalidUrnError(f'DataHubUpgradeUrn id contains reserved characters')
|
|
579
687
|
|
|
@@ -611,14 +719,25 @@ class FormUrn(_SpecificUrn):
|
|
|
611
719
|
ENTITY_TYPE: ClassVar[str] = "form"
|
|
612
720
|
_URN_PARTS: ClassVar[int] = 1
|
|
613
721
|
|
|
614
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
722
|
+
def __init__(self, id: Union["FormUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
615
723
|
if _allow_coercion:
|
|
616
724
|
# Field coercion logic (if any is required).
|
|
617
|
-
|
|
725
|
+
if isinstance(id, str):
|
|
726
|
+
if id.startswith('urn:li:'):
|
|
727
|
+
try:
|
|
728
|
+
id = FormUrn.from_string(id)
|
|
729
|
+
except InvalidUrnError:
|
|
730
|
+
raise InvalidUrnError(f'Expecting a FormUrn but got {id}')
|
|
731
|
+
else:
|
|
732
|
+
id = UrnEncoder.encode_string(id)
|
|
618
733
|
|
|
619
734
|
# Validation logic.
|
|
620
735
|
if not id:
|
|
621
736
|
raise InvalidUrnError("FormUrn id cannot be empty")
|
|
737
|
+
if isinstance(id, FormUrn):
|
|
738
|
+
id = id.id
|
|
739
|
+
elif isinstance(id, Urn):
|
|
740
|
+
raise InvalidUrnError(f'Expecting a FormUrn but got {id}')
|
|
622
741
|
if UrnEncoder.contains_reserved_char(id):
|
|
623
742
|
raise InvalidUrnError(f'FormUrn id contains reserved characters')
|
|
624
743
|
|
|
@@ -718,14 +837,25 @@ class DataHubConnectionUrn(_SpecificUrn):
|
|
|
718
837
|
ENTITY_TYPE: ClassVar[str] = "dataHubConnection"
|
|
719
838
|
_URN_PARTS: ClassVar[int] = 1
|
|
720
839
|
|
|
721
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
840
|
+
def __init__(self, id: Union["DataHubConnectionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
722
841
|
if _allow_coercion:
|
|
723
842
|
# Field coercion logic (if any is required).
|
|
724
|
-
|
|
843
|
+
if isinstance(id, str):
|
|
844
|
+
if id.startswith('urn:li:'):
|
|
845
|
+
try:
|
|
846
|
+
id = DataHubConnectionUrn.from_string(id)
|
|
847
|
+
except InvalidUrnError:
|
|
848
|
+
raise InvalidUrnError(f'Expecting a DataHubConnectionUrn but got {id}')
|
|
849
|
+
else:
|
|
850
|
+
id = UrnEncoder.encode_string(id)
|
|
725
851
|
|
|
726
852
|
# Validation logic.
|
|
727
853
|
if not id:
|
|
728
854
|
raise InvalidUrnError("DataHubConnectionUrn id cannot be empty")
|
|
855
|
+
if isinstance(id, DataHubConnectionUrn):
|
|
856
|
+
id = id.id
|
|
857
|
+
elif isinstance(id, Urn):
|
|
858
|
+
raise InvalidUrnError(f'Expecting a DataHubConnectionUrn but got {id}')
|
|
729
859
|
if UrnEncoder.contains_reserved_char(id):
|
|
730
860
|
raise InvalidUrnError(f'DataHubConnectionUrn id contains reserved characters')
|
|
731
861
|
|
|
@@ -763,14 +893,25 @@ class IncidentUrn(_SpecificUrn):
|
|
|
763
893
|
ENTITY_TYPE: ClassVar[str] = "incident"
|
|
764
894
|
_URN_PARTS: ClassVar[int] = 1
|
|
765
895
|
|
|
766
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
896
|
+
def __init__(self, id: Union["IncidentUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
767
897
|
if _allow_coercion:
|
|
768
898
|
# Field coercion logic (if any is required).
|
|
769
|
-
|
|
899
|
+
if isinstance(id, str):
|
|
900
|
+
if id.startswith('urn:li:'):
|
|
901
|
+
try:
|
|
902
|
+
id = IncidentUrn.from_string(id)
|
|
903
|
+
except InvalidUrnError:
|
|
904
|
+
raise InvalidUrnError(f'Expecting a IncidentUrn but got {id}')
|
|
905
|
+
else:
|
|
906
|
+
id = UrnEncoder.encode_string(id)
|
|
770
907
|
|
|
771
908
|
# Validation logic.
|
|
772
909
|
if not id:
|
|
773
910
|
raise InvalidUrnError("IncidentUrn id cannot be empty")
|
|
911
|
+
if isinstance(id, IncidentUrn):
|
|
912
|
+
id = id.id
|
|
913
|
+
elif isinstance(id, Urn):
|
|
914
|
+
raise InvalidUrnError(f'Expecting a IncidentUrn but got {id}')
|
|
774
915
|
if UrnEncoder.contains_reserved_char(id):
|
|
775
916
|
raise InvalidUrnError(f'IncidentUrn id contains reserved characters')
|
|
776
917
|
|
|
@@ -808,14 +949,25 @@ class RoleUrn(_SpecificUrn):
|
|
|
808
949
|
ENTITY_TYPE: ClassVar[str] = "role"
|
|
809
950
|
_URN_PARTS: ClassVar[int] = 1
|
|
810
951
|
|
|
811
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
952
|
+
def __init__(self, id: Union["RoleUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
812
953
|
if _allow_coercion:
|
|
813
954
|
# Field coercion logic (if any is required).
|
|
814
|
-
|
|
955
|
+
if isinstance(id, str):
|
|
956
|
+
if id.startswith('urn:li:'):
|
|
957
|
+
try:
|
|
958
|
+
id = RoleUrn.from_string(id)
|
|
959
|
+
except InvalidUrnError:
|
|
960
|
+
raise InvalidUrnError(f'Expecting a RoleUrn but got {id}')
|
|
961
|
+
else:
|
|
962
|
+
id = UrnEncoder.encode_string(id)
|
|
815
963
|
|
|
816
964
|
# Validation logic.
|
|
817
965
|
if not id:
|
|
818
966
|
raise InvalidUrnError("RoleUrn id cannot be empty")
|
|
967
|
+
if isinstance(id, RoleUrn):
|
|
968
|
+
id = id.id
|
|
969
|
+
elif isinstance(id, Urn):
|
|
970
|
+
raise InvalidUrnError(f'Expecting a RoleUrn but got {id}')
|
|
819
971
|
if UrnEncoder.contains_reserved_char(id):
|
|
820
972
|
raise InvalidUrnError(f'RoleUrn id contains reserved characters')
|
|
821
973
|
|
|
@@ -853,14 +1005,25 @@ class DomainUrn(_SpecificUrn):
|
|
|
853
1005
|
ENTITY_TYPE: ClassVar[str] = "domain"
|
|
854
1006
|
_URN_PARTS: ClassVar[int] = 1
|
|
855
1007
|
|
|
856
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1008
|
+
def __init__(self, id: Union["DomainUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
857
1009
|
if _allow_coercion:
|
|
858
1010
|
# Field coercion logic (if any is required).
|
|
859
|
-
|
|
1011
|
+
if isinstance(id, str):
|
|
1012
|
+
if id.startswith('urn:li:'):
|
|
1013
|
+
try:
|
|
1014
|
+
id = DomainUrn.from_string(id)
|
|
1015
|
+
except InvalidUrnError:
|
|
1016
|
+
raise InvalidUrnError(f'Expecting a DomainUrn but got {id}')
|
|
1017
|
+
else:
|
|
1018
|
+
id = UrnEncoder.encode_string(id)
|
|
860
1019
|
|
|
861
1020
|
# Validation logic.
|
|
862
1021
|
if not id:
|
|
863
1022
|
raise InvalidUrnError("DomainUrn id cannot be empty")
|
|
1023
|
+
if isinstance(id, DomainUrn):
|
|
1024
|
+
id = id.id
|
|
1025
|
+
elif isinstance(id, Urn):
|
|
1026
|
+
raise InvalidUrnError(f'Expecting a DomainUrn but got {id}')
|
|
864
1027
|
if UrnEncoder.contains_reserved_char(id):
|
|
865
1028
|
raise InvalidUrnError(f'DomainUrn id contains reserved characters')
|
|
866
1029
|
|
|
@@ -903,14 +1066,25 @@ class DataContractUrn(_SpecificUrn):
|
|
|
903
1066
|
ENTITY_TYPE: ClassVar[str] = "dataContract"
|
|
904
1067
|
_URN_PARTS: ClassVar[int] = 1
|
|
905
1068
|
|
|
906
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1069
|
+
def __init__(self, id: Union["DataContractUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
907
1070
|
if _allow_coercion:
|
|
908
1071
|
# Field coercion logic (if any is required).
|
|
909
|
-
|
|
1072
|
+
if isinstance(id, str):
|
|
1073
|
+
if id.startswith('urn:li:'):
|
|
1074
|
+
try:
|
|
1075
|
+
id = DataContractUrn.from_string(id)
|
|
1076
|
+
except InvalidUrnError:
|
|
1077
|
+
raise InvalidUrnError(f'Expecting a DataContractUrn but got {id}')
|
|
1078
|
+
else:
|
|
1079
|
+
id = UrnEncoder.encode_string(id)
|
|
910
1080
|
|
|
911
1081
|
# Validation logic.
|
|
912
1082
|
if not id:
|
|
913
1083
|
raise InvalidUrnError("DataContractUrn id cannot be empty")
|
|
1084
|
+
if isinstance(id, DataContractUrn):
|
|
1085
|
+
id = id.id
|
|
1086
|
+
elif isinstance(id, Urn):
|
|
1087
|
+
raise InvalidUrnError(f'Expecting a DataContractUrn but got {id}')
|
|
914
1088
|
if UrnEncoder.contains_reserved_char(id):
|
|
915
1089
|
raise InvalidUrnError(f'DataContractUrn id contains reserved characters')
|
|
916
1090
|
|
|
@@ -948,14 +1122,25 @@ class AssertionUrn(_SpecificUrn):
|
|
|
948
1122
|
ENTITY_TYPE: ClassVar[str] = "assertion"
|
|
949
1123
|
_URN_PARTS: ClassVar[int] = 1
|
|
950
1124
|
|
|
951
|
-
def __init__(self, assertion_id: str, *, _allow_coercion: bool = True) -> None:
|
|
1125
|
+
def __init__(self, assertion_id: Union["AssertionUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
952
1126
|
if _allow_coercion:
|
|
953
1127
|
# Field coercion logic (if any is required).
|
|
954
|
-
|
|
1128
|
+
if isinstance(assertion_id, str):
|
|
1129
|
+
if assertion_id.startswith('urn:li:'):
|
|
1130
|
+
try:
|
|
1131
|
+
assertion_id = AssertionUrn.from_string(assertion_id)
|
|
1132
|
+
except InvalidUrnError:
|
|
1133
|
+
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
1134
|
+
else:
|
|
1135
|
+
assertion_id = UrnEncoder.encode_string(assertion_id)
|
|
955
1136
|
|
|
956
1137
|
# Validation logic.
|
|
957
1138
|
if not assertion_id:
|
|
958
1139
|
raise InvalidUrnError("AssertionUrn assertion_id cannot be empty")
|
|
1140
|
+
if isinstance(assertion_id, AssertionUrn):
|
|
1141
|
+
assertion_id = assertion_id.assertion_id
|
|
1142
|
+
elif isinstance(assertion_id, Urn):
|
|
1143
|
+
raise InvalidUrnError(f'Expecting a AssertionUrn but got {assertion_id}')
|
|
959
1144
|
if UrnEncoder.contains_reserved_char(assertion_id):
|
|
960
1145
|
raise InvalidUrnError(f'AssertionUrn assertion_id contains reserved characters')
|
|
961
1146
|
|
|
@@ -996,15 +1181,14 @@ class DatasetUrn(_SpecificUrn):
|
|
|
996
1181
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
997
1182
|
if _allow_coercion:
|
|
998
1183
|
# Field coercion logic (if any is required).
|
|
999
|
-
platform =
|
|
1184
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1000
1185
|
name = UrnEncoder.encode_string(name)
|
|
1001
1186
|
env = env.upper()
|
|
1002
|
-
env = UrnEncoder.encode_string(env)
|
|
1003
1187
|
|
|
1004
1188
|
# Validation logic.
|
|
1005
1189
|
if not platform:
|
|
1006
1190
|
raise InvalidUrnError("DatasetUrn platform cannot be empty")
|
|
1007
|
-
platform = str(platform)
|
|
1191
|
+
platform = str(platform) # convert urn type to str
|
|
1008
1192
|
assert DataPlatformUrn.from_string(platform)
|
|
1009
1193
|
if not name:
|
|
1010
1194
|
raise InvalidUrnError("DatasetUrn name cannot be empty")
|
|
@@ -1089,12 +1273,20 @@ class DataJobUrn(_SpecificUrn):
|
|
|
1089
1273
|
def __init__(self, flow: Union["DataFlowUrn", str], job_id: str, *, _allow_coercion: bool = True) -> None:
|
|
1090
1274
|
if _allow_coercion:
|
|
1091
1275
|
# Field coercion logic (if any is required).
|
|
1276
|
+
if isinstance(flow, str):
|
|
1277
|
+
if flow.startswith('urn:li:'):
|
|
1278
|
+
try:
|
|
1279
|
+
flow = DataFlowUrn.from_string(flow)
|
|
1280
|
+
except InvalidUrnError:
|
|
1281
|
+
raise InvalidUrnError(f'Expecting a DataFlowUrn but got {flow}')
|
|
1282
|
+
else:
|
|
1283
|
+
flow = UrnEncoder.encode_string(flow)
|
|
1092
1284
|
job_id = UrnEncoder.encode_string(job_id)
|
|
1093
1285
|
|
|
1094
1286
|
# Validation logic.
|
|
1095
1287
|
if not flow:
|
|
1096
1288
|
raise InvalidUrnError("DataJobUrn flow cannot be empty")
|
|
1097
|
-
flow = str(flow)
|
|
1289
|
+
flow = str(flow) # convert urn type to str
|
|
1098
1290
|
assert DataFlowUrn.from_string(flow)
|
|
1099
1291
|
if not job_id:
|
|
1100
1292
|
raise InvalidUrnError("DataJobUrn job_id cannot be empty")
|
|
@@ -1150,14 +1342,25 @@ class DataHubSecretUrn(_SpecificUrn):
|
|
|
1150
1342
|
ENTITY_TYPE: ClassVar[str] = "dataHubSecret"
|
|
1151
1343
|
_URN_PARTS: ClassVar[int] = 1
|
|
1152
1344
|
|
|
1153
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1345
|
+
def __init__(self, id: Union["DataHubSecretUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1154
1346
|
if _allow_coercion:
|
|
1155
1347
|
# Field coercion logic (if any is required).
|
|
1156
|
-
|
|
1348
|
+
if isinstance(id, str):
|
|
1349
|
+
if id.startswith('urn:li:'):
|
|
1350
|
+
try:
|
|
1351
|
+
id = DataHubSecretUrn.from_string(id)
|
|
1352
|
+
except InvalidUrnError:
|
|
1353
|
+
raise InvalidUrnError(f'Expecting a DataHubSecretUrn but got {id}')
|
|
1354
|
+
else:
|
|
1355
|
+
id = UrnEncoder.encode_string(id)
|
|
1157
1356
|
|
|
1158
1357
|
# Validation logic.
|
|
1159
1358
|
if not id:
|
|
1160
1359
|
raise InvalidUrnError("DataHubSecretUrn id cannot be empty")
|
|
1360
|
+
if isinstance(id, DataHubSecretUrn):
|
|
1361
|
+
id = id.id
|
|
1362
|
+
elif isinstance(id, Urn):
|
|
1363
|
+
raise InvalidUrnError(f'Expecting a DataHubSecretUrn but got {id}')
|
|
1161
1364
|
if UrnEncoder.contains_reserved_char(id):
|
|
1162
1365
|
raise InvalidUrnError(f'DataHubSecretUrn id contains reserved characters')
|
|
1163
1366
|
|
|
@@ -1195,14 +1398,25 @@ class OwnershipTypeUrn(_SpecificUrn):
|
|
|
1195
1398
|
ENTITY_TYPE: ClassVar[str] = "ownershipType"
|
|
1196
1399
|
_URN_PARTS: ClassVar[int] = 1
|
|
1197
1400
|
|
|
1198
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1401
|
+
def __init__(self, id: Union["OwnershipTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1199
1402
|
if _allow_coercion:
|
|
1200
1403
|
# Field coercion logic (if any is required).
|
|
1201
|
-
|
|
1404
|
+
if isinstance(id, str):
|
|
1405
|
+
if id.startswith('urn:li:'):
|
|
1406
|
+
try:
|
|
1407
|
+
id = OwnershipTypeUrn.from_string(id)
|
|
1408
|
+
except InvalidUrnError:
|
|
1409
|
+
raise InvalidUrnError(f'Expecting a OwnershipTypeUrn but got {id}')
|
|
1410
|
+
else:
|
|
1411
|
+
id = UrnEncoder.encode_string(id)
|
|
1202
1412
|
|
|
1203
1413
|
# Validation logic.
|
|
1204
1414
|
if not id:
|
|
1205
1415
|
raise InvalidUrnError("OwnershipTypeUrn id cannot be empty")
|
|
1416
|
+
if isinstance(id, OwnershipTypeUrn):
|
|
1417
|
+
id = id.id
|
|
1418
|
+
elif isinstance(id, Urn):
|
|
1419
|
+
raise InvalidUrnError(f'Expecting a OwnershipTypeUrn but got {id}')
|
|
1206
1420
|
if UrnEncoder.contains_reserved_char(id):
|
|
1207
1421
|
raise InvalidUrnError(f'OwnershipTypeUrn id contains reserved characters')
|
|
1208
1422
|
|
|
@@ -1243,12 +1457,20 @@ class SchemaFieldUrn(_SpecificUrn):
|
|
|
1243
1457
|
def __init__(self, parent: Union["Urn", str], field_path: str, *, _allow_coercion: bool = True) -> None:
|
|
1244
1458
|
if _allow_coercion:
|
|
1245
1459
|
# Field coercion logic (if any is required).
|
|
1460
|
+
if isinstance(parent, str):
|
|
1461
|
+
if parent.startswith('urn:li:'):
|
|
1462
|
+
try:
|
|
1463
|
+
parent = Urn.from_string(parent)
|
|
1464
|
+
except InvalidUrnError:
|
|
1465
|
+
raise InvalidUrnError(f'Expecting a Urn but got {parent}')
|
|
1466
|
+
else:
|
|
1467
|
+
parent = UrnEncoder.encode_string(parent)
|
|
1246
1468
|
field_path = UrnEncoder.encode_string(field_path)
|
|
1247
1469
|
|
|
1248
1470
|
# Validation logic.
|
|
1249
1471
|
if not parent:
|
|
1250
1472
|
raise InvalidUrnError("SchemaFieldUrn parent cannot be empty")
|
|
1251
|
-
parent = str(parent)
|
|
1473
|
+
parent = str(parent) # convert urn type to str
|
|
1252
1474
|
assert Urn.from_string(parent)
|
|
1253
1475
|
if not field_path:
|
|
1254
1476
|
raise InvalidUrnError("SchemaFieldUrn field_path cannot be empty")
|
|
@@ -1296,13 +1518,13 @@ class MlFeatureTableUrn(_SpecificUrn):
|
|
|
1296
1518
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, *, _allow_coercion: bool = True) -> None:
|
|
1297
1519
|
if _allow_coercion:
|
|
1298
1520
|
# Field coercion logic (if any is required).
|
|
1299
|
-
platform =
|
|
1521
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1300
1522
|
name = UrnEncoder.encode_string(name)
|
|
1301
1523
|
|
|
1302
1524
|
# Validation logic.
|
|
1303
1525
|
if not platform:
|
|
1304
1526
|
raise InvalidUrnError("MlFeatureTableUrn platform cannot be empty")
|
|
1305
|
-
platform = str(platform)
|
|
1527
|
+
platform = str(platform) # convert urn type to str
|
|
1306
1528
|
assert DataPlatformUrn.from_string(platform)
|
|
1307
1529
|
if not name:
|
|
1308
1530
|
raise InvalidUrnError("MlFeatureTableUrn name cannot be empty")
|
|
@@ -1401,14 +1623,25 @@ class TelemetryUrn(_SpecificUrn):
|
|
|
1401
1623
|
ENTITY_TYPE: ClassVar[str] = "telemetry"
|
|
1402
1624
|
_URN_PARTS: ClassVar[int] = 1
|
|
1403
1625
|
|
|
1404
|
-
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
1626
|
+
def __init__(self, name: Union["TelemetryUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1405
1627
|
if _allow_coercion:
|
|
1406
1628
|
# Field coercion logic (if any is required).
|
|
1407
|
-
|
|
1629
|
+
if isinstance(name, str):
|
|
1630
|
+
if name.startswith('urn:li:'):
|
|
1631
|
+
try:
|
|
1632
|
+
name = TelemetryUrn.from_string(name)
|
|
1633
|
+
except InvalidUrnError:
|
|
1634
|
+
raise InvalidUrnError(f'Expecting a TelemetryUrn but got {name}')
|
|
1635
|
+
else:
|
|
1636
|
+
name = UrnEncoder.encode_string(name)
|
|
1408
1637
|
|
|
1409
1638
|
# Validation logic.
|
|
1410
1639
|
if not name:
|
|
1411
1640
|
raise InvalidUrnError("TelemetryUrn name cannot be empty")
|
|
1641
|
+
if isinstance(name, TelemetryUrn):
|
|
1642
|
+
name = name.name
|
|
1643
|
+
elif isinstance(name, Urn):
|
|
1644
|
+
raise InvalidUrnError(f'Expecting a TelemetryUrn but got {name}')
|
|
1412
1645
|
if UrnEncoder.contains_reserved_char(name):
|
|
1413
1646
|
raise InvalidUrnError(f'TelemetryUrn name contains reserved characters')
|
|
1414
1647
|
|
|
@@ -1500,14 +1733,25 @@ class DataHubStepStateUrn(_SpecificUrn):
|
|
|
1500
1733
|
ENTITY_TYPE: ClassVar[str] = "dataHubStepState"
|
|
1501
1734
|
_URN_PARTS: ClassVar[int] = 1
|
|
1502
1735
|
|
|
1503
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1736
|
+
def __init__(self, id: Union["DataHubStepStateUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1504
1737
|
if _allow_coercion:
|
|
1505
1738
|
# Field coercion logic (if any is required).
|
|
1506
|
-
|
|
1739
|
+
if isinstance(id, str):
|
|
1740
|
+
if id.startswith('urn:li:'):
|
|
1741
|
+
try:
|
|
1742
|
+
id = DataHubStepStateUrn.from_string(id)
|
|
1743
|
+
except InvalidUrnError:
|
|
1744
|
+
raise InvalidUrnError(f'Expecting a DataHubStepStateUrn but got {id}')
|
|
1745
|
+
else:
|
|
1746
|
+
id = UrnEncoder.encode_string(id)
|
|
1507
1747
|
|
|
1508
1748
|
# Validation logic.
|
|
1509
1749
|
if not id:
|
|
1510
1750
|
raise InvalidUrnError("DataHubStepStateUrn id cannot be empty")
|
|
1751
|
+
if isinstance(id, DataHubStepStateUrn):
|
|
1752
|
+
id = id.id
|
|
1753
|
+
elif isinstance(id, Urn):
|
|
1754
|
+
raise InvalidUrnError(f'Expecting a DataHubStepStateUrn but got {id}')
|
|
1511
1755
|
if UrnEncoder.contains_reserved_char(id):
|
|
1512
1756
|
raise InvalidUrnError(f'DataHubStepStateUrn id contains reserved characters')
|
|
1513
1757
|
|
|
@@ -1545,14 +1789,25 @@ class DataHubViewUrn(_SpecificUrn):
|
|
|
1545
1789
|
ENTITY_TYPE: ClassVar[str] = "dataHubView"
|
|
1546
1790
|
_URN_PARTS: ClassVar[int] = 1
|
|
1547
1791
|
|
|
1548
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
1792
|
+
def __init__(self, id: Union["DataHubViewUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1549
1793
|
if _allow_coercion:
|
|
1550
1794
|
# Field coercion logic (if any is required).
|
|
1551
|
-
|
|
1795
|
+
if isinstance(id, str):
|
|
1796
|
+
if id.startswith('urn:li:'):
|
|
1797
|
+
try:
|
|
1798
|
+
id = DataHubViewUrn.from_string(id)
|
|
1799
|
+
except InvalidUrnError:
|
|
1800
|
+
raise InvalidUrnError(f'Expecting a DataHubViewUrn but got {id}')
|
|
1801
|
+
else:
|
|
1802
|
+
id = UrnEncoder.encode_string(id)
|
|
1552
1803
|
|
|
1553
1804
|
# Validation logic.
|
|
1554
1805
|
if not id:
|
|
1555
1806
|
raise InvalidUrnError("DataHubViewUrn id cannot be empty")
|
|
1807
|
+
if isinstance(id, DataHubViewUrn):
|
|
1808
|
+
id = id.id
|
|
1809
|
+
elif isinstance(id, Urn):
|
|
1810
|
+
raise InvalidUrnError(f'Expecting a DataHubViewUrn but got {id}')
|
|
1556
1811
|
if UrnEncoder.contains_reserved_char(id):
|
|
1557
1812
|
raise InvalidUrnError(f'DataHubViewUrn id contains reserved characters')
|
|
1558
1813
|
|
|
@@ -1787,14 +2042,25 @@ class CorpUserUrn(_SpecificUrn):
|
|
|
1787
2042
|
ENTITY_TYPE: ClassVar[str] = "corpuser"
|
|
1788
2043
|
_URN_PARTS: ClassVar[int] = 1
|
|
1789
2044
|
|
|
1790
|
-
def __init__(self, username: str, *, _allow_coercion: bool = True) -> None:
|
|
2045
|
+
def __init__(self, username: Union["CorpUserUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1791
2046
|
if _allow_coercion:
|
|
1792
2047
|
# Field coercion logic (if any is required).
|
|
1793
|
-
|
|
2048
|
+
if isinstance(username, str):
|
|
2049
|
+
if username.startswith('urn:li:'):
|
|
2050
|
+
try:
|
|
2051
|
+
username = CorpUserUrn.from_string(username)
|
|
2052
|
+
except InvalidUrnError:
|
|
2053
|
+
raise InvalidUrnError(f'Expecting a CorpUserUrn but got {username}')
|
|
2054
|
+
else:
|
|
2055
|
+
username = UrnEncoder.encode_string(username)
|
|
1794
2056
|
|
|
1795
2057
|
# Validation logic.
|
|
1796
2058
|
if not username:
|
|
1797
2059
|
raise InvalidUrnError("CorpUserUrn username cannot be empty")
|
|
2060
|
+
if isinstance(username, CorpUserUrn):
|
|
2061
|
+
username = username.username
|
|
2062
|
+
elif isinstance(username, Urn):
|
|
2063
|
+
raise InvalidUrnError(f'Expecting a CorpUserUrn but got {username}')
|
|
1798
2064
|
if UrnEncoder.contains_reserved_char(username):
|
|
1799
2065
|
raise InvalidUrnError(f'CorpUserUrn username contains reserved characters')
|
|
1800
2066
|
|
|
@@ -1837,14 +2103,25 @@ class InviteTokenUrn(_SpecificUrn):
|
|
|
1837
2103
|
ENTITY_TYPE: ClassVar[str] = "inviteToken"
|
|
1838
2104
|
_URN_PARTS: ClassVar[int] = 1
|
|
1839
2105
|
|
|
1840
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2106
|
+
def __init__(self, id: Union["InviteTokenUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1841
2107
|
if _allow_coercion:
|
|
1842
2108
|
# Field coercion logic (if any is required).
|
|
1843
|
-
|
|
2109
|
+
if isinstance(id, str):
|
|
2110
|
+
if id.startswith('urn:li:'):
|
|
2111
|
+
try:
|
|
2112
|
+
id = InviteTokenUrn.from_string(id)
|
|
2113
|
+
except InvalidUrnError:
|
|
2114
|
+
raise InvalidUrnError(f'Expecting a InviteTokenUrn but got {id}')
|
|
2115
|
+
else:
|
|
2116
|
+
id = UrnEncoder.encode_string(id)
|
|
1844
2117
|
|
|
1845
2118
|
# Validation logic.
|
|
1846
2119
|
if not id:
|
|
1847
2120
|
raise InvalidUrnError("InviteTokenUrn id cannot be empty")
|
|
2121
|
+
if isinstance(id, InviteTokenUrn):
|
|
2122
|
+
id = id.id
|
|
2123
|
+
elif isinstance(id, Urn):
|
|
2124
|
+
raise InvalidUrnError(f'Expecting a InviteTokenUrn but got {id}')
|
|
1848
2125
|
if UrnEncoder.contains_reserved_char(id):
|
|
1849
2126
|
raise InvalidUrnError(f'InviteTokenUrn id contains reserved characters')
|
|
1850
2127
|
|
|
@@ -1882,16 +2159,25 @@ class DataPlatformUrn(_SpecificUrn):
|
|
|
1882
2159
|
ENTITY_TYPE: ClassVar[str] = "dataPlatform"
|
|
1883
2160
|
_URN_PARTS: ClassVar[int] = 1
|
|
1884
2161
|
|
|
1885
|
-
def __init__(self, platform_name: str, *, _allow_coercion: bool = True) -> None:
|
|
2162
|
+
def __init__(self, platform_name: Union["DataPlatformUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1886
2163
|
if _allow_coercion:
|
|
1887
2164
|
# Field coercion logic (if any is required).
|
|
1888
|
-
if platform_name
|
|
1889
|
-
platform_name
|
|
1890
|
-
|
|
2165
|
+
if isinstance(platform_name, str):
|
|
2166
|
+
if platform_name.startswith('urn:li:'):
|
|
2167
|
+
try:
|
|
2168
|
+
platform_name = DataPlatformUrn.from_string(platform_name)
|
|
2169
|
+
except InvalidUrnError:
|
|
2170
|
+
raise InvalidUrnError(f'Expecting a DataPlatformUrn but got {platform_name}')
|
|
2171
|
+
else:
|
|
2172
|
+
platform_name = UrnEncoder.encode_string(platform_name)
|
|
1891
2173
|
|
|
1892
2174
|
# Validation logic.
|
|
1893
2175
|
if not platform_name:
|
|
1894
2176
|
raise InvalidUrnError("DataPlatformUrn platform_name cannot be empty")
|
|
2177
|
+
if isinstance(platform_name, DataPlatformUrn):
|
|
2178
|
+
platform_name = platform_name.platform_name
|
|
2179
|
+
elif isinstance(platform_name, Urn):
|
|
2180
|
+
raise InvalidUrnError(f'Expecting a DataPlatformUrn but got {platform_name}')
|
|
1895
2181
|
if UrnEncoder.contains_reserved_char(platform_name):
|
|
1896
2182
|
raise InvalidUrnError(f'DataPlatformUrn platform_name contains reserved characters')
|
|
1897
2183
|
|
|
@@ -1934,14 +2220,25 @@ class ContainerUrn(_SpecificUrn):
|
|
|
1934
2220
|
ENTITY_TYPE: ClassVar[str] = "container"
|
|
1935
2221
|
_URN_PARTS: ClassVar[int] = 1
|
|
1936
2222
|
|
|
1937
|
-
def __init__(self, guid: str, *, _allow_coercion: bool = True) -> None:
|
|
2223
|
+
def __init__(self, guid: Union["ContainerUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
1938
2224
|
if _allow_coercion:
|
|
1939
2225
|
# Field coercion logic (if any is required).
|
|
1940
|
-
|
|
2226
|
+
if isinstance(guid, str):
|
|
2227
|
+
if guid.startswith('urn:li:'):
|
|
2228
|
+
try:
|
|
2229
|
+
guid = ContainerUrn.from_string(guid)
|
|
2230
|
+
except InvalidUrnError:
|
|
2231
|
+
raise InvalidUrnError(f'Expecting a ContainerUrn but got {guid}')
|
|
2232
|
+
else:
|
|
2233
|
+
guid = UrnEncoder.encode_string(guid)
|
|
1941
2234
|
|
|
1942
2235
|
# Validation logic.
|
|
1943
2236
|
if not guid:
|
|
1944
2237
|
raise InvalidUrnError("ContainerUrn guid cannot be empty")
|
|
2238
|
+
if isinstance(guid, ContainerUrn):
|
|
2239
|
+
guid = guid.guid
|
|
2240
|
+
elif isinstance(guid, Urn):
|
|
2241
|
+
raise InvalidUrnError(f'Expecting a ContainerUrn but got {guid}')
|
|
1945
2242
|
if UrnEncoder.contains_reserved_char(guid):
|
|
1946
2243
|
raise InvalidUrnError(f'ContainerUrn guid contains reserved characters')
|
|
1947
2244
|
|
|
@@ -1982,13 +2279,13 @@ class DataPlatformInstanceUrn(_SpecificUrn):
|
|
|
1982
2279
|
def __init__(self, platform: Union["DataPlatformUrn", str], instance: str, *, _allow_coercion: bool = True) -> None:
|
|
1983
2280
|
if _allow_coercion:
|
|
1984
2281
|
# Field coercion logic (if any is required).
|
|
1985
|
-
platform =
|
|
2282
|
+
platform = DataPlatformUrn(platform).urn()
|
|
1986
2283
|
instance = UrnEncoder.encode_string(instance)
|
|
1987
2284
|
|
|
1988
2285
|
# Validation logic.
|
|
1989
2286
|
if not platform:
|
|
1990
2287
|
raise InvalidUrnError("DataPlatformInstanceUrn platform cannot be empty")
|
|
1991
|
-
platform = str(platform)
|
|
2288
|
+
platform = str(platform) # convert urn type to str
|
|
1992
2289
|
assert DataPlatformUrn.from_string(platform)
|
|
1993
2290
|
if not instance:
|
|
1994
2291
|
raise InvalidUrnError("DataPlatformInstanceUrn instance cannot be empty")
|
|
@@ -2033,14 +2330,25 @@ class GlossaryNodeUrn(_SpecificUrn):
|
|
|
2033
2330
|
ENTITY_TYPE: ClassVar[str] = "glossaryNode"
|
|
2034
2331
|
_URN_PARTS: ClassVar[int] = 1
|
|
2035
2332
|
|
|
2036
|
-
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
2333
|
+
def __init__(self, name: Union["GlossaryNodeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2037
2334
|
if _allow_coercion:
|
|
2038
2335
|
# Field coercion logic (if any is required).
|
|
2039
|
-
|
|
2336
|
+
if isinstance(name, str):
|
|
2337
|
+
if name.startswith('urn:li:'):
|
|
2338
|
+
try:
|
|
2339
|
+
name = GlossaryNodeUrn.from_string(name)
|
|
2340
|
+
except InvalidUrnError:
|
|
2341
|
+
raise InvalidUrnError(f'Expecting a GlossaryNodeUrn but got {name}')
|
|
2342
|
+
else:
|
|
2343
|
+
name = UrnEncoder.encode_string(name)
|
|
2040
2344
|
|
|
2041
2345
|
# Validation logic.
|
|
2042
2346
|
if not name:
|
|
2043
2347
|
raise InvalidUrnError("GlossaryNodeUrn name cannot be empty")
|
|
2348
|
+
if isinstance(name, GlossaryNodeUrn):
|
|
2349
|
+
name = name.name
|
|
2350
|
+
elif isinstance(name, Urn):
|
|
2351
|
+
raise InvalidUrnError(f'Expecting a GlossaryNodeUrn but got {name}')
|
|
2044
2352
|
if UrnEncoder.contains_reserved_char(name):
|
|
2045
2353
|
raise InvalidUrnError(f'GlossaryNodeUrn name contains reserved characters')
|
|
2046
2354
|
|
|
@@ -2081,15 +2389,14 @@ class MlModelUrn(_SpecificUrn):
|
|
|
2081
2389
|
def __init__(self, platform: Union["DataPlatformUrn", str], name: str, env: str = "PROD", *, _allow_coercion: bool = True) -> None:
|
|
2082
2390
|
if _allow_coercion:
|
|
2083
2391
|
# Field coercion logic (if any is required).
|
|
2084
|
-
platform =
|
|
2392
|
+
platform = DataPlatformUrn(platform).urn()
|
|
2085
2393
|
name = UrnEncoder.encode_string(name)
|
|
2086
2394
|
env = env.upper()
|
|
2087
|
-
env = UrnEncoder.encode_string(env)
|
|
2088
2395
|
|
|
2089
2396
|
# Validation logic.
|
|
2090
2397
|
if not platform:
|
|
2091
2398
|
raise InvalidUrnError("MlModelUrn platform cannot be empty")
|
|
2092
|
-
platform = str(platform)
|
|
2399
|
+
platform = str(platform) # convert urn type to str
|
|
2093
2400
|
assert DataPlatformUrn.from_string(platform)
|
|
2094
2401
|
if not name:
|
|
2095
2402
|
raise InvalidUrnError("MlModelUrn name cannot be empty")
|
|
@@ -2142,14 +2449,25 @@ class TestUrn(_SpecificUrn):
|
|
|
2142
2449
|
ENTITY_TYPE: ClassVar[str] = "test"
|
|
2143
2450
|
_URN_PARTS: ClassVar[int] = 1
|
|
2144
2451
|
|
|
2145
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2452
|
+
def __init__(self, id: Union["TestUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2146
2453
|
if _allow_coercion:
|
|
2147
2454
|
# Field coercion logic (if any is required).
|
|
2148
|
-
|
|
2455
|
+
if isinstance(id, str):
|
|
2456
|
+
if id.startswith('urn:li:'):
|
|
2457
|
+
try:
|
|
2458
|
+
id = TestUrn.from_string(id)
|
|
2459
|
+
except InvalidUrnError:
|
|
2460
|
+
raise InvalidUrnError(f'Expecting a TestUrn but got {id}')
|
|
2461
|
+
else:
|
|
2462
|
+
id = UrnEncoder.encode_string(id)
|
|
2149
2463
|
|
|
2150
2464
|
# Validation logic.
|
|
2151
2465
|
if not id:
|
|
2152
2466
|
raise InvalidUrnError("TestUrn id cannot be empty")
|
|
2467
|
+
if isinstance(id, TestUrn):
|
|
2468
|
+
id = id.id
|
|
2469
|
+
elif isinstance(id, Urn):
|
|
2470
|
+
raise InvalidUrnError(f'Expecting a TestUrn but got {id}')
|
|
2153
2471
|
if UrnEncoder.contains_reserved_char(id):
|
|
2154
2472
|
raise InvalidUrnError(f'TestUrn id contains reserved characters')
|
|
2155
2473
|
|
|
@@ -2187,14 +2505,25 @@ class PostUrn(_SpecificUrn):
|
|
|
2187
2505
|
ENTITY_TYPE: ClassVar[str] = "post"
|
|
2188
2506
|
_URN_PARTS: ClassVar[int] = 1
|
|
2189
2507
|
|
|
2190
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2508
|
+
def __init__(self, id: Union["PostUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2191
2509
|
if _allow_coercion:
|
|
2192
2510
|
# Field coercion logic (if any is required).
|
|
2193
|
-
|
|
2511
|
+
if isinstance(id, str):
|
|
2512
|
+
if id.startswith('urn:li:'):
|
|
2513
|
+
try:
|
|
2514
|
+
id = PostUrn.from_string(id)
|
|
2515
|
+
except InvalidUrnError:
|
|
2516
|
+
raise InvalidUrnError(f'Expecting a PostUrn but got {id}')
|
|
2517
|
+
else:
|
|
2518
|
+
id = UrnEncoder.encode_string(id)
|
|
2194
2519
|
|
|
2195
2520
|
# Validation logic.
|
|
2196
2521
|
if not id:
|
|
2197
2522
|
raise InvalidUrnError("PostUrn id cannot be empty")
|
|
2523
|
+
if isinstance(id, PostUrn):
|
|
2524
|
+
id = id.id
|
|
2525
|
+
elif isinstance(id, Urn):
|
|
2526
|
+
raise InvalidUrnError(f'Expecting a PostUrn but got {id}')
|
|
2198
2527
|
if UrnEncoder.contains_reserved_char(id):
|
|
2199
2528
|
raise InvalidUrnError(f'PostUrn id contains reserved characters')
|
|
2200
2529
|
|
|
@@ -2232,14 +2561,25 @@ class GlossaryTermUrn(_SpecificUrn):
|
|
|
2232
2561
|
ENTITY_TYPE: ClassVar[str] = "glossaryTerm"
|
|
2233
2562
|
_URN_PARTS: ClassVar[int] = 1
|
|
2234
2563
|
|
|
2235
|
-
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
2564
|
+
def __init__(self, name: Union["GlossaryTermUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2236
2565
|
if _allow_coercion:
|
|
2237
2566
|
# Field coercion logic (if any is required).
|
|
2238
|
-
|
|
2567
|
+
if isinstance(name, str):
|
|
2568
|
+
if name.startswith('urn:li:'):
|
|
2569
|
+
try:
|
|
2570
|
+
name = GlossaryTermUrn.from_string(name)
|
|
2571
|
+
except InvalidUrnError:
|
|
2572
|
+
raise InvalidUrnError(f'Expecting a GlossaryTermUrn but got {name}')
|
|
2573
|
+
else:
|
|
2574
|
+
name = UrnEncoder.encode_string(name)
|
|
2239
2575
|
|
|
2240
2576
|
# Validation logic.
|
|
2241
2577
|
if not name:
|
|
2242
2578
|
raise InvalidUrnError("GlossaryTermUrn name cannot be empty")
|
|
2579
|
+
if isinstance(name, GlossaryTermUrn):
|
|
2580
|
+
name = name.name
|
|
2581
|
+
elif isinstance(name, Urn):
|
|
2582
|
+
raise InvalidUrnError(f'Expecting a GlossaryTermUrn but got {name}')
|
|
2243
2583
|
if UrnEncoder.contains_reserved_char(name):
|
|
2244
2584
|
raise InvalidUrnError(f'GlossaryTermUrn name contains reserved characters')
|
|
2245
2585
|
|
|
@@ -2277,14 +2617,25 @@ class ErModelRelationshipUrn(_SpecificUrn):
|
|
|
2277
2617
|
ENTITY_TYPE: ClassVar[str] = "erModelRelationship"
|
|
2278
2618
|
_URN_PARTS: ClassVar[int] = 1
|
|
2279
2619
|
|
|
2280
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2620
|
+
def __init__(self, id: Union["ErModelRelationshipUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2281
2621
|
if _allow_coercion:
|
|
2282
2622
|
# Field coercion logic (if any is required).
|
|
2283
|
-
|
|
2623
|
+
if isinstance(id, str):
|
|
2624
|
+
if id.startswith('urn:li:'):
|
|
2625
|
+
try:
|
|
2626
|
+
id = ErModelRelationshipUrn.from_string(id)
|
|
2627
|
+
except InvalidUrnError:
|
|
2628
|
+
raise InvalidUrnError(f'Expecting a ErModelRelationshipUrn but got {id}')
|
|
2629
|
+
else:
|
|
2630
|
+
id = UrnEncoder.encode_string(id)
|
|
2284
2631
|
|
|
2285
2632
|
# Validation logic.
|
|
2286
2633
|
if not id:
|
|
2287
2634
|
raise InvalidUrnError("ErModelRelationshipUrn id cannot be empty")
|
|
2635
|
+
if isinstance(id, ErModelRelationshipUrn):
|
|
2636
|
+
id = id.id
|
|
2637
|
+
elif isinstance(id, Urn):
|
|
2638
|
+
raise InvalidUrnError(f'Expecting a ErModelRelationshipUrn but got {id}')
|
|
2288
2639
|
if UrnEncoder.contains_reserved_char(id):
|
|
2289
2640
|
raise InvalidUrnError(f'ErModelRelationshipUrn id contains reserved characters')
|
|
2290
2641
|
|
|
@@ -2322,14 +2673,25 @@ class DataHubExecutionRequestUrn(_SpecificUrn):
|
|
|
2322
2673
|
ENTITY_TYPE: ClassVar[str] = "dataHubExecutionRequest"
|
|
2323
2674
|
_URN_PARTS: ClassVar[int] = 1
|
|
2324
2675
|
|
|
2325
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2676
|
+
def __init__(self, id: Union["DataHubExecutionRequestUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2326
2677
|
if _allow_coercion:
|
|
2327
2678
|
# Field coercion logic (if any is required).
|
|
2328
|
-
|
|
2679
|
+
if isinstance(id, str):
|
|
2680
|
+
if id.startswith('urn:li:'):
|
|
2681
|
+
try:
|
|
2682
|
+
id = DataHubExecutionRequestUrn.from_string(id)
|
|
2683
|
+
except InvalidUrnError:
|
|
2684
|
+
raise InvalidUrnError(f'Expecting a DataHubExecutionRequestUrn but got {id}')
|
|
2685
|
+
else:
|
|
2686
|
+
id = UrnEncoder.encode_string(id)
|
|
2329
2687
|
|
|
2330
2688
|
# Validation logic.
|
|
2331
2689
|
if not id:
|
|
2332
2690
|
raise InvalidUrnError("DataHubExecutionRequestUrn id cannot be empty")
|
|
2691
|
+
if isinstance(id, DataHubExecutionRequestUrn):
|
|
2692
|
+
id = id.id
|
|
2693
|
+
elif isinstance(id, Urn):
|
|
2694
|
+
raise InvalidUrnError(f'Expecting a DataHubExecutionRequestUrn but got {id}')
|
|
2333
2695
|
if UrnEncoder.contains_reserved_char(id):
|
|
2334
2696
|
raise InvalidUrnError(f'DataHubExecutionRequestUrn id contains reserved characters')
|
|
2335
2697
|
|
|
@@ -2367,14 +2729,25 @@ class QueryUrn(_SpecificUrn):
|
|
|
2367
2729
|
ENTITY_TYPE: ClassVar[str] = "query"
|
|
2368
2730
|
_URN_PARTS: ClassVar[int] = 1
|
|
2369
2731
|
|
|
2370
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2732
|
+
def __init__(self, id: Union["QueryUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2371
2733
|
if _allow_coercion:
|
|
2372
2734
|
# Field coercion logic (if any is required).
|
|
2373
|
-
|
|
2735
|
+
if isinstance(id, str):
|
|
2736
|
+
if id.startswith('urn:li:'):
|
|
2737
|
+
try:
|
|
2738
|
+
id = QueryUrn.from_string(id)
|
|
2739
|
+
except InvalidUrnError:
|
|
2740
|
+
raise InvalidUrnError(f'Expecting a QueryUrn but got {id}')
|
|
2741
|
+
else:
|
|
2742
|
+
id = UrnEncoder.encode_string(id)
|
|
2374
2743
|
|
|
2375
2744
|
# Validation logic.
|
|
2376
2745
|
if not id:
|
|
2377
2746
|
raise InvalidUrnError("QueryUrn id cannot be empty")
|
|
2747
|
+
if isinstance(id, QueryUrn):
|
|
2748
|
+
id = id.id
|
|
2749
|
+
elif isinstance(id, Urn):
|
|
2750
|
+
raise InvalidUrnError(f'Expecting a QueryUrn but got {id}')
|
|
2378
2751
|
if UrnEncoder.contains_reserved_char(id):
|
|
2379
2752
|
raise InvalidUrnError(f'QueryUrn id contains reserved characters')
|
|
2380
2753
|
|
|
@@ -2412,14 +2785,25 @@ class DataHubPersonaUrn(_SpecificUrn):
|
|
|
2412
2785
|
ENTITY_TYPE: ClassVar[str] = "dataHubPersona"
|
|
2413
2786
|
_URN_PARTS: ClassVar[int] = 1
|
|
2414
2787
|
|
|
2415
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2788
|
+
def __init__(self, id: Union["DataHubPersonaUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2416
2789
|
if _allow_coercion:
|
|
2417
2790
|
# Field coercion logic (if any is required).
|
|
2418
|
-
|
|
2791
|
+
if isinstance(id, str):
|
|
2792
|
+
if id.startswith('urn:li:'):
|
|
2793
|
+
try:
|
|
2794
|
+
id = DataHubPersonaUrn.from_string(id)
|
|
2795
|
+
except InvalidUrnError:
|
|
2796
|
+
raise InvalidUrnError(f'Expecting a DataHubPersonaUrn but got {id}')
|
|
2797
|
+
else:
|
|
2798
|
+
id = UrnEncoder.encode_string(id)
|
|
2419
2799
|
|
|
2420
2800
|
# Validation logic.
|
|
2421
2801
|
if not id:
|
|
2422
2802
|
raise InvalidUrnError("DataHubPersonaUrn id cannot be empty")
|
|
2803
|
+
if isinstance(id, DataHubPersonaUrn):
|
|
2804
|
+
id = id.id
|
|
2805
|
+
elif isinstance(id, Urn):
|
|
2806
|
+
raise InvalidUrnError(f'Expecting a DataHubPersonaUrn but got {id}')
|
|
2423
2807
|
if UrnEncoder.contains_reserved_char(id):
|
|
2424
2808
|
raise InvalidUrnError(f'DataHubPersonaUrn id contains reserved characters')
|
|
2425
2809
|
|
|
@@ -2565,14 +2949,25 @@ class DataHubAccessTokenUrn(_SpecificUrn):
|
|
|
2565
2949
|
ENTITY_TYPE: ClassVar[str] = "dataHubAccessToken"
|
|
2566
2950
|
_URN_PARTS: ClassVar[int] = 1
|
|
2567
2951
|
|
|
2568
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
2952
|
+
def __init__(self, id: Union["DataHubAccessTokenUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2569
2953
|
if _allow_coercion:
|
|
2570
2954
|
# Field coercion logic (if any is required).
|
|
2571
|
-
|
|
2955
|
+
if isinstance(id, str):
|
|
2956
|
+
if id.startswith('urn:li:'):
|
|
2957
|
+
try:
|
|
2958
|
+
id = DataHubAccessTokenUrn.from_string(id)
|
|
2959
|
+
except InvalidUrnError:
|
|
2960
|
+
raise InvalidUrnError(f'Expecting a DataHubAccessTokenUrn but got {id}')
|
|
2961
|
+
else:
|
|
2962
|
+
id = UrnEncoder.encode_string(id)
|
|
2572
2963
|
|
|
2573
2964
|
# Validation logic.
|
|
2574
2965
|
if not id:
|
|
2575
2966
|
raise InvalidUrnError("DataHubAccessTokenUrn id cannot be empty")
|
|
2967
|
+
if isinstance(id, DataHubAccessTokenUrn):
|
|
2968
|
+
id = id.id
|
|
2969
|
+
elif isinstance(id, Urn):
|
|
2970
|
+
raise InvalidUrnError(f'Expecting a DataHubAccessTokenUrn but got {id}')
|
|
2576
2971
|
if UrnEncoder.contains_reserved_char(id):
|
|
2577
2972
|
raise InvalidUrnError(f'DataHubAccessTokenUrn id contains reserved characters')
|
|
2578
2973
|
|
|
@@ -2610,14 +3005,25 @@ class DataProcessInstanceUrn(_SpecificUrn):
|
|
|
2610
3005
|
ENTITY_TYPE: ClassVar[str] = "dataProcessInstance"
|
|
2611
3006
|
_URN_PARTS: ClassVar[int] = 1
|
|
2612
3007
|
|
|
2613
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
3008
|
+
def __init__(self, id: Union["DataProcessInstanceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2614
3009
|
if _allow_coercion:
|
|
2615
3010
|
# Field coercion logic (if any is required).
|
|
2616
|
-
|
|
3011
|
+
if isinstance(id, str):
|
|
3012
|
+
if id.startswith('urn:li:'):
|
|
3013
|
+
try:
|
|
3014
|
+
id = DataProcessInstanceUrn.from_string(id)
|
|
3015
|
+
except InvalidUrnError:
|
|
3016
|
+
raise InvalidUrnError(f'Expecting a DataProcessInstanceUrn but got {id}')
|
|
3017
|
+
else:
|
|
3018
|
+
id = UrnEncoder.encode_string(id)
|
|
2617
3019
|
|
|
2618
3020
|
# Validation logic.
|
|
2619
3021
|
if not id:
|
|
2620
3022
|
raise InvalidUrnError("DataProcessInstanceUrn id cannot be empty")
|
|
3023
|
+
if isinstance(id, DataProcessInstanceUrn):
|
|
3024
|
+
id = id.id
|
|
3025
|
+
elif isinstance(id, Urn):
|
|
3026
|
+
raise InvalidUrnError(f'Expecting a DataProcessInstanceUrn but got {id}')
|
|
2621
3027
|
if UrnEncoder.contains_reserved_char(id):
|
|
2622
3028
|
raise InvalidUrnError(f'DataProcessInstanceUrn id contains reserved characters')
|
|
2623
3029
|
|
|
@@ -2664,14 +3070,25 @@ class CorpGroupUrn(_SpecificUrn):
|
|
|
2664
3070
|
ENTITY_TYPE: ClassVar[str] = "corpGroup"
|
|
2665
3071
|
_URN_PARTS: ClassVar[int] = 1
|
|
2666
3072
|
|
|
2667
|
-
def __init__(self, name: str, *, _allow_coercion: bool = True) -> None:
|
|
3073
|
+
def __init__(self, name: Union["CorpGroupUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2668
3074
|
if _allow_coercion:
|
|
2669
3075
|
# Field coercion logic (if any is required).
|
|
2670
|
-
|
|
3076
|
+
if isinstance(name, str):
|
|
3077
|
+
if name.startswith('urn:li:'):
|
|
3078
|
+
try:
|
|
3079
|
+
name = CorpGroupUrn.from_string(name)
|
|
3080
|
+
except InvalidUrnError:
|
|
3081
|
+
raise InvalidUrnError(f'Expecting a CorpGroupUrn but got {name}')
|
|
3082
|
+
else:
|
|
3083
|
+
name = UrnEncoder.encode_string(name)
|
|
2671
3084
|
|
|
2672
3085
|
# Validation logic.
|
|
2673
3086
|
if not name:
|
|
2674
3087
|
raise InvalidUrnError("CorpGroupUrn name cannot be empty")
|
|
3088
|
+
if isinstance(name, CorpGroupUrn):
|
|
3089
|
+
name = name.name
|
|
3090
|
+
elif isinstance(name, Urn):
|
|
3091
|
+
raise InvalidUrnError(f'Expecting a CorpGroupUrn but got {name}')
|
|
2675
3092
|
if UrnEncoder.contains_reserved_char(name):
|
|
2676
3093
|
raise InvalidUrnError(f'CorpGroupUrn name contains reserved characters')
|
|
2677
3094
|
|
|
@@ -2720,7 +3137,6 @@ class DataProcessUrn(_SpecificUrn):
|
|
|
2720
3137
|
name = UrnEncoder.encode_string(name)
|
|
2721
3138
|
orchestrator = UrnEncoder.encode_string(orchestrator)
|
|
2722
3139
|
env = env.upper()
|
|
2723
|
-
env = UrnEncoder.encode_string(env)
|
|
2724
3140
|
|
|
2725
3141
|
# Validation logic.
|
|
2726
3142
|
if not name:
|
|
@@ -2778,14 +3194,25 @@ class DataHubIngestionSourceUrn(_SpecificUrn):
|
|
|
2778
3194
|
ENTITY_TYPE: ClassVar[str] = "dataHubIngestionSource"
|
|
2779
3195
|
_URN_PARTS: ClassVar[int] = 1
|
|
2780
3196
|
|
|
2781
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
3197
|
+
def __init__(self, id: Union["DataHubIngestionSourceUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2782
3198
|
if _allow_coercion:
|
|
2783
3199
|
# Field coercion logic (if any is required).
|
|
2784
|
-
|
|
3200
|
+
if isinstance(id, str):
|
|
3201
|
+
if id.startswith('urn:li:'):
|
|
3202
|
+
try:
|
|
3203
|
+
id = DataHubIngestionSourceUrn.from_string(id)
|
|
3204
|
+
except InvalidUrnError:
|
|
3205
|
+
raise InvalidUrnError(f'Expecting a DataHubIngestionSourceUrn but got {id}')
|
|
3206
|
+
else:
|
|
3207
|
+
id = UrnEncoder.encode_string(id)
|
|
2785
3208
|
|
|
2786
3209
|
# Validation logic.
|
|
2787
3210
|
if not id:
|
|
2788
3211
|
raise InvalidUrnError("DataHubIngestionSourceUrn id cannot be empty")
|
|
3212
|
+
if isinstance(id, DataHubIngestionSourceUrn):
|
|
3213
|
+
id = id.id
|
|
3214
|
+
elif isinstance(id, Urn):
|
|
3215
|
+
raise InvalidUrnError(f'Expecting a DataHubIngestionSourceUrn but got {id}')
|
|
2789
3216
|
if UrnEncoder.contains_reserved_char(id):
|
|
2790
3217
|
raise InvalidUrnError(f'DataHubIngestionSourceUrn id contains reserved characters')
|
|
2791
3218
|
|
|
@@ -2823,14 +3250,25 @@ class GlobalSettingsUrn(_SpecificUrn):
|
|
|
2823
3250
|
ENTITY_TYPE: ClassVar[str] = "globalSettings"
|
|
2824
3251
|
_URN_PARTS: ClassVar[int] = 1
|
|
2825
3252
|
|
|
2826
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
3253
|
+
def __init__(self, id: Union["GlobalSettingsUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2827
3254
|
if _allow_coercion:
|
|
2828
3255
|
# Field coercion logic (if any is required).
|
|
2829
|
-
|
|
3256
|
+
if isinstance(id, str):
|
|
3257
|
+
if id.startswith('urn:li:'):
|
|
3258
|
+
try:
|
|
3259
|
+
id = GlobalSettingsUrn.from_string(id)
|
|
3260
|
+
except InvalidUrnError:
|
|
3261
|
+
raise InvalidUrnError(f'Expecting a GlobalSettingsUrn but got {id}')
|
|
3262
|
+
else:
|
|
3263
|
+
id = UrnEncoder.encode_string(id)
|
|
2830
3264
|
|
|
2831
3265
|
# Validation logic.
|
|
2832
3266
|
if not id:
|
|
2833
3267
|
raise InvalidUrnError("GlobalSettingsUrn id cannot be empty")
|
|
3268
|
+
if isinstance(id, GlobalSettingsUrn):
|
|
3269
|
+
id = id.id
|
|
3270
|
+
elif isinstance(id, Urn):
|
|
3271
|
+
raise InvalidUrnError(f'Expecting a GlobalSettingsUrn but got {id}')
|
|
2834
3272
|
if UrnEncoder.contains_reserved_char(id):
|
|
2835
3273
|
raise InvalidUrnError(f'GlobalSettingsUrn id contains reserved characters')
|
|
2836
3274
|
|
|
@@ -2868,14 +3306,25 @@ class EntityTypeUrn(_SpecificUrn):
|
|
|
2868
3306
|
ENTITY_TYPE: ClassVar[str] = "entityType"
|
|
2869
3307
|
_URN_PARTS: ClassVar[int] = 1
|
|
2870
3308
|
|
|
2871
|
-
def __init__(self, id: str, *, _allow_coercion: bool = True) -> None:
|
|
3309
|
+
def __init__(self, id: Union["EntityTypeUrn", str], *, _allow_coercion: bool = True) -> None:
|
|
2872
3310
|
if _allow_coercion:
|
|
2873
3311
|
# Field coercion logic (if any is required).
|
|
2874
|
-
|
|
3312
|
+
if isinstance(id, str):
|
|
3313
|
+
if id.startswith('urn:li:'):
|
|
3314
|
+
try:
|
|
3315
|
+
id = EntityTypeUrn.from_string(id)
|
|
3316
|
+
except InvalidUrnError:
|
|
3317
|
+
raise InvalidUrnError(f'Expecting a EntityTypeUrn but got {id}')
|
|
3318
|
+
else:
|
|
3319
|
+
id = UrnEncoder.encode_string(id)
|
|
2875
3320
|
|
|
2876
3321
|
# Validation logic.
|
|
2877
3322
|
if not id:
|
|
2878
3323
|
raise InvalidUrnError("EntityTypeUrn id cannot be empty")
|
|
3324
|
+
if isinstance(id, EntityTypeUrn):
|
|
3325
|
+
id = id.id
|
|
3326
|
+
elif isinstance(id, Urn):
|
|
3327
|
+
raise InvalidUrnError(f'Expecting a EntityTypeUrn but got {id}')
|
|
2879
3328
|
if UrnEncoder.contains_reserved_char(id):
|
|
2880
3329
|
raise InvalidUrnError(f'EntityTypeUrn id contains reserved characters')
|
|
2881
3330
|
|