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