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.

Files changed (238) hide show
  1. acryl_datahub_cloud/_codegen_config.json +1 -1
  2. acryl_datahub_cloud/acryl_cs_issues/models.py +5 -3
  3. acryl_datahub_cloud/action_request/action_request_owner_source.py +36 -6
  4. acryl_datahub_cloud/datahub_forms_notifications/__init__.py +0 -0
  5. acryl_datahub_cloud/datahub_forms_notifications/forms_notifications_source.py +569 -0
  6. acryl_datahub_cloud/datahub_forms_notifications/get_feature_flag.gql +7 -0
  7. acryl_datahub_cloud/datahub_forms_notifications/get_search_results_total.gql +14 -0
  8. acryl_datahub_cloud/datahub_forms_notifications/query.py +17 -0
  9. acryl_datahub_cloud/datahub_forms_notifications/scroll_forms_for_notification.gql +29 -0
  10. acryl_datahub_cloud/datahub_forms_notifications/send_form_notification_request.gql +5 -0
  11. acryl_datahub_cloud/datahub_reporting/datahub_dataset.py +37 -13
  12. acryl_datahub_cloud/datahub_reporting/datahub_form_reporting.py +55 -24
  13. acryl_datahub_cloud/datahub_reporting/extract_graph.py +4 -3
  14. acryl_datahub_cloud/datahub_reporting/extract_sql.py +242 -51
  15. acryl_datahub_cloud/datahub_reporting/forms.py +1 -1
  16. acryl_datahub_cloud/datahub_reporting/forms_config.py +3 -2
  17. acryl_datahub_cloud/datahub_restore/source.py +3 -2
  18. acryl_datahub_cloud/datahub_usage_reporting/excluded.py +94 -0
  19. acryl_datahub_cloud/datahub_usage_reporting/query_builder.py +48 -8
  20. acryl_datahub_cloud/datahub_usage_reporting/usage_feature_reporter.py +518 -77
  21. acryl_datahub_cloud/elasticsearch/graph_service.py +76 -14
  22. acryl_datahub_cloud/graphql_utils.py +64 -0
  23. acryl_datahub_cloud/lineage_features/source.py +555 -49
  24. acryl_datahub_cloud/metadata/_urns/urn_defs.py +2296 -1900
  25. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/actionworkflow/__init__.py +53 -0
  26. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/anomaly/__init__.py +2 -0
  27. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/application/__init__.py +19 -0
  28. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/assertion/__init__.py +4 -2
  29. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/common/__init__.py +6 -0
  30. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/conversation/__init__.py +29 -0
  31. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/event/notification/settings/__init__.py +2 -0
  32. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/execution/__init__.py +2 -0
  33. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/file/__init__.py +19 -0
  34. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/form/__init__.py +8 -0
  35. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/identity/__init__.py +8 -0
  36. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/knowledge/__init__.py +33 -0
  37. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/logical/__init__.py +15 -0
  38. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/key/__init__.py +12 -0
  39. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/search/features/__init__.py +2 -0
  40. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/module/__init__.py +31 -0
  41. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/notification/__init__.py +19 -0
  42. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/platform/event/v1/__init__.py +4 -0
  43. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/role/__init__.py +2 -0
  44. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/asset/__init__.py +19 -0
  45. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/global/__init__.py +28 -0
  46. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/template/__init__.py +31 -0
  47. acryl_datahub_cloud/metadata/schema.avsc +25091 -20557
  48. acryl_datahub_cloud/metadata/schema_classes.py +29269 -23863
  49. acryl_datahub_cloud/metadata/schemas/ActionRequestInfo.avsc +235 -2
  50. acryl_datahub_cloud/metadata/schemas/ActionWorkflowInfo.avsc +683 -0
  51. acryl_datahub_cloud/metadata/schemas/ActionWorkflowKey.avsc +21 -0
  52. acryl_datahub_cloud/metadata/schemas/Actors.avsc +38 -1
  53. acryl_datahub_cloud/metadata/schemas/ApplicationKey.avsc +31 -0
  54. acryl_datahub_cloud/metadata/schemas/ApplicationProperties.avsc +75 -0
  55. acryl_datahub_cloud/metadata/schemas/Applications.avsc +38 -0
  56. acryl_datahub_cloud/metadata/schemas/AssertionAnalyticsRunEvent.avsc +353 -215
  57. acryl_datahub_cloud/metadata/schemas/AssertionInfo.avsc +147 -20
  58. acryl_datahub_cloud/metadata/schemas/AssertionKey.avsc +1 -1
  59. acryl_datahub_cloud/metadata/schemas/AssertionRunEvent.avsc +166 -21
  60. acryl_datahub_cloud/metadata/schemas/{AssertionSummary.avsc → AssertionRunSummary.avsc} +15 -2
  61. acryl_datahub_cloud/metadata/schemas/AssertionsSummary.avsc +54 -0
  62. acryl_datahub_cloud/metadata/schemas/AssetSettings.avsc +63 -0
  63. acryl_datahub_cloud/metadata/schemas/BusinessAttributeInfo.avsc +7 -3
  64. acryl_datahub_cloud/metadata/schemas/ChartInfo.avsc +20 -6
  65. acryl_datahub_cloud/metadata/schemas/ChartKey.avsc +1 -0
  66. acryl_datahub_cloud/metadata/schemas/ConstraintInfo.avsc +12 -1
  67. acryl_datahub_cloud/metadata/schemas/ContainerKey.avsc +1 -0
  68. acryl_datahub_cloud/metadata/schemas/ContainerProperties.avsc +16 -5
  69. acryl_datahub_cloud/metadata/schemas/CorpGroupEditableInfo.avsc +2 -1
  70. acryl_datahub_cloud/metadata/schemas/CorpGroupInfo.avsc +7 -3
  71. acryl_datahub_cloud/metadata/schemas/CorpGroupKey.avsc +2 -1
  72. acryl_datahub_cloud/metadata/schemas/CorpGroupSettings.avsc +127 -2
  73. acryl_datahub_cloud/metadata/schemas/CorpUserEditableInfo.avsc +1 -1
  74. acryl_datahub_cloud/metadata/schemas/CorpUserInfo.avsc +18 -2
  75. acryl_datahub_cloud/metadata/schemas/CorpUserInvitationStatus.avsc +106 -0
  76. acryl_datahub_cloud/metadata/schemas/CorpUserKey.avsc +4 -1
  77. acryl_datahub_cloud/metadata/schemas/CorpUserSettings.avsc +304 -2
  78. acryl_datahub_cloud/metadata/schemas/CorpUserUsageFeatures.avsc +86 -0
  79. acryl_datahub_cloud/metadata/schemas/DashboardInfo.avsc +11 -5
  80. acryl_datahub_cloud/metadata/schemas/DashboardKey.avsc +1 -0
  81. acryl_datahub_cloud/metadata/schemas/DataFlowInfo.avsc +15 -5
  82. acryl_datahub_cloud/metadata/schemas/DataFlowKey.avsc +1 -0
  83. acryl_datahub_cloud/metadata/schemas/DataHubAiConversationInfo.avsc +256 -0
  84. acryl_datahub_cloud/metadata/schemas/DataHubAiConversationKey.avsc +22 -0
  85. acryl_datahub_cloud/metadata/schemas/DataHubFileInfo.avsc +234 -0
  86. acryl_datahub_cloud/metadata/schemas/DataHubFileKey.avsc +22 -0
  87. acryl_datahub_cloud/metadata/schemas/DataHubIngestionSourceKey.avsc +2 -1
  88. acryl_datahub_cloud/metadata/schemas/DataHubPageModuleKey.avsc +21 -0
  89. acryl_datahub_cloud/metadata/schemas/DataHubPageModuleProperties.avsc +308 -0
  90. acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateKey.avsc +21 -0
  91. acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateProperties.avsc +251 -0
  92. acryl_datahub_cloud/metadata/schemas/DataHubPolicyInfo.avsc +12 -1
  93. acryl_datahub_cloud/metadata/schemas/DataJobInfo.avsc +13 -4
  94. acryl_datahub_cloud/metadata/schemas/DataJobInputOutput.avsc +8 -0
  95. acryl_datahub_cloud/metadata/schemas/DataJobKey.avsc +1 -0
  96. acryl_datahub_cloud/metadata/schemas/DataPlatformInfo.avsc +3 -1
  97. acryl_datahub_cloud/metadata/schemas/DataPlatformInstanceProperties.avsc +5 -2
  98. acryl_datahub_cloud/metadata/schemas/DataProcessKey.avsc +4 -0
  99. acryl_datahub_cloud/metadata/schemas/DataProductKey.avsc +2 -0
  100. acryl_datahub_cloud/metadata/schemas/DataProductProperties.avsc +6 -3
  101. acryl_datahub_cloud/metadata/schemas/DataTypeInfo.avsc +5 -0
  102. acryl_datahub_cloud/metadata/schemas/DatasetKey.avsc +10 -2
  103. acryl_datahub_cloud/metadata/schemas/DatasetProperties.avsc +12 -5
  104. acryl_datahub_cloud/metadata/schemas/DatasetUsageStatistics.avsc +8 -0
  105. acryl_datahub_cloud/metadata/schemas/DocumentInfo.avsc +407 -0
  106. acryl_datahub_cloud/metadata/schemas/DocumentKey.avsc +35 -0
  107. acryl_datahub_cloud/metadata/schemas/DocumentSettings.avsc +79 -0
  108. acryl_datahub_cloud/metadata/schemas/DomainKey.avsc +2 -0
  109. acryl_datahub_cloud/metadata/schemas/DomainProperties.avsc +7 -3
  110. acryl_datahub_cloud/metadata/schemas/EditableContainerProperties.avsc +2 -1
  111. acryl_datahub_cloud/metadata/schemas/EditableDashboardProperties.avsc +2 -1
  112. acryl_datahub_cloud/metadata/schemas/EditableDataFlowProperties.avsc +2 -1
  113. acryl_datahub_cloud/metadata/schemas/EditableDataJobProperties.avsc +2 -1
  114. acryl_datahub_cloud/metadata/schemas/EditableDatasetProperties.avsc +2 -1
  115. acryl_datahub_cloud/metadata/schemas/EditableERModelRelationshipProperties.avsc +2 -1
  116. acryl_datahub_cloud/metadata/schemas/EditableMLFeatureProperties.avsc +2 -1
  117. acryl_datahub_cloud/metadata/schemas/EditableMLFeatureTableProperties.avsc +2 -1
  118. acryl_datahub_cloud/metadata/schemas/EditableMLModelGroupProperties.avsc +2 -1
  119. acryl_datahub_cloud/metadata/schemas/EditableMLModelProperties.avsc +2 -1
  120. acryl_datahub_cloud/metadata/schemas/EditableNotebookProperties.avsc +2 -1
  121. acryl_datahub_cloud/metadata/schemas/EditableSchemaMetadata.avsc +4 -2
  122. acryl_datahub_cloud/metadata/schemas/EntityTypeInfo.avsc +5 -0
  123. acryl_datahub_cloud/metadata/schemas/ExecutionRequestArtifactsLocation.avsc +16 -0
  124. acryl_datahub_cloud/metadata/schemas/ExecutionRequestKey.avsc +2 -1
  125. acryl_datahub_cloud/metadata/schemas/FormAssignmentStatus.avsc +36 -0
  126. acryl_datahub_cloud/metadata/schemas/FormInfo.avsc +6 -0
  127. acryl_datahub_cloud/metadata/schemas/FormKey.avsc +3 -1
  128. acryl_datahub_cloud/metadata/schemas/FormNotifications.avsc +69 -0
  129. acryl_datahub_cloud/metadata/schemas/FormSettings.avsc +30 -0
  130. acryl_datahub_cloud/metadata/schemas/GlobalSettingsInfo.avsc +416 -0
  131. acryl_datahub_cloud/metadata/schemas/GlobalTags.avsc +2 -1
  132. acryl_datahub_cloud/metadata/schemas/GlossaryNodeInfo.avsc +3 -1
  133. acryl_datahub_cloud/metadata/schemas/GlossaryNodeKey.avsc +1 -0
  134. acryl_datahub_cloud/metadata/schemas/GlossaryTermInfo.avsc +3 -1
  135. acryl_datahub_cloud/metadata/schemas/GlossaryTermKey.avsc +2 -0
  136. acryl_datahub_cloud/metadata/schemas/IcebergWarehouseInfo.avsc +4 -0
  137. acryl_datahub_cloud/metadata/schemas/IncidentActivityEvent.avsc +3 -3
  138. acryl_datahub_cloud/metadata/schemas/IncidentInfo.avsc +3 -3
  139. acryl_datahub_cloud/metadata/schemas/InferredMetadata.avsc +71 -1
  140. acryl_datahub_cloud/metadata/schemas/InputFields.avsc +2 -1
  141. acryl_datahub_cloud/metadata/schemas/InviteToken.avsc +26 -0
  142. acryl_datahub_cloud/metadata/schemas/LineageFeatures.avsc +67 -42
  143. acryl_datahub_cloud/metadata/schemas/LogicalParent.avsc +145 -0
  144. acryl_datahub_cloud/metadata/schemas/MLFeatureKey.avsc +4 -1
  145. acryl_datahub_cloud/metadata/schemas/MLFeatureTableKey.avsc +4 -1
  146. acryl_datahub_cloud/metadata/schemas/MLModelDeploymentKey.avsc +7 -1
  147. acryl_datahub_cloud/metadata/schemas/MLModelGroupKey.avsc +9 -1
  148. acryl_datahub_cloud/metadata/schemas/MLModelKey.avsc +9 -1
  149. acryl_datahub_cloud/metadata/schemas/MLModelProperties.avsc +4 -2
  150. acryl_datahub_cloud/metadata/schemas/MLPrimaryKeyKey.avsc +4 -1
  151. acryl_datahub_cloud/metadata/schemas/MetadataChangeEvent.avsc +418 -97
  152. acryl_datahub_cloud/metadata/schemas/MetadataChangeLog.avsc +62 -44
  153. acryl_datahub_cloud/metadata/schemas/MetadataChangeProposal.avsc +61 -0
  154. acryl_datahub_cloud/metadata/schemas/MonitorAnomalyEvent.avsc +54 -9
  155. acryl_datahub_cloud/metadata/schemas/MonitorInfo.avsc +163 -23
  156. acryl_datahub_cloud/metadata/schemas/MonitorKey.avsc +9 -1
  157. acryl_datahub_cloud/metadata/schemas/MonitorSuiteInfo.avsc +128 -3
  158. acryl_datahub_cloud/metadata/schemas/NotebookInfo.avsc +5 -2
  159. acryl_datahub_cloud/metadata/schemas/NotebookKey.avsc +1 -0
  160. acryl_datahub_cloud/metadata/schemas/NotificationRequest.avsc +91 -4
  161. acryl_datahub_cloud/metadata/schemas/Operation.avsc +17 -0
  162. acryl_datahub_cloud/metadata/schemas/Ownership.avsc +71 -1
  163. acryl_datahub_cloud/metadata/schemas/QuerySubjects.avsc +2 -13
  164. acryl_datahub_cloud/metadata/schemas/RelationshipChangeEvent.avsc +215 -0
  165. acryl_datahub_cloud/metadata/schemas/RoleProperties.avsc +3 -1
  166. acryl_datahub_cloud/metadata/schemas/SchemaFieldInfo.avsc +3 -1
  167. acryl_datahub_cloud/metadata/schemas/SchemaFieldKey.avsc +3 -0
  168. acryl_datahub_cloud/metadata/schemas/SchemaMetadata.avsc +2 -1
  169. acryl_datahub_cloud/metadata/schemas/SemanticContent.avsc +123 -0
  170. acryl_datahub_cloud/metadata/schemas/StructuredProperties.avsc +69 -0
  171. acryl_datahub_cloud/metadata/schemas/StructuredPropertyDefinition.avsc +15 -4
  172. acryl_datahub_cloud/metadata/schemas/StructuredPropertySettings.avsc +9 -0
  173. acryl_datahub_cloud/metadata/schemas/SubscriptionInfo.avsc +136 -5
  174. acryl_datahub_cloud/metadata/schemas/SubscriptionKey.avsc +2 -1
  175. acryl_datahub_cloud/metadata/schemas/SystemMetadata.avsc +61 -0
  176. acryl_datahub_cloud/metadata/schemas/TagProperties.avsc +3 -1
  177. acryl_datahub_cloud/metadata/schemas/TestInfo.avsc +2 -1
  178. acryl_datahub_cloud/metadata/schemas/UpstreamLineage.avsc +9 -0
  179. acryl_datahub_cloud/metadata/schemas/UsageFeatures.avsc +10 -0
  180. acryl_datahub_cloud/notifications/__init__.py +0 -0
  181. acryl_datahub_cloud/notifications/notification_recipient_builder.py +399 -0
  182. acryl_datahub_cloud/sdk/__init__.py +69 -0
  183. acryl_datahub_cloud/sdk/assertion/__init__.py +58 -0
  184. acryl_datahub_cloud/sdk/assertion/assertion_base.py +779 -0
  185. acryl_datahub_cloud/sdk/assertion/column_metric_assertion.py +191 -0
  186. acryl_datahub_cloud/sdk/assertion/column_value_assertion.py +431 -0
  187. acryl_datahub_cloud/sdk/assertion/freshness_assertion.py +201 -0
  188. acryl_datahub_cloud/sdk/assertion/schema_assertion.py +268 -0
  189. acryl_datahub_cloud/sdk/assertion/smart_column_metric_assertion.py +212 -0
  190. acryl_datahub_cloud/sdk/assertion/smart_freshness_assertion.py +165 -0
  191. acryl_datahub_cloud/sdk/assertion/smart_sql_assertion.py +156 -0
  192. acryl_datahub_cloud/sdk/assertion/smart_volume_assertion.py +162 -0
  193. acryl_datahub_cloud/sdk/assertion/sql_assertion.py +273 -0
  194. acryl_datahub_cloud/sdk/assertion/types.py +20 -0
  195. acryl_datahub_cloud/sdk/assertion/volume_assertion.py +156 -0
  196. acryl_datahub_cloud/sdk/assertion_client/__init__.py +0 -0
  197. acryl_datahub_cloud/sdk/assertion_client/column_metric.py +545 -0
  198. acryl_datahub_cloud/sdk/assertion_client/column_value.py +617 -0
  199. acryl_datahub_cloud/sdk/assertion_client/freshness.py +371 -0
  200. acryl_datahub_cloud/sdk/assertion_client/helpers.py +166 -0
  201. acryl_datahub_cloud/sdk/assertion_client/schema.py +358 -0
  202. acryl_datahub_cloud/sdk/assertion_client/smart_column_metric.py +540 -0
  203. acryl_datahub_cloud/sdk/assertion_client/smart_freshness.py +373 -0
  204. acryl_datahub_cloud/sdk/assertion_client/smart_sql.py +411 -0
  205. acryl_datahub_cloud/sdk/assertion_client/smart_volume.py +380 -0
  206. acryl_datahub_cloud/sdk/assertion_client/sql.py +410 -0
  207. acryl_datahub_cloud/sdk/assertion_client/volume.py +446 -0
  208. acryl_datahub_cloud/sdk/assertion_input/__init__.py +0 -0
  209. acryl_datahub_cloud/sdk/assertion_input/assertion_input.py +1470 -0
  210. acryl_datahub_cloud/sdk/assertion_input/column_assertion_constants.py +114 -0
  211. acryl_datahub_cloud/sdk/assertion_input/column_assertion_utils.py +284 -0
  212. acryl_datahub_cloud/sdk/assertion_input/column_metric_assertion_input.py +759 -0
  213. acryl_datahub_cloud/sdk/assertion_input/column_metric_constants.py +109 -0
  214. acryl_datahub_cloud/sdk/assertion_input/column_value_assertion_input.py +810 -0
  215. acryl_datahub_cloud/sdk/assertion_input/freshness_assertion_input.py +305 -0
  216. acryl_datahub_cloud/sdk/assertion_input/schema_assertion_input.py +413 -0
  217. acryl_datahub_cloud/sdk/assertion_input/smart_column_metric_assertion_input.py +793 -0
  218. acryl_datahub_cloud/sdk/assertion_input/smart_freshness_assertion_input.py +218 -0
  219. acryl_datahub_cloud/sdk/assertion_input/smart_sql_assertion_input.py +181 -0
  220. acryl_datahub_cloud/sdk/assertion_input/smart_volume_assertion_input.py +189 -0
  221. acryl_datahub_cloud/sdk/assertion_input/sql_assertion_input.py +320 -0
  222. acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +635 -0
  223. acryl_datahub_cloud/sdk/assertions_client.py +1074 -0
  224. acryl_datahub_cloud/sdk/entities/__init__.py +0 -0
  225. acryl_datahub_cloud/sdk/entities/assertion.py +439 -0
  226. acryl_datahub_cloud/sdk/entities/monitor.py +291 -0
  227. acryl_datahub_cloud/sdk/entities/subscription.py +100 -0
  228. acryl_datahub_cloud/sdk/errors.py +34 -0
  229. acryl_datahub_cloud/sdk/resolver_client.py +42 -0
  230. acryl_datahub_cloud/sdk/subscription_client.py +737 -0
  231. {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/METADATA +55 -49
  232. {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/RECORD +235 -142
  233. {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/WHEEL +1 -1
  234. {acryl_datahub_cloud-0.3.11rc0.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/entry_points.txt +1 -0
  235. acryl_datahub_cloud/_sdk_extras/__init__.py +0 -4
  236. acryl_datahub_cloud/_sdk_extras/assertion.py +0 -15
  237. acryl_datahub_cloud/_sdk_extras/assertions_client.py +0 -23
  238. {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,165 @@
1
+ import logging
2
+ from datetime import datetime
3
+ from typing import Optional, Union
4
+
5
+ from typing_extensions import Self
6
+
7
+ from acryl_datahub_cloud.sdk.assertion.assertion_base import (
8
+ AssertionMode,
9
+ _AssertionPublic,
10
+ _HasSchedule,
11
+ _HasSmartFunctionality,
12
+ )
13
+ from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
14
+ ASSERTION_MONITOR_DEFAULT_TRAINING_LOOKBACK_WINDOW_DAYS,
15
+ DEFAULT_DETECTION_MECHANISM,
16
+ DEFAULT_SCHEDULE,
17
+ DEFAULT_SENSITIVITY,
18
+ AssertionIncidentBehavior,
19
+ DetectionMechanism,
20
+ ExclusionWindowTypes,
21
+ InferenceSensitivity,
22
+ _DetectionMechanismTypes,
23
+ )
24
+ from acryl_datahub_cloud.sdk.entities.assertion import Assertion
25
+ from acryl_datahub_cloud.sdk.entities.monitor import Monitor
26
+ from acryl_datahub_cloud.sdk.errors import SDKNotYetSupportedError
27
+ from datahub.metadata import schema_classes as models
28
+ from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn, TagUrn
29
+
30
+ logger = logging.getLogger(__name__)
31
+
32
+
33
+ class SmartFreshnessAssertion(_HasSchedule, _HasSmartFunctionality, _AssertionPublic):
34
+ """
35
+ A class that represents a smart freshness assertion.
36
+ """
37
+
38
+ def __init__(
39
+ self,
40
+ *,
41
+ urn: AssertionUrn,
42
+ dataset_urn: DatasetUrn,
43
+ display_name: str,
44
+ mode: AssertionMode,
45
+ schedule: models.CronScheduleClass = DEFAULT_SCHEDULE,
46
+ sensitivity: InferenceSensitivity = DEFAULT_SENSITIVITY,
47
+ exclusion_windows: list[ExclusionWindowTypes],
48
+ training_data_lookback_days: int = ASSERTION_MONITOR_DEFAULT_TRAINING_LOOKBACK_WINDOW_DAYS,
49
+ incident_behavior: list[AssertionIncidentBehavior],
50
+ detection_mechanism: Optional[
51
+ _DetectionMechanismTypes
52
+ ] = DEFAULT_DETECTION_MECHANISM,
53
+ tags: list[TagUrn],
54
+ created_by: Optional[CorpUserUrn] = None,
55
+ created_at: Union[datetime, None] = None,
56
+ updated_by: Optional[CorpUserUrn] = None,
57
+ updated_at: Optional[datetime] = None,
58
+ ):
59
+ """
60
+ Initialize a smart freshness assertion.
61
+
62
+ Note: Values can be accessed, but not set on the assertion object.
63
+ To update an assertion, use the `upsert_*` method.
64
+ Args:
65
+ urn: The urn of the assertion.
66
+ dataset_urn: The urn of the dataset that the assertion is for.
67
+ display_name: The display name of the assertion.
68
+ mode: The mode of the assertion (active, inactive).
69
+ schedule: The schedule of the assertion.
70
+ sensitivity: The sensitivity of the assertion (low, medium, high).
71
+ exclusion_windows: The exclusion windows of the assertion.
72
+ training_data_lookback_days: The max number of days of data to use for training the assertion.
73
+ incident_behavior: Whether to raise or resolve an incident when the assertion fails / passes.
74
+ detection_mechanism: The detection mechanism of the assertion.
75
+ tags: The tags applied to the assertion.
76
+ created_by: The urn of the user that created the assertion.
77
+ created_at: The timestamp of when the assertion was created.
78
+ updated_by: The urn of the user that updated the assertion.
79
+ updated_at: The timestamp of when the assertion was updated.
80
+ """
81
+ # Initialize the mixins first
82
+ _HasSchedule.__init__(self, schedule=schedule)
83
+ _HasSmartFunctionality.__init__(
84
+ self,
85
+ sensitivity=sensitivity,
86
+ exclusion_windows=exclusion_windows,
87
+ training_data_lookback_days=training_data_lookback_days,
88
+ )
89
+ # Then initialize the parent class
90
+ _AssertionPublic.__init__(
91
+ self,
92
+ urn=urn,
93
+ dataset_urn=dataset_urn,
94
+ display_name=display_name,
95
+ mode=mode,
96
+ incident_behavior=incident_behavior,
97
+ detection_mechanism=detection_mechanism,
98
+ created_by=created_by,
99
+ created_at=created_at,
100
+ updated_by=updated_by,
101
+ updated_at=updated_at,
102
+ tags=tags,
103
+ )
104
+
105
+ @classmethod
106
+ def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
107
+ """
108
+ Create a smart freshness assertion from the assertion and monitor entities.
109
+
110
+ Note: This is a private method since it is intended to be called internally by the client.
111
+ """
112
+ return cls(
113
+ urn=assertion.urn,
114
+ dataset_urn=assertion.dataset,
115
+ display_name=assertion.description or "",
116
+ mode=cls._get_mode(monitor),
117
+ schedule=cls._get_schedule(monitor),
118
+ sensitivity=cls._get_sensitivity(monitor),
119
+ exclusion_windows=cls._get_exclusion_windows(monitor),
120
+ training_data_lookback_days=cls._get_training_data_lookback_days(monitor),
121
+ incident_behavior=cls._get_incident_behavior(assertion),
122
+ detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
123
+ created_by=cls._get_created_by(assertion),
124
+ created_at=cls._get_created_at(assertion),
125
+ updated_by=cls._get_updated_by(assertion),
126
+ updated_at=cls._get_updated_at(assertion),
127
+ tags=cls._get_tags(assertion),
128
+ )
129
+
130
+ @staticmethod
131
+ def _get_detection_mechanism(
132
+ assertion: Assertion,
133
+ monitor: Monitor,
134
+ default: Optional[_DetectionMechanismTypes] = DEFAULT_DETECTION_MECHANISM,
135
+ ) -> Optional[_DetectionMechanismTypes]:
136
+ """Get the detection mechanism for freshness assertions."""
137
+ parameters = _AssertionPublic._get_validated_detection_context(
138
+ monitor,
139
+ assertion,
140
+ models.AssertionEvaluationParametersTypeClass.DATASET_FRESHNESS,
141
+ models.FreshnessAssertionInfoClass,
142
+ default,
143
+ )
144
+ if parameters is None:
145
+ return default
146
+ if parameters.datasetFreshnessParameters is None:
147
+ logger.warning(
148
+ f"Monitor does not have datasetFreshnessParameters, defaulting detection mechanism to {DEFAULT_DETECTION_MECHANISM}"
149
+ )
150
+ return default
151
+ source_type = parameters.datasetFreshnessParameters.sourceType
152
+ if source_type == models.DatasetFreshnessSourceTypeClass.INFORMATION_SCHEMA:
153
+ return DetectionMechanism.INFORMATION_SCHEMA
154
+ elif source_type == models.DatasetFreshnessSourceTypeClass.AUDIT_LOG:
155
+ return DetectionMechanism.AUDIT_LOG
156
+ elif source_type == models.DatasetFreshnessSourceTypeClass.FIELD_VALUE:
157
+ return _AssertionPublic._get_field_value_detection_mechanism(
158
+ assertion, parameters
159
+ )
160
+ elif source_type == models.DatasetFreshnessSourceTypeClass.DATAHUB_OPERATION:
161
+ return DetectionMechanism.DATAHUB_OPERATION
162
+ elif source_type == models.DatasetFreshnessSourceTypeClass.FILE_METADATA:
163
+ raise SDKNotYetSupportedError("FILE_METADATA DatasetFreshnessSourceType")
164
+ else:
165
+ raise SDKNotYetSupportedError(f"DatasetFreshnessSourceType {source_type}")
@@ -0,0 +1,156 @@
1
+ """
2
+ Smart SQL Assertion class for DataHub.
3
+
4
+ This module contains the SmartSqlAssertion class that represents
5
+ a smart SQL assertion with AI-powered inference.
6
+ """
7
+
8
+ import logging
9
+ from datetime import datetime
10
+ from typing import Optional, Union
11
+
12
+ from typing_extensions import Self
13
+
14
+ from acryl_datahub_cloud.sdk.assertion.assertion_base import (
15
+ AssertionMode,
16
+ _AssertionPublic,
17
+ _HasSchedule,
18
+ _HasSmartFunctionality,
19
+ )
20
+ from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
21
+ DEFAULT_DAILY_SCHEDULE,
22
+ AssertionIncidentBehavior,
23
+ ExclusionWindowTypes,
24
+ InferenceSensitivity,
25
+ _DetectionMechanismTypes,
26
+ )
27
+ from acryl_datahub_cloud.sdk.entities.assertion import Assertion
28
+ from acryl_datahub_cloud.sdk.entities.monitor import Monitor
29
+ from acryl_datahub_cloud.sdk.errors import SDKNotYetSupportedError
30
+ from datahub.metadata import schema_classes as models
31
+ from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn, TagUrn
32
+
33
+ logger = logging.getLogger(__name__)
34
+
35
+
36
+ class SmartSqlAssertion(_AssertionPublic, _HasSchedule, _HasSmartFunctionality):
37
+ """
38
+ A class that represents a Smart SQL assertion with AI-powered inference.
39
+
40
+ Smart SQL assertions use machine learning to infer appropriate thresholds
41
+ for the SQL query result instead of requiring fixed threshold values.
42
+ """
43
+
44
+ def __init__(
45
+ self,
46
+ *,
47
+ urn: AssertionUrn,
48
+ dataset_urn: DatasetUrn,
49
+ display_name: str,
50
+ mode: AssertionMode,
51
+ statement: str,
52
+ schedule: models.CronScheduleClass,
53
+ sensitivity: InferenceSensitivity,
54
+ exclusion_windows: list[ExclusionWindowTypes],
55
+ training_data_lookback_days: int,
56
+ tags: list[TagUrn],
57
+ incident_behavior: list[AssertionIncidentBehavior],
58
+ created_by: Optional[CorpUserUrn] = None,
59
+ created_at: Union[datetime, None] = None,
60
+ updated_by: Optional[CorpUserUrn] = None,
61
+ updated_at: Optional[datetime] = None,
62
+ ):
63
+ """
64
+ Initialize a Smart SQL assertion.
65
+
66
+ Note: Values can be accessed, but not set on the assertion object.
67
+ To update an assertion, use the `sync_smart_sql_assertion` method.
68
+
69
+ Args:
70
+ urn: The urn of the assertion.
71
+ dataset_urn: The urn of the dataset that the assertion is for.
72
+ display_name: The display name of the assertion.
73
+ mode: The mode of the assertion (active, inactive).
74
+ statement: The SQL statement to be used for the assertion.
75
+ schedule: The schedule of the assertion.
76
+ sensitivity: The sensitivity level for AI inference (low, medium, high).
77
+ exclusion_windows: Time windows to exclude from assertion evaluation.
78
+ training_data_lookback_days: Number of days of data to use for training.
79
+ tags: The tags applied to the assertion.
80
+ incident_behavior: Whether to raise or resolve an incident when the assertion fails / passes.
81
+ created_by: The urn of the user that created the assertion.
82
+ created_at: The timestamp of when the assertion was created.
83
+ updated_by: The urn of the user that updated the assertion.
84
+ updated_at: The timestamp of when the assertion was updated.
85
+ """
86
+ # Initialize the mixins first
87
+ _AssertionPublic.__init__(
88
+ self,
89
+ urn=urn,
90
+ dataset_urn=dataset_urn,
91
+ display_name=display_name,
92
+ mode=mode,
93
+ tags=tags,
94
+ incident_behavior=incident_behavior,
95
+ created_by=created_by,
96
+ created_at=created_at,
97
+ updated_by=updated_by,
98
+ updated_at=updated_at,
99
+ )
100
+ _HasSchedule.__init__(self, schedule=schedule)
101
+ _HasSmartFunctionality.__init__(
102
+ self,
103
+ sensitivity=sensitivity,
104
+ exclusion_windows=exclusion_windows,
105
+ training_data_lookback_days=training_data_lookback_days,
106
+ )
107
+ self._statement = statement
108
+
109
+ @property
110
+ def statement(self) -> str:
111
+ return self._statement
112
+
113
+ @staticmethod
114
+ def _get_detection_mechanism(
115
+ assertion: Assertion,
116
+ monitor: Monitor,
117
+ default: Optional[_DetectionMechanismTypes] = None,
118
+ ) -> Optional[_DetectionMechanismTypes]:
119
+ """Smart SQL assertions do not have a detection mechanism."""
120
+ return None
121
+
122
+ @staticmethod
123
+ def _get_statement(assertion: Assertion) -> str:
124
+ if assertion.info is None:
125
+ raise SDKNotYetSupportedError(
126
+ f"Assertion {assertion.urn} does not have a SQL assertion info, which is not supported"
127
+ )
128
+ if isinstance(assertion.info, models.SqlAssertionInfoClass):
129
+ return assertion.info.statement
130
+ else:
131
+ raise SDKNotYetSupportedError(
132
+ f"Assertion {assertion.urn} is not a SQL assertion"
133
+ )
134
+
135
+ @classmethod
136
+ def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
137
+ """
138
+ Create a Smart SQL assertion from the assertion and monitor entities.
139
+ """
140
+ return cls(
141
+ urn=assertion.urn,
142
+ dataset_urn=assertion.dataset,
143
+ display_name=assertion.description or "",
144
+ mode=cls._get_mode(monitor),
145
+ statement=cls._get_statement(assertion),
146
+ schedule=cls._get_schedule(monitor, default=DEFAULT_DAILY_SCHEDULE),
147
+ sensitivity=cls._get_sensitivity(monitor),
148
+ exclusion_windows=cls._get_exclusion_windows(monitor),
149
+ training_data_lookback_days=cls._get_training_data_lookback_days(monitor),
150
+ tags=cls._get_tags(assertion),
151
+ incident_behavior=cls._get_incident_behavior(assertion),
152
+ created_by=cls._get_created_by(assertion),
153
+ created_at=cls._get_created_at(assertion),
154
+ updated_by=cls._get_updated_by(assertion),
155
+ updated_at=cls._get_updated_at(assertion),
156
+ )
@@ -0,0 +1,162 @@
1
+ import logging
2
+ from datetime import datetime
3
+ from typing import Optional, Union
4
+
5
+ from typing_extensions import Self
6
+
7
+ from acryl_datahub_cloud.sdk.assertion.assertion_base import (
8
+ AssertionMode,
9
+ _AssertionPublic,
10
+ _HasSchedule,
11
+ _HasSmartFunctionality,
12
+ )
13
+ from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
14
+ ASSERTION_MONITOR_DEFAULT_TRAINING_LOOKBACK_WINDOW_DAYS,
15
+ DEFAULT_DETECTION_MECHANISM,
16
+ DEFAULT_SENSITIVITY,
17
+ AssertionIncidentBehavior,
18
+ DetectionMechanism,
19
+ ExclusionWindowTypes,
20
+ InferenceSensitivity,
21
+ _DetectionMechanismTypes,
22
+ )
23
+ from acryl_datahub_cloud.sdk.entities.assertion import Assertion
24
+ from acryl_datahub_cloud.sdk.entities.monitor import Monitor
25
+ from acryl_datahub_cloud.sdk.errors import SDKNotYetSupportedError
26
+ from datahub.metadata import schema_classes as models
27
+ from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn, TagUrn
28
+
29
+ logger = logging.getLogger(__name__)
30
+
31
+
32
+ class SmartVolumeAssertion(_HasSchedule, _HasSmartFunctionality, _AssertionPublic):
33
+ """
34
+ A class that represents a smart volume assertion.
35
+ """
36
+
37
+ def __init__(
38
+ self,
39
+ *,
40
+ urn: AssertionUrn,
41
+ dataset_urn: DatasetUrn,
42
+ display_name: str,
43
+ mode: AssertionMode,
44
+ schedule: models.CronScheduleClass,
45
+ sensitivity: InferenceSensitivity = DEFAULT_SENSITIVITY,
46
+ exclusion_windows: list[ExclusionWindowTypes],
47
+ training_data_lookback_days: int = ASSERTION_MONITOR_DEFAULT_TRAINING_LOOKBACK_WINDOW_DAYS,
48
+ incident_behavior: list[AssertionIncidentBehavior],
49
+ detection_mechanism: Optional[
50
+ _DetectionMechanismTypes
51
+ ] = DEFAULT_DETECTION_MECHANISM,
52
+ tags: list[TagUrn],
53
+ created_by: Optional[CorpUserUrn] = None,
54
+ created_at: Union[datetime, None] = None,
55
+ updated_by: Optional[CorpUserUrn] = None,
56
+ updated_at: Optional[datetime] = None,
57
+ ):
58
+ """
59
+ Initialize a smart volume assertion.
60
+
61
+ Note: Values can be accessed, but not set on the assertion object.
62
+ To update an assertion, use the `upsert_*` method.
63
+ Args:
64
+ urn: The urn of the assertion.
65
+ dataset_urn: The urn of the dataset that the assertion is for.
66
+ display_name: The display name of the assertion.
67
+ mode: The mode of the assertion (active, inactive).
68
+ schedule: The schedule of the assertion.
69
+ sensitivity: The sensitivity of the assertion (low, medium, high).
70
+ exclusion_windows: The exclusion windows of the assertion.
71
+ training_data_lookback_days: The max number of days of data to use for training the assertion.
72
+ incident_behavior: Whether to raise or resolve an incident when the assertion fails / passes.
73
+ detection_mechanism: The detection mechanism of the assertion.
74
+ tags: The tags applied to the assertion.
75
+ created_by: The urn of the user that created the assertion.
76
+ created_at: The timestamp of when the assertion was created.
77
+ updated_by: The urn of the user that updated the assertion.
78
+ updated_at: The timestamp of when the assertion was updated.
79
+ """
80
+ # Initialize the mixins first
81
+ _HasSchedule.__init__(self, schedule=schedule)
82
+ _HasSmartFunctionality.__init__(
83
+ self,
84
+ sensitivity=sensitivity,
85
+ exclusion_windows=exclusion_windows,
86
+ training_data_lookback_days=training_data_lookback_days,
87
+ )
88
+ # Then initialize the parent class
89
+ _AssertionPublic.__init__(
90
+ self,
91
+ urn=urn,
92
+ dataset_urn=dataset_urn,
93
+ display_name=display_name,
94
+ mode=mode,
95
+ incident_behavior=incident_behavior,
96
+ detection_mechanism=detection_mechanism,
97
+ created_by=created_by,
98
+ created_at=created_at,
99
+ updated_by=updated_by,
100
+ updated_at=updated_at,
101
+ tags=tags,
102
+ )
103
+
104
+ @classmethod
105
+ def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
106
+ """
107
+ Create a smart freshness assertion from the assertion and monitor entities.
108
+
109
+ Note: This is a private method since it is intended to be called internally by the client.
110
+ """
111
+ return cls(
112
+ urn=assertion.urn,
113
+ dataset_urn=assertion.dataset,
114
+ display_name=assertion.description or "",
115
+ mode=cls._get_mode(monitor),
116
+ schedule=cls._get_schedule(monitor),
117
+ sensitivity=cls._get_sensitivity(monitor),
118
+ exclusion_windows=cls._get_exclusion_windows(monitor),
119
+ training_data_lookback_days=cls._get_training_data_lookback_days(monitor),
120
+ incident_behavior=cls._get_incident_behavior(assertion),
121
+ detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
122
+ created_by=cls._get_created_by(assertion),
123
+ created_at=cls._get_created_at(assertion),
124
+ updated_by=cls._get_updated_by(assertion),
125
+ updated_at=cls._get_updated_at(assertion),
126
+ tags=cls._get_tags(assertion),
127
+ )
128
+
129
+ @staticmethod
130
+ def _get_detection_mechanism(
131
+ assertion: Assertion,
132
+ monitor: Monitor,
133
+ default: Optional[_DetectionMechanismTypes] = DEFAULT_DETECTION_MECHANISM,
134
+ ) -> Optional[_DetectionMechanismTypes]:
135
+ """Get the detection mechanism for volume assertions."""
136
+ parameters = _AssertionPublic._get_validated_detection_context(
137
+ monitor,
138
+ assertion,
139
+ models.AssertionEvaluationParametersTypeClass.DATASET_VOLUME,
140
+ models.VolumeAssertionInfoClass,
141
+ default,
142
+ )
143
+ if parameters is None:
144
+ return default
145
+ if parameters.datasetVolumeParameters is None:
146
+ logger.warning(
147
+ f"Monitor does not have datasetVolumeParameters, defaulting detection mechanism to {DEFAULT_DETECTION_MECHANISM}"
148
+ )
149
+ if default is None:
150
+ return DEFAULT_DETECTION_MECHANISM
151
+ else:
152
+ return default
153
+ source_type = parameters.datasetVolumeParameters.sourceType
154
+ if source_type == models.DatasetVolumeSourceTypeClass.INFORMATION_SCHEMA:
155
+ return DetectionMechanism.INFORMATION_SCHEMA
156
+ elif source_type == models.DatasetVolumeSourceTypeClass.QUERY:
157
+ additional_filter = _AssertionPublic._get_additional_filter(assertion)
158
+ return DetectionMechanism.QUERY(additional_filter=additional_filter)
159
+ elif source_type == models.DatasetVolumeSourceTypeClass.DATAHUB_DATASET_PROFILE:
160
+ return DetectionMechanism.DATASET_PROFILE
161
+ else:
162
+ raise SDKNotYetSupportedError(f"DatasetVolumeSourceType {source_type}")