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