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,305 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from typing import Optional, Union
|
|
4
|
+
|
|
5
|
+
from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
|
|
6
|
+
DEFAULT_DAILY_SCHEDULE,
|
|
7
|
+
HIGH_WATERMARK_ALLOWED_FIELD_TYPES,
|
|
8
|
+
LAST_MODIFIED_ALLOWED_FIELD_TYPES,
|
|
9
|
+
AssertionIncidentBehaviorInputTypes,
|
|
10
|
+
DetectionMechanismInputTypes,
|
|
11
|
+
FieldSpecType,
|
|
12
|
+
TimeWindowSizeInputTypes,
|
|
13
|
+
_AssertionInput,
|
|
14
|
+
_AuditLog,
|
|
15
|
+
_DataHubOperation,
|
|
16
|
+
_HasFreshnessFeatures,
|
|
17
|
+
_HighWatermarkColumn,
|
|
18
|
+
_InformationSchema,
|
|
19
|
+
_LastModifiedColumn,
|
|
20
|
+
_try_parse_and_validate_schema_classes_enum,
|
|
21
|
+
_try_parse_time_window_size,
|
|
22
|
+
)
|
|
23
|
+
from acryl_datahub_cloud.sdk.entities.assertion import (
|
|
24
|
+
AssertionInfoInputType,
|
|
25
|
+
TagsInputType,
|
|
26
|
+
)
|
|
27
|
+
from acryl_datahub_cloud.sdk.errors import (
|
|
28
|
+
SDKNotYetSupportedError,
|
|
29
|
+
SDKUsageError,
|
|
30
|
+
)
|
|
31
|
+
from datahub.metadata import schema_classes as models
|
|
32
|
+
from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn
|
|
33
|
+
from datahub.sdk.entity_client import EntityClient
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class FreshnessAssertionScheduleCheckType(str, Enum):
|
|
37
|
+
FIXED_INTERVAL = "FIXED_INTERVAL"
|
|
38
|
+
SINCE_THE_LAST_CHECK = "SINCE_THE_LAST_CHECK"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
DEFAULT_FRESHNESS_SCHEDULE_CHECK_TYPE = (
|
|
42
|
+
FreshnessAssertionScheduleCheckType.SINCE_THE_LAST_CHECK
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _parse_freshness_schedule_check_type(
|
|
47
|
+
schedule_check_type: Optional[
|
|
48
|
+
Union[
|
|
49
|
+
str,
|
|
50
|
+
FreshnessAssertionScheduleCheckType,
|
|
51
|
+
models.FreshnessAssertionScheduleTypeClass,
|
|
52
|
+
]
|
|
53
|
+
],
|
|
54
|
+
) -> FreshnessAssertionScheduleCheckType:
|
|
55
|
+
"""Parse the freshness schedule check type."""
|
|
56
|
+
if isinstance(schedule_check_type, FreshnessAssertionScheduleCheckType):
|
|
57
|
+
return schedule_check_type
|
|
58
|
+
if isinstance(schedule_check_type, models.FreshnessAssertionScheduleTypeClass):
|
|
59
|
+
return FreshnessAssertionScheduleCheckType(
|
|
60
|
+
_try_parse_and_validate_schema_classes_enum(
|
|
61
|
+
schedule_check_type, models.FreshnessAssertionScheduleTypeClass
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
if not schedule_check_type:
|
|
65
|
+
return DEFAULT_FRESHNESS_SCHEDULE_CHECK_TYPE
|
|
66
|
+
|
|
67
|
+
# Make string comparison case-insensitive
|
|
68
|
+
if isinstance(schedule_check_type, str):
|
|
69
|
+
schedule_check_type_upper = schedule_check_type.upper()
|
|
70
|
+
for member in FreshnessAssertionScheduleCheckType:
|
|
71
|
+
if member.value.upper() == schedule_check_type_upper:
|
|
72
|
+
return member
|
|
73
|
+
# If no match found, fall back to original behavior for error
|
|
74
|
+
|
|
75
|
+
return FreshnessAssertionScheduleCheckType(schedule_check_type)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class _FreshnessAssertionInput(_AssertionInput, _HasFreshnessFeatures):
|
|
79
|
+
def _assertion_type(self) -> str:
|
|
80
|
+
"""Get the assertion type."""
|
|
81
|
+
return models.AssertionTypeClass.FRESHNESS
|
|
82
|
+
|
|
83
|
+
def __init__(
|
|
84
|
+
self,
|
|
85
|
+
*,
|
|
86
|
+
dataset_urn: Union[str, DatasetUrn],
|
|
87
|
+
entity_client: EntityClient, # Needed to get the schema field spec for the detection mechanism if needed
|
|
88
|
+
urn: Optional[Union[str, AssertionUrn]] = None,
|
|
89
|
+
display_name: Optional[str] = None,
|
|
90
|
+
enabled: bool = True,
|
|
91
|
+
schedule: Optional[Union[str, models.CronScheduleClass]] = None,
|
|
92
|
+
detection_mechanism: DetectionMechanismInputTypes = None,
|
|
93
|
+
incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
|
|
94
|
+
tags: Optional[TagsInputType] = None,
|
|
95
|
+
created_by: Union[str, CorpUserUrn],
|
|
96
|
+
created_at: datetime,
|
|
97
|
+
updated_by: Union[str, CorpUserUrn],
|
|
98
|
+
updated_at: datetime,
|
|
99
|
+
freshness_schedule_check_type: Optional[
|
|
100
|
+
Union[
|
|
101
|
+
str,
|
|
102
|
+
FreshnessAssertionScheduleCheckType,
|
|
103
|
+
models.FreshnessAssertionScheduleTypeClass,
|
|
104
|
+
]
|
|
105
|
+
] = None,
|
|
106
|
+
lookback_window: Optional[TimeWindowSizeInputTypes] = None,
|
|
107
|
+
):
|
|
108
|
+
_AssertionInput.__init__(
|
|
109
|
+
self,
|
|
110
|
+
dataset_urn=dataset_urn,
|
|
111
|
+
entity_client=entity_client,
|
|
112
|
+
urn=urn,
|
|
113
|
+
display_name=display_name,
|
|
114
|
+
enabled=enabled,
|
|
115
|
+
schedule=schedule,
|
|
116
|
+
detection_mechanism=detection_mechanism,
|
|
117
|
+
incident_behavior=incident_behavior,
|
|
118
|
+
tags=tags,
|
|
119
|
+
source_type=models.AssertionSourceTypeClass.NATIVE, # Native assertions are of type native, not inferred
|
|
120
|
+
created_by=created_by,
|
|
121
|
+
created_at=created_at,
|
|
122
|
+
updated_by=updated_by,
|
|
123
|
+
updated_at=updated_at,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
self.freshness_schedule_check_type = _parse_freshness_schedule_check_type(
|
|
127
|
+
freshness_schedule_check_type
|
|
128
|
+
)
|
|
129
|
+
self.lookback_window = (
|
|
130
|
+
_try_parse_time_window_size(lookback_window) if lookback_window else None
|
|
131
|
+
)
|
|
132
|
+
self._validate_schedule_check_type()
|
|
133
|
+
|
|
134
|
+
def _validate_schedule_check_type(self) -> None:
|
|
135
|
+
"""Validate the schedule check type."""
|
|
136
|
+
if self.freshness_schedule_check_type is None:
|
|
137
|
+
raise SDKUsageError("Freshness schedule check type is required.")
|
|
138
|
+
if (
|
|
139
|
+
self.freshness_schedule_check_type
|
|
140
|
+
== FreshnessAssertionScheduleCheckType.FIXED_INTERVAL
|
|
141
|
+
and self.lookback_window is None
|
|
142
|
+
):
|
|
143
|
+
raise SDKUsageError(
|
|
144
|
+
"Fixed interval freshness assertions must have a lookback_window provided."
|
|
145
|
+
)
|
|
146
|
+
if (
|
|
147
|
+
self.freshness_schedule_check_type
|
|
148
|
+
== FreshnessAssertionScheduleCheckType.SINCE_THE_LAST_CHECK
|
|
149
|
+
and self.lookback_window is not None
|
|
150
|
+
):
|
|
151
|
+
raise SDKUsageError(
|
|
152
|
+
"Since the last check freshness assertions cannot have a lookback_window provided."
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
def _create_monitor_info(
|
|
156
|
+
self,
|
|
157
|
+
assertion_urn: AssertionUrn,
|
|
158
|
+
status: models.MonitorStatusClass,
|
|
159
|
+
schedule: models.CronScheduleClass,
|
|
160
|
+
) -> models.MonitorInfoClass:
|
|
161
|
+
"""
|
|
162
|
+
Create a MonitorInfoClass with all the necessary components.
|
|
163
|
+
"""
|
|
164
|
+
source_type, field = self._convert_assertion_source_type_and_field()
|
|
165
|
+
return models.MonitorInfoClass(
|
|
166
|
+
type=models.MonitorTypeClass.ASSERTION,
|
|
167
|
+
status=status,
|
|
168
|
+
assertionMonitor=models.AssertionMonitorClass(
|
|
169
|
+
assertions=[
|
|
170
|
+
models.AssertionEvaluationSpecClass(
|
|
171
|
+
assertion=str(assertion_urn),
|
|
172
|
+
schedule=schedule,
|
|
173
|
+
parameters=self._get_assertion_evaluation_parameters(
|
|
174
|
+
str(source_type), field
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
def _create_assertion_info(
|
|
182
|
+
self, filter: Optional[models.DatasetFilterClass]
|
|
183
|
+
) -> AssertionInfoInputType:
|
|
184
|
+
"""
|
|
185
|
+
Create a FreshnessAssertionInfoClass for a freshness assertion.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
filter: Optional filter to apply to the assertion. Only relevant for QUERY detection mechanism.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
A FreshnessAssertionInfoClass configured for freshness.
|
|
192
|
+
"""
|
|
193
|
+
schedule = self._convert_schedule()
|
|
194
|
+
return models.FreshnessAssertionInfoClass(
|
|
195
|
+
type=models.FreshnessAssertionTypeClass.DATASET_CHANGE, # Currently only dataset change is supported
|
|
196
|
+
entity=str(self.dataset_urn),
|
|
197
|
+
schedule=models.FreshnessAssertionScheduleClass(
|
|
198
|
+
type=self.freshness_schedule_check_type
|
|
199
|
+
or models.FreshnessAssertionScheduleTypeClass.SINCE_THE_LAST_CHECK,
|
|
200
|
+
cron=models.FreshnessCronScheduleClass(
|
|
201
|
+
cron=schedule.cron,
|
|
202
|
+
timezone=schedule.timezone,
|
|
203
|
+
),
|
|
204
|
+
fixedInterval=models.FixedIntervalScheduleClass(
|
|
205
|
+
multiple=self.lookback_window.multiple,
|
|
206
|
+
unit=self.lookback_window.unit,
|
|
207
|
+
)
|
|
208
|
+
if self.lookback_window
|
|
209
|
+
else None,
|
|
210
|
+
),
|
|
211
|
+
filter=filter,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
def _convert_schedule(self) -> models.CronScheduleClass:
|
|
215
|
+
"""Create a schedule for a freshness assertion.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
A CronScheduleClass with appropriate schedule settings.
|
|
219
|
+
"""
|
|
220
|
+
if self.schedule is None:
|
|
221
|
+
return DEFAULT_DAILY_SCHEDULE
|
|
222
|
+
|
|
223
|
+
return models.CronScheduleClass(
|
|
224
|
+
cron=self.schedule.cron,
|
|
225
|
+
timezone=self.schedule.timezone,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def _get_assertion_evaluation_parameters(
|
|
229
|
+
self, source_type: str, field: Optional[FieldSpecType]
|
|
230
|
+
) -> models.AssertionEvaluationParametersClass:
|
|
231
|
+
# Ensure field is either None or FreshnessFieldSpecClass
|
|
232
|
+
freshness_field = None
|
|
233
|
+
if field is not None:
|
|
234
|
+
if not isinstance(field, models.FreshnessFieldSpecClass):
|
|
235
|
+
raise SDKUsageError(
|
|
236
|
+
f"Expected FreshnessFieldSpecClass for freshness assertion, got {type(field).__name__}"
|
|
237
|
+
)
|
|
238
|
+
freshness_field = field
|
|
239
|
+
|
|
240
|
+
return models.AssertionEvaluationParametersClass(
|
|
241
|
+
type=models.AssertionEvaluationParametersTypeClass.DATASET_FRESHNESS,
|
|
242
|
+
datasetFreshnessParameters=models.DatasetFreshnessAssertionParametersClass(
|
|
243
|
+
sourceType=source_type, field=freshness_field
|
|
244
|
+
),
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
def _convert_assertion_source_type_and_field(
|
|
248
|
+
self,
|
|
249
|
+
) -> tuple[str, Optional[FieldSpecType]]:
|
|
250
|
+
"""
|
|
251
|
+
Convert detection mechanism into source type and field specification for freshness assertions.
|
|
252
|
+
|
|
253
|
+
Returns:
|
|
254
|
+
A tuple of (source_type, field) where field may be None.
|
|
255
|
+
Note that the source_type is a string, not a models.DatasetFreshnessSourceTypeClass (or other assertion source type) since
|
|
256
|
+
the source type is not a enum in the code generated from the DatasetFreshnessSourceType enum in the PDL.
|
|
257
|
+
|
|
258
|
+
Raises:
|
|
259
|
+
SDKNotYetSupportedError: If the detection mechanism is not supported.
|
|
260
|
+
SDKUsageError: If the field (column) is not found in the dataset,
|
|
261
|
+
and the detection mechanism requires a field. Also if the field
|
|
262
|
+
is not an allowed type for the detection mechanism.
|
|
263
|
+
"""
|
|
264
|
+
source_type = models.DatasetFreshnessSourceTypeClass.INFORMATION_SCHEMA
|
|
265
|
+
field = None
|
|
266
|
+
|
|
267
|
+
if isinstance(self.detection_mechanism, _InformationSchema):
|
|
268
|
+
source_type = models.DatasetFreshnessSourceTypeClass.INFORMATION_SCHEMA
|
|
269
|
+
elif isinstance(self.detection_mechanism, _DataHubOperation):
|
|
270
|
+
source_type = models.DatasetFreshnessSourceTypeClass.DATAHUB_OPERATION
|
|
271
|
+
elif isinstance(self.detection_mechanism, _AuditLog):
|
|
272
|
+
source_type = models.DatasetFreshnessSourceTypeClass.AUDIT_LOG
|
|
273
|
+
elif isinstance(self.detection_mechanism, _LastModifiedColumn):
|
|
274
|
+
source_type = models.DatasetFreshnessSourceTypeClass.FIELD_VALUE
|
|
275
|
+
field = self._create_field_spec(
|
|
276
|
+
self.detection_mechanism.column_name,
|
|
277
|
+
LAST_MODIFIED_ALLOWED_FIELD_TYPES,
|
|
278
|
+
"last modified column",
|
|
279
|
+
models.FreshnessFieldKindClass.LAST_MODIFIED,
|
|
280
|
+
self._get_schema_field_spec,
|
|
281
|
+
self._validate_field_type,
|
|
282
|
+
)
|
|
283
|
+
elif isinstance(self.detection_mechanism, _HighWatermarkColumn):
|
|
284
|
+
if (
|
|
285
|
+
self.freshness_schedule_check_type
|
|
286
|
+
is models.FreshnessAssertionScheduleTypeClass.FIXED_INTERVAL
|
|
287
|
+
):
|
|
288
|
+
raise SDKUsageError(
|
|
289
|
+
"Fixed interval freshness assertions cannot have a high watermark column provided."
|
|
290
|
+
)
|
|
291
|
+
source_type = models.DatasetFreshnessSourceTypeClass.FIELD_VALUE
|
|
292
|
+
field = self._create_field_spec(
|
|
293
|
+
self.detection_mechanism.column_name,
|
|
294
|
+
HIGH_WATERMARK_ALLOWED_FIELD_TYPES,
|
|
295
|
+
"high watermark column",
|
|
296
|
+
models.FreshnessFieldKindClass.HIGH_WATERMARK,
|
|
297
|
+
self._get_schema_field_spec,
|
|
298
|
+
self._validate_field_type,
|
|
299
|
+
)
|
|
300
|
+
else:
|
|
301
|
+
raise SDKNotYetSupportedError(
|
|
302
|
+
f"Detection mechanism {self.detection_mechanism} not yet supported for freshness assertions"
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
return source_type, field
|