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