acryl-datahub 15.0.4__py3-none-any.whl → 15.0.5rc1__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.

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