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