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