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