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