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