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