acryl-datahub 0.15.0.6rc2__py3-none-any.whl → 1.0.0rc1__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.

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