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