acryl-datahub-cloud 0.3.11rc0__py3-none-any.whl → 0.3.16.1rc0__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-cloud might be problematic. Click here for more details.
- acryl_datahub_cloud/_codegen_config.json +1 -1
- acryl_datahub_cloud/acryl_cs_issues/models.py +5 -3
- acryl_datahub_cloud/action_request/action_request_owner_source.py +36 -6
- acryl_datahub_cloud/datahub_forms_notifications/__init__.py +0 -0
- acryl_datahub_cloud/datahub_forms_notifications/forms_notifications_source.py +569 -0
- acryl_datahub_cloud/datahub_forms_notifications/get_feature_flag.gql +7 -0
- acryl_datahub_cloud/datahub_forms_notifications/get_search_results_total.gql +14 -0
- acryl_datahub_cloud/datahub_forms_notifications/query.py +17 -0
- acryl_datahub_cloud/datahub_forms_notifications/scroll_forms_for_notification.gql +29 -0
- acryl_datahub_cloud/datahub_forms_notifications/send_form_notification_request.gql +5 -0
- acryl_datahub_cloud/datahub_reporting/datahub_dataset.py +37 -13
- acryl_datahub_cloud/datahub_reporting/datahub_form_reporting.py +55 -24
- acryl_datahub_cloud/datahub_reporting/extract_graph.py +4 -3
- acryl_datahub_cloud/datahub_reporting/extract_sql.py +242 -51
- acryl_datahub_cloud/datahub_reporting/forms.py +1 -1
- acryl_datahub_cloud/datahub_reporting/forms_config.py +3 -2
- acryl_datahub_cloud/datahub_restore/source.py +3 -2
- acryl_datahub_cloud/datahub_usage_reporting/excluded.py +94 -0
- acryl_datahub_cloud/datahub_usage_reporting/query_builder.py +48 -8
- acryl_datahub_cloud/datahub_usage_reporting/usage_feature_reporter.py +518 -77
- acryl_datahub_cloud/elasticsearch/graph_service.py +76 -14
- acryl_datahub_cloud/graphql_utils.py +64 -0
- acryl_datahub_cloud/lineage_features/source.py +555 -49
- acryl_datahub_cloud/metadata/_urns/urn_defs.py +2296 -1900
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/actionworkflow/__init__.py +53 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/anomaly/__init__.py +2 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/application/__init__.py +19 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/assertion/__init__.py +4 -2
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/common/__init__.py +6 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/conversation/__init__.py +29 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/event/notification/settings/__init__.py +2 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/execution/__init__.py +2 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/file/__init__.py +19 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/form/__init__.py +8 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/identity/__init__.py +8 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/knowledge/__init__.py +33 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/logical/__init__.py +15 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/key/__init__.py +12 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/search/features/__init__.py +2 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/module/__init__.py +31 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/notification/__init__.py +19 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/platform/event/v1/__init__.py +4 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/role/__init__.py +2 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/asset/__init__.py +19 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/global/__init__.py +28 -0
- acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/template/__init__.py +31 -0
- acryl_datahub_cloud/metadata/schema.avsc +25091 -20557
- acryl_datahub_cloud/metadata/schema_classes.py +29269 -23863
- acryl_datahub_cloud/metadata/schemas/ActionRequestInfo.avsc +235 -2
- acryl_datahub_cloud/metadata/schemas/ActionWorkflowInfo.avsc +683 -0
- acryl_datahub_cloud/metadata/schemas/ActionWorkflowKey.avsc +21 -0
- acryl_datahub_cloud/metadata/schemas/Actors.avsc +38 -1
- acryl_datahub_cloud/metadata/schemas/ApplicationKey.avsc +31 -0
- acryl_datahub_cloud/metadata/schemas/ApplicationProperties.avsc +75 -0
- acryl_datahub_cloud/metadata/schemas/Applications.avsc +38 -0
- acryl_datahub_cloud/metadata/schemas/AssertionAnalyticsRunEvent.avsc +353 -215
- acryl_datahub_cloud/metadata/schemas/AssertionInfo.avsc +147 -20
- acryl_datahub_cloud/metadata/schemas/AssertionKey.avsc +1 -1
- acryl_datahub_cloud/metadata/schemas/AssertionRunEvent.avsc +166 -21
- acryl_datahub_cloud/metadata/schemas/{AssertionSummary.avsc → AssertionRunSummary.avsc} +15 -2
- acryl_datahub_cloud/metadata/schemas/AssertionsSummary.avsc +54 -0
- acryl_datahub_cloud/metadata/schemas/AssetSettings.avsc +63 -0
- acryl_datahub_cloud/metadata/schemas/BusinessAttributeInfo.avsc +7 -3
- acryl_datahub_cloud/metadata/schemas/ChartInfo.avsc +20 -6
- acryl_datahub_cloud/metadata/schemas/ChartKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/ConstraintInfo.avsc +12 -1
- acryl_datahub_cloud/metadata/schemas/ContainerKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/ContainerProperties.avsc +16 -5
- acryl_datahub_cloud/metadata/schemas/CorpGroupEditableInfo.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/CorpGroupInfo.avsc +7 -3
- acryl_datahub_cloud/metadata/schemas/CorpGroupKey.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/CorpGroupSettings.avsc +127 -2
- acryl_datahub_cloud/metadata/schemas/CorpUserEditableInfo.avsc +1 -1
- acryl_datahub_cloud/metadata/schemas/CorpUserInfo.avsc +18 -2
- acryl_datahub_cloud/metadata/schemas/CorpUserInvitationStatus.avsc +106 -0
- acryl_datahub_cloud/metadata/schemas/CorpUserKey.avsc +4 -1
- acryl_datahub_cloud/metadata/schemas/CorpUserSettings.avsc +304 -2
- acryl_datahub_cloud/metadata/schemas/CorpUserUsageFeatures.avsc +86 -0
- acryl_datahub_cloud/metadata/schemas/DashboardInfo.avsc +11 -5
- acryl_datahub_cloud/metadata/schemas/DashboardKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/DataFlowInfo.avsc +15 -5
- acryl_datahub_cloud/metadata/schemas/DataFlowKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/DataHubAiConversationInfo.avsc +256 -0
- acryl_datahub_cloud/metadata/schemas/DataHubAiConversationKey.avsc +22 -0
- acryl_datahub_cloud/metadata/schemas/DataHubFileInfo.avsc +234 -0
- acryl_datahub_cloud/metadata/schemas/DataHubFileKey.avsc +22 -0
- acryl_datahub_cloud/metadata/schemas/DataHubIngestionSourceKey.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/DataHubPageModuleKey.avsc +21 -0
- acryl_datahub_cloud/metadata/schemas/DataHubPageModuleProperties.avsc +308 -0
- acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateKey.avsc +21 -0
- acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateProperties.avsc +251 -0
- acryl_datahub_cloud/metadata/schemas/DataHubPolicyInfo.avsc +12 -1
- acryl_datahub_cloud/metadata/schemas/DataJobInfo.avsc +13 -4
- acryl_datahub_cloud/metadata/schemas/DataJobInputOutput.avsc +8 -0
- acryl_datahub_cloud/metadata/schemas/DataJobKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/DataPlatformInfo.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/DataPlatformInstanceProperties.avsc +5 -2
- acryl_datahub_cloud/metadata/schemas/DataProcessKey.avsc +4 -0
- acryl_datahub_cloud/metadata/schemas/DataProductKey.avsc +2 -0
- acryl_datahub_cloud/metadata/schemas/DataProductProperties.avsc +6 -3
- acryl_datahub_cloud/metadata/schemas/DataTypeInfo.avsc +5 -0
- acryl_datahub_cloud/metadata/schemas/DatasetKey.avsc +10 -2
- acryl_datahub_cloud/metadata/schemas/DatasetProperties.avsc +12 -5
- acryl_datahub_cloud/metadata/schemas/DatasetUsageStatistics.avsc +8 -0
- acryl_datahub_cloud/metadata/schemas/DocumentInfo.avsc +407 -0
- acryl_datahub_cloud/metadata/schemas/DocumentKey.avsc +35 -0
- acryl_datahub_cloud/metadata/schemas/DocumentSettings.avsc +79 -0
- acryl_datahub_cloud/metadata/schemas/DomainKey.avsc +2 -0
- acryl_datahub_cloud/metadata/schemas/DomainProperties.avsc +7 -3
- acryl_datahub_cloud/metadata/schemas/EditableContainerProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableDashboardProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableDataFlowProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableDataJobProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableDatasetProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableERModelRelationshipProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableMLFeatureProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableMLFeatureTableProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableMLModelGroupProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableMLModelProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableNotebookProperties.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/EditableSchemaMetadata.avsc +4 -2
- acryl_datahub_cloud/metadata/schemas/EntityTypeInfo.avsc +5 -0
- acryl_datahub_cloud/metadata/schemas/ExecutionRequestArtifactsLocation.avsc +16 -0
- acryl_datahub_cloud/metadata/schemas/ExecutionRequestKey.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/FormAssignmentStatus.avsc +36 -0
- acryl_datahub_cloud/metadata/schemas/FormInfo.avsc +6 -0
- acryl_datahub_cloud/metadata/schemas/FormKey.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/FormNotifications.avsc +69 -0
- acryl_datahub_cloud/metadata/schemas/FormSettings.avsc +30 -0
- acryl_datahub_cloud/metadata/schemas/GlobalSettingsInfo.avsc +416 -0
- acryl_datahub_cloud/metadata/schemas/GlobalTags.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/GlossaryNodeInfo.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/GlossaryNodeKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/GlossaryTermInfo.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/GlossaryTermKey.avsc +2 -0
- acryl_datahub_cloud/metadata/schemas/IcebergWarehouseInfo.avsc +4 -0
- acryl_datahub_cloud/metadata/schemas/IncidentActivityEvent.avsc +3 -3
- acryl_datahub_cloud/metadata/schemas/IncidentInfo.avsc +3 -3
- acryl_datahub_cloud/metadata/schemas/InferredMetadata.avsc +71 -1
- acryl_datahub_cloud/metadata/schemas/InputFields.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/InviteToken.avsc +26 -0
- acryl_datahub_cloud/metadata/schemas/LineageFeatures.avsc +67 -42
- acryl_datahub_cloud/metadata/schemas/LogicalParent.avsc +145 -0
- acryl_datahub_cloud/metadata/schemas/MLFeatureKey.avsc +4 -1
- acryl_datahub_cloud/metadata/schemas/MLFeatureTableKey.avsc +4 -1
- acryl_datahub_cloud/metadata/schemas/MLModelDeploymentKey.avsc +7 -1
- acryl_datahub_cloud/metadata/schemas/MLModelGroupKey.avsc +9 -1
- acryl_datahub_cloud/metadata/schemas/MLModelKey.avsc +9 -1
- acryl_datahub_cloud/metadata/schemas/MLModelProperties.avsc +4 -2
- acryl_datahub_cloud/metadata/schemas/MLPrimaryKeyKey.avsc +4 -1
- acryl_datahub_cloud/metadata/schemas/MetadataChangeEvent.avsc +418 -97
- acryl_datahub_cloud/metadata/schemas/MetadataChangeLog.avsc +62 -44
- acryl_datahub_cloud/metadata/schemas/MetadataChangeProposal.avsc +61 -0
- acryl_datahub_cloud/metadata/schemas/MonitorAnomalyEvent.avsc +54 -9
- acryl_datahub_cloud/metadata/schemas/MonitorInfo.avsc +163 -23
- acryl_datahub_cloud/metadata/schemas/MonitorKey.avsc +9 -1
- acryl_datahub_cloud/metadata/schemas/MonitorSuiteInfo.avsc +128 -3
- acryl_datahub_cloud/metadata/schemas/NotebookInfo.avsc +5 -2
- acryl_datahub_cloud/metadata/schemas/NotebookKey.avsc +1 -0
- acryl_datahub_cloud/metadata/schemas/NotificationRequest.avsc +91 -4
- acryl_datahub_cloud/metadata/schemas/Operation.avsc +17 -0
- acryl_datahub_cloud/metadata/schemas/Ownership.avsc +71 -1
- acryl_datahub_cloud/metadata/schemas/QuerySubjects.avsc +2 -13
- acryl_datahub_cloud/metadata/schemas/RelationshipChangeEvent.avsc +215 -0
- acryl_datahub_cloud/metadata/schemas/RoleProperties.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/SchemaFieldInfo.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/SchemaFieldKey.avsc +3 -0
- acryl_datahub_cloud/metadata/schemas/SchemaMetadata.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/SemanticContent.avsc +123 -0
- acryl_datahub_cloud/metadata/schemas/StructuredProperties.avsc +69 -0
- acryl_datahub_cloud/metadata/schemas/StructuredPropertyDefinition.avsc +15 -4
- acryl_datahub_cloud/metadata/schemas/StructuredPropertySettings.avsc +9 -0
- acryl_datahub_cloud/metadata/schemas/SubscriptionInfo.avsc +136 -5
- acryl_datahub_cloud/metadata/schemas/SubscriptionKey.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/SystemMetadata.avsc +61 -0
- acryl_datahub_cloud/metadata/schemas/TagProperties.avsc +3 -1
- acryl_datahub_cloud/metadata/schemas/TestInfo.avsc +2 -1
- acryl_datahub_cloud/metadata/schemas/UpstreamLineage.avsc +9 -0
- acryl_datahub_cloud/metadata/schemas/UsageFeatures.avsc +10 -0
- acryl_datahub_cloud/notifications/__init__.py +0 -0
- acryl_datahub_cloud/notifications/notification_recipient_builder.py +399 -0
- acryl_datahub_cloud/sdk/__init__.py +69 -0
- acryl_datahub_cloud/sdk/assertion/__init__.py +58 -0
- acryl_datahub_cloud/sdk/assertion/assertion_base.py +779 -0
- acryl_datahub_cloud/sdk/assertion/column_metric_assertion.py +191 -0
- acryl_datahub_cloud/sdk/assertion/column_value_assertion.py +431 -0
- acryl_datahub_cloud/sdk/assertion/freshness_assertion.py +201 -0
- acryl_datahub_cloud/sdk/assertion/schema_assertion.py +268 -0
- acryl_datahub_cloud/sdk/assertion/smart_column_metric_assertion.py +212 -0
- acryl_datahub_cloud/sdk/assertion/smart_freshness_assertion.py +165 -0
- acryl_datahub_cloud/sdk/assertion/smart_sql_assertion.py +156 -0
- acryl_datahub_cloud/sdk/assertion/smart_volume_assertion.py +162 -0
- acryl_datahub_cloud/sdk/assertion/sql_assertion.py +273 -0
- acryl_datahub_cloud/sdk/assertion/types.py +20 -0
- acryl_datahub_cloud/sdk/assertion/volume_assertion.py +156 -0
- acryl_datahub_cloud/sdk/assertion_client/__init__.py +0 -0
- acryl_datahub_cloud/sdk/assertion_client/column_metric.py +545 -0
- acryl_datahub_cloud/sdk/assertion_client/column_value.py +617 -0
- acryl_datahub_cloud/sdk/assertion_client/freshness.py +371 -0
- acryl_datahub_cloud/sdk/assertion_client/helpers.py +166 -0
- acryl_datahub_cloud/sdk/assertion_client/schema.py +358 -0
- acryl_datahub_cloud/sdk/assertion_client/smart_column_metric.py +540 -0
- acryl_datahub_cloud/sdk/assertion_client/smart_freshness.py +373 -0
- acryl_datahub_cloud/sdk/assertion_client/smart_sql.py +411 -0
- acryl_datahub_cloud/sdk/assertion_client/smart_volume.py +380 -0
- acryl_datahub_cloud/sdk/assertion_client/sql.py +410 -0
- acryl_datahub_cloud/sdk/assertion_client/volume.py +446 -0
- acryl_datahub_cloud/sdk/assertion_input/__init__.py +0 -0
- acryl_datahub_cloud/sdk/assertion_input/assertion_input.py +1470 -0
- acryl_datahub_cloud/sdk/assertion_input/column_assertion_constants.py +114 -0
- acryl_datahub_cloud/sdk/assertion_input/column_assertion_utils.py +284 -0
- acryl_datahub_cloud/sdk/assertion_input/column_metric_assertion_input.py +759 -0
- acryl_datahub_cloud/sdk/assertion_input/column_metric_constants.py +109 -0
- acryl_datahub_cloud/sdk/assertion_input/column_value_assertion_input.py +810 -0
- acryl_datahub_cloud/sdk/assertion_input/freshness_assertion_input.py +305 -0
- acryl_datahub_cloud/sdk/assertion_input/schema_assertion_input.py +413 -0
- acryl_datahub_cloud/sdk/assertion_input/smart_column_metric_assertion_input.py +793 -0
- acryl_datahub_cloud/sdk/assertion_input/smart_freshness_assertion_input.py +218 -0
- acryl_datahub_cloud/sdk/assertion_input/smart_sql_assertion_input.py +181 -0
- acryl_datahub_cloud/sdk/assertion_input/smart_volume_assertion_input.py +189 -0
- acryl_datahub_cloud/sdk/assertion_input/sql_assertion_input.py +320 -0
- acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +635 -0
- acryl_datahub_cloud/sdk/assertions_client.py +1074 -0
- acryl_datahub_cloud/sdk/entities/__init__.py +0 -0
- acryl_datahub_cloud/sdk/entities/assertion.py +439 -0
- acryl_datahub_cloud/sdk/entities/monitor.py +291 -0
- acryl_datahub_cloud/sdk/entities/subscription.py +100 -0
- acryl_datahub_cloud/sdk/errors.py +34 -0
- acryl_datahub_cloud/sdk/resolver_client.py +42 -0
- acryl_datahub_cloud/sdk/subscription_client.py +737 -0
- {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/METADATA +55 -49
- {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/RECORD +235 -142
- {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/WHEEL +1 -1
- {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/entry_points.txt +1 -0
- acryl_datahub_cloud/_sdk_extras/__init__.py +0 -4
- acryl_datahub_cloud/_sdk_extras/assertion.py +0 -15
- acryl_datahub_cloud/_sdk_extras/assertions_client.py +0 -23
- {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared constants for column assertions (column metric and column value).
|
|
3
|
+
|
|
4
|
+
This module contains constants that are used by both column metric and column value assertions
|
|
5
|
+
to ensure consistency and avoid duplication.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from enum import Enum
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
11
|
+
from datahub.metadata import schema_classes as models
|
|
12
|
+
|
|
13
|
+
# Keep this in sync with the frontend in getEligibleFieldColumns
|
|
14
|
+
# datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Validations/assertion/builder/steps/field/utils.ts
|
|
15
|
+
ALLOWED_COLUMN_TYPES_FOR_COLUMN_ASSERTION = [
|
|
16
|
+
models.StringTypeClass(),
|
|
17
|
+
models.NumberTypeClass(),
|
|
18
|
+
models.BooleanTypeClass(),
|
|
19
|
+
models.DateTypeClass(),
|
|
20
|
+
models.TimeTypeClass(),
|
|
21
|
+
models.NullTypeClass(),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
# Keep this in sync with FIELD_VALUES_OPERATOR_CONFIG in the frontend
|
|
25
|
+
# datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Validations/assertion/builder/steps/field/utils.ts
|
|
26
|
+
FIELD_VALUES_OPERATOR_CONFIG = {
|
|
27
|
+
"STRING": [
|
|
28
|
+
models.AssertionStdOperatorClass.NULL,
|
|
29
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
30
|
+
models.AssertionStdOperatorClass.EQUAL_TO,
|
|
31
|
+
models.AssertionStdOperatorClass.IN,
|
|
32
|
+
models.AssertionStdOperatorClass.GREATER_THAN_OR_EQUAL_TO,
|
|
33
|
+
models.AssertionStdOperatorClass.REGEX_MATCH,
|
|
34
|
+
models.AssertionStdOperatorClass.GREATER_THAN,
|
|
35
|
+
models.AssertionStdOperatorClass.LESS_THAN,
|
|
36
|
+
models.AssertionStdOperatorClass.BETWEEN,
|
|
37
|
+
],
|
|
38
|
+
"NUMBER": [
|
|
39
|
+
models.AssertionStdOperatorClass.GREATER_THAN,
|
|
40
|
+
models.AssertionStdOperatorClass.LESS_THAN,
|
|
41
|
+
models.AssertionStdOperatorClass.BETWEEN,
|
|
42
|
+
models.AssertionStdOperatorClass.NULL,
|
|
43
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
44
|
+
models.AssertionStdOperatorClass.EQUAL_TO,
|
|
45
|
+
models.AssertionStdOperatorClass.IN,
|
|
46
|
+
models.AssertionStdOperatorClass.GREATER_THAN_OR_EQUAL_TO,
|
|
47
|
+
models.AssertionStdOperatorClass.NOT_EQUAL_TO,
|
|
48
|
+
],
|
|
49
|
+
"BOOLEAN": [
|
|
50
|
+
models.AssertionStdOperatorClass.IS_TRUE,
|
|
51
|
+
models.AssertionStdOperatorClass.IS_FALSE,
|
|
52
|
+
models.AssertionStdOperatorClass.NULL,
|
|
53
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
54
|
+
],
|
|
55
|
+
"DATE": [
|
|
56
|
+
models.AssertionStdOperatorClass.NULL,
|
|
57
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
58
|
+
],
|
|
59
|
+
"TIME": [
|
|
60
|
+
models.AssertionStdOperatorClass.NULL,
|
|
61
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
62
|
+
],
|
|
63
|
+
"NULL": [
|
|
64
|
+
models.AssertionStdOperatorClass.NULL,
|
|
65
|
+
models.AssertionStdOperatorClass.NOT_NULL,
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class OperatorType(str, Enum):
|
|
71
|
+
"""Enum for assertion operators used in column assertions."""
|
|
72
|
+
|
|
73
|
+
EQUAL_TO = models.AssertionStdOperatorClass.EQUAL_TO
|
|
74
|
+
NOT_EQUAL_TO = models.AssertionStdOperatorClass.NOT_EQUAL_TO
|
|
75
|
+
GREATER_THAN = models.AssertionStdOperatorClass.GREATER_THAN
|
|
76
|
+
GREATER_THAN_OR_EQUAL_TO = models.AssertionStdOperatorClass.GREATER_THAN_OR_EQUAL_TO
|
|
77
|
+
LESS_THAN = models.AssertionStdOperatorClass.LESS_THAN
|
|
78
|
+
LESS_THAN_OR_EQUAL_TO = models.AssertionStdOperatorClass.LESS_THAN_OR_EQUAL_TO
|
|
79
|
+
BETWEEN = models.AssertionStdOperatorClass.BETWEEN
|
|
80
|
+
IN = models.AssertionStdOperatorClass.IN
|
|
81
|
+
NOT_IN = models.AssertionStdOperatorClass.NOT_IN
|
|
82
|
+
NULL = models.AssertionStdOperatorClass.NULL
|
|
83
|
+
NOT_NULL = models.AssertionStdOperatorClass.NOT_NULL
|
|
84
|
+
IS_TRUE = models.AssertionStdOperatorClass.IS_TRUE
|
|
85
|
+
IS_FALSE = models.AssertionStdOperatorClass.IS_FALSE
|
|
86
|
+
CONTAIN = models.AssertionStdOperatorClass.CONTAIN
|
|
87
|
+
END_WITH = models.AssertionStdOperatorClass.END_WITH
|
|
88
|
+
START_WITH = models.AssertionStdOperatorClass.START_WITH
|
|
89
|
+
REGEX_MATCH = models.AssertionStdOperatorClass.REGEX_MATCH
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ValueType(str, Enum):
|
|
93
|
+
"""Enum for assertion parameter value types."""
|
|
94
|
+
|
|
95
|
+
STRING = models.AssertionStdParameterTypeClass.STRING
|
|
96
|
+
NUMBER = models.AssertionStdParameterTypeClass.NUMBER
|
|
97
|
+
UNKNOWN = models.AssertionStdParameterTypeClass.UNKNOWN
|
|
98
|
+
# Note: LIST and SET are intentionally excluded as they are not yet supported
|
|
99
|
+
# LIST = models.AssertionStdParameterTypeClass.LIST
|
|
100
|
+
# SET = models.AssertionStdParameterTypeClass.SET
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# Type aliases
|
|
104
|
+
ValueInputType = Union[str, int, float]
|
|
105
|
+
ValueTypeInputType = Union[ValueType, models.AssertionStdParameterTypeClass, str]
|
|
106
|
+
RangeInputType = tuple[ValueInputType, ValueInputType]
|
|
107
|
+
RangeTypeInputType = Union[
|
|
108
|
+
str,
|
|
109
|
+
tuple[str, str],
|
|
110
|
+
ValueTypeInputType,
|
|
111
|
+
tuple[ValueTypeInputType, ValueTypeInputType],
|
|
112
|
+
]
|
|
113
|
+
RangeTypeParsedType = tuple[ValueTypeInputType, ValueTypeInputType]
|
|
114
|
+
OperatorInputType = Union[OperatorType, models.AssertionStdOperatorClass, str]
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared utility functions for column assertions (column metric and column value).
|
|
3
|
+
|
|
4
|
+
This module contains utility functions that are used by both column metric and column value assertions
|
|
5
|
+
to ensure consistency and avoid duplication.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
from typing import Optional, Union
|
|
10
|
+
|
|
11
|
+
from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
|
|
12
|
+
NO_PARAMETER_OPERATORS,
|
|
13
|
+
RANGE_OPERATORS,
|
|
14
|
+
SINGLE_VALUE_OPERATORS,
|
|
15
|
+
_try_parse_and_validate_schema_classes_enum,
|
|
16
|
+
)
|
|
17
|
+
from acryl_datahub_cloud.sdk.assertion_input.column_assertion_constants import (
|
|
18
|
+
RangeInputType,
|
|
19
|
+
RangeTypeInputType,
|
|
20
|
+
RangeTypeParsedType,
|
|
21
|
+
ValueInputType,
|
|
22
|
+
ValueTypeInputType,
|
|
23
|
+
)
|
|
24
|
+
from acryl_datahub_cloud.sdk.errors import (
|
|
25
|
+
SDKNotYetSupportedError,
|
|
26
|
+
SDKUsageError,
|
|
27
|
+
)
|
|
28
|
+
from datahub.emitter.enum_helpers import get_enum_options
|
|
29
|
+
from datahub.metadata import schema_classes as models
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _try_parse_and_validate_value_type(
|
|
33
|
+
value_type: Optional[ValueTypeInputType],
|
|
34
|
+
) -> models.AssertionStdParameterTypeClass:
|
|
35
|
+
"""Parse and validate a value type.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
value_type: The value type to parse and validate.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
The parsed AssertionStdParameterTypeClass.
|
|
42
|
+
|
|
43
|
+
Raises:
|
|
44
|
+
SDKUsageError: If the value type is None or invalid.
|
|
45
|
+
"""
|
|
46
|
+
if value_type is None:
|
|
47
|
+
raise SDKUsageError("Value type is required")
|
|
48
|
+
|
|
49
|
+
return _try_parse_and_validate_schema_classes_enum(
|
|
50
|
+
value_type, models.AssertionStdParameterTypeClass
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _deserialize_json_value(value: ValueInputType) -> ValueInputType:
|
|
55
|
+
"""
|
|
56
|
+
Deserialize a value that might be a JSON string.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
value: The value to deserialize, potentially a JSON string.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The deserialized value or the original value if not JSON.
|
|
63
|
+
"""
|
|
64
|
+
if isinstance(value, str):
|
|
65
|
+
try:
|
|
66
|
+
return json.loads(value)
|
|
67
|
+
except json.JSONDecodeError:
|
|
68
|
+
return value
|
|
69
|
+
return value
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _convert_string_to_number(value: str) -> Union[int, float]:
|
|
73
|
+
"""
|
|
74
|
+
Convert a string to a number (int or float).
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
value: The string value to convert.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
The converted number.
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
ValueError: If the string cannot be converted to a number.
|
|
84
|
+
"""
|
|
85
|
+
if "." in value:
|
|
86
|
+
return float(value)
|
|
87
|
+
return int(value)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _validate_number_type(
|
|
91
|
+
value: ValueInputType, original_value: ValueInputType
|
|
92
|
+
) -> ValueInputType:
|
|
93
|
+
"""
|
|
94
|
+
Validate and convert a value to a number type.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
value: The deserialized value to validate.
|
|
98
|
+
original_value: The original input value for error messages.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
The validated number value.
|
|
102
|
+
|
|
103
|
+
Raises:
|
|
104
|
+
SDKUsageError: If the value cannot be converted to a number.
|
|
105
|
+
"""
|
|
106
|
+
if isinstance(value, (int, float)):
|
|
107
|
+
return value
|
|
108
|
+
|
|
109
|
+
if isinstance(value, str):
|
|
110
|
+
try:
|
|
111
|
+
return _convert_string_to_number(value)
|
|
112
|
+
except ValueError as e:
|
|
113
|
+
raise SDKUsageError(
|
|
114
|
+
f"Invalid value: {original_value}, must be a number"
|
|
115
|
+
) from e
|
|
116
|
+
|
|
117
|
+
raise SDKUsageError(f"Invalid value: {original_value}, must be a number")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _validate_string_type(
|
|
121
|
+
value: ValueInputType, original_value: ValueInputType
|
|
122
|
+
) -> ValueInputType:
|
|
123
|
+
"""
|
|
124
|
+
Validate that a value is a string type.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
value: The deserialized value to validate.
|
|
128
|
+
original_value: The original input value for error messages.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
The validated string value.
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
SDKUsageError: If the value is not a string.
|
|
135
|
+
"""
|
|
136
|
+
if not isinstance(value, str):
|
|
137
|
+
raise SDKUsageError(f"Invalid value: {original_value}, must be a string")
|
|
138
|
+
return value
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _validate_unsupported_types(value_type: ValueTypeInputType) -> None:
|
|
142
|
+
"""
|
|
143
|
+
Check for unsupported value types and raise appropriate errors.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
value_type: The value type to check.
|
|
147
|
+
|
|
148
|
+
Raises:
|
|
149
|
+
SDKNotYetSupportedError: If the value type is LIST or SET.
|
|
150
|
+
SDKUsageError: If the value type is invalid.
|
|
151
|
+
"""
|
|
152
|
+
if value_type in (
|
|
153
|
+
models.AssertionStdParameterTypeClass.LIST,
|
|
154
|
+
models.AssertionStdParameterTypeClass.SET,
|
|
155
|
+
):
|
|
156
|
+
raise SDKNotYetSupportedError(
|
|
157
|
+
"List and set value types are not supported for column assertions"
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
valid_types = {
|
|
161
|
+
models.AssertionStdParameterTypeClass.NUMBER,
|
|
162
|
+
models.AssertionStdParameterTypeClass.STRING,
|
|
163
|
+
models.AssertionStdParameterTypeClass.UNKNOWN,
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if value_type not in valid_types:
|
|
167
|
+
raise SDKUsageError(
|
|
168
|
+
f"Invalid value type: {value_type}, valid options are {get_enum_options(models.AssertionStdParameterTypeClass)}"
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _try_parse_and_validate_value(
|
|
173
|
+
value: Optional[ValueInputType],
|
|
174
|
+
value_type: ValueTypeInputType,
|
|
175
|
+
) -> ValueInputType:
|
|
176
|
+
"""
|
|
177
|
+
Parse and validate a value according to its expected type.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
value: The value to parse and validate.
|
|
181
|
+
value_type: The expected type of the value.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
The validated and potentially converted value.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
SDKUsageError: If the value is None, invalid, or cannot be converted.
|
|
188
|
+
SDKNotYetSupportedError: If the value type is not supported.
|
|
189
|
+
"""
|
|
190
|
+
if value is None:
|
|
191
|
+
raise SDKUsageError("Value parameter is required for the chosen operator")
|
|
192
|
+
|
|
193
|
+
# Deserialize JSON strings if applicable
|
|
194
|
+
deserialized_value = _deserialize_json_value(value)
|
|
195
|
+
|
|
196
|
+
# Validate based on expected type
|
|
197
|
+
if value_type == models.AssertionStdParameterTypeClass.NUMBER:
|
|
198
|
+
return _validate_number_type(deserialized_value, value)
|
|
199
|
+
elif value_type == models.AssertionStdParameterTypeClass.STRING:
|
|
200
|
+
return _validate_string_type(deserialized_value, value)
|
|
201
|
+
elif value_type == models.AssertionStdParameterTypeClass.UNKNOWN:
|
|
202
|
+
return deserialized_value # Accept any type for unknown
|
|
203
|
+
else:
|
|
204
|
+
_validate_unsupported_types(value_type)
|
|
205
|
+
return deserialized_value
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _is_range_required_for_operator(operator: models.AssertionStdOperatorClass) -> bool:
|
|
209
|
+
"""Check if the operator requires range parameters."""
|
|
210
|
+
return operator in RANGE_OPERATORS
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _is_value_required_for_operator(operator: models.AssertionStdOperatorClass) -> bool:
|
|
214
|
+
"""Check if the operator requires a single value parameter."""
|
|
215
|
+
return operator in SINGLE_VALUE_OPERATORS
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _is_no_parameter_operator(operator: models.AssertionStdOperatorClass) -> bool:
|
|
219
|
+
"""Check if the operator takes no parameters."""
|
|
220
|
+
return operator in NO_PARAMETER_OPERATORS
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def _try_parse_and_validate_range_type(
|
|
224
|
+
range_type: Optional[RangeTypeInputType] = None,
|
|
225
|
+
) -> RangeTypeParsedType:
|
|
226
|
+
"""Parse and validate a range type.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
range_type: The range type to parse and validate.
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
A tuple of (min_type, max_type) as AssertionStdParameterTypeClass values.
|
|
233
|
+
"""
|
|
234
|
+
if range_type is None:
|
|
235
|
+
return (
|
|
236
|
+
models.AssertionStdParameterTypeClass.UNKNOWN,
|
|
237
|
+
models.AssertionStdParameterTypeClass.UNKNOWN,
|
|
238
|
+
)
|
|
239
|
+
if isinstance(range_type, tuple):
|
|
240
|
+
return (
|
|
241
|
+
_try_parse_and_validate_schema_classes_enum(
|
|
242
|
+
range_type[0], models.AssertionStdParameterTypeClass
|
|
243
|
+
),
|
|
244
|
+
_try_parse_and_validate_schema_classes_enum(
|
|
245
|
+
range_type[1], models.AssertionStdParameterTypeClass
|
|
246
|
+
),
|
|
247
|
+
)
|
|
248
|
+
# Single value, we assume the same type for start and end:
|
|
249
|
+
parsed_range_type = _try_parse_and_validate_schema_classes_enum(
|
|
250
|
+
range_type, models.AssertionStdParameterTypeClass
|
|
251
|
+
)
|
|
252
|
+
return parsed_range_type, parsed_range_type
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def _try_parse_and_validate_range(
|
|
256
|
+
range: Optional[RangeInputType],
|
|
257
|
+
range_type: RangeTypeParsedType,
|
|
258
|
+
operator: models.AssertionStdOperatorClass,
|
|
259
|
+
) -> RangeInputType:
|
|
260
|
+
"""Parse and validate range parameters.
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
range: The range values (min, max).
|
|
264
|
+
range_type: The types of the range values.
|
|
265
|
+
operator: The operator being used.
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
A tuple of validated (min_value, max_value).
|
|
269
|
+
|
|
270
|
+
Raises:
|
|
271
|
+
SDKUsageError: If the range is invalid for the operator.
|
|
272
|
+
"""
|
|
273
|
+
if (range is None or range_type is None) and _is_range_required_for_operator(
|
|
274
|
+
operator
|
|
275
|
+
):
|
|
276
|
+
raise SDKUsageError(f"Range is required for operator {operator}")
|
|
277
|
+
|
|
278
|
+
if range is None:
|
|
279
|
+
raise SDKUsageError(f"Range is required for operator {operator}")
|
|
280
|
+
|
|
281
|
+
range_start = _try_parse_and_validate_value(range[0], range_type[0])
|
|
282
|
+
range_end = _try_parse_and_validate_value(range[1], range_type[1])
|
|
283
|
+
|
|
284
|
+
return (range_start, range_end)
|