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