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