acryl-datahub-cloud 0.3.10rc4__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 (243) hide show
  1. acryl_datahub_cloud/_codegen_config.json +1 -1
  2. acryl_datahub_cloud/acryl_cs_issues/acryl_customer.py +1 -1
  3. acryl_datahub_cloud/acryl_cs_issues/models.py +5 -3
  4. acryl_datahub_cloud/action_request/action_request_owner_source.py +37 -8
  5. acryl_datahub_cloud/datahub_forms_notifications/__init__.py +0 -0
  6. acryl_datahub_cloud/datahub_forms_notifications/forms_notifications_source.py +569 -0
  7. acryl_datahub_cloud/datahub_forms_notifications/get_feature_flag.gql +7 -0
  8. acryl_datahub_cloud/datahub_forms_notifications/get_search_results_total.gql +14 -0
  9. acryl_datahub_cloud/datahub_forms_notifications/query.py +17 -0
  10. acryl_datahub_cloud/datahub_forms_notifications/scroll_forms_for_notification.gql +29 -0
  11. acryl_datahub_cloud/datahub_forms_notifications/send_form_notification_request.gql +5 -0
  12. acryl_datahub_cloud/datahub_reporting/datahub_dataset.py +39 -19
  13. acryl_datahub_cloud/datahub_reporting/datahub_form_reporting.py +60 -25
  14. acryl_datahub_cloud/datahub_reporting/extract_graph.py +9 -3
  15. acryl_datahub_cloud/datahub_reporting/extract_sql.py +248 -52
  16. acryl_datahub_cloud/datahub_reporting/forms.py +1 -1
  17. acryl_datahub_cloud/datahub_reporting/forms_config.py +3 -2
  18. acryl_datahub_cloud/datahub_restore/source.py +3 -2
  19. acryl_datahub_cloud/datahub_usage_reporting/excluded.py +94 -0
  20. acryl_datahub_cloud/datahub_usage_reporting/query_builder.py +48 -8
  21. acryl_datahub_cloud/datahub_usage_reporting/usage_feature_reporter.py +532 -109
  22. acryl_datahub_cloud/elasticsearch/graph_service.py +76 -14
  23. acryl_datahub_cloud/graphql_utils.py +64 -0
  24. acryl_datahub_cloud/lineage_features/source.py +555 -49
  25. acryl_datahub_cloud/metadata/_urns/urn_defs.py +2390 -1938
  26. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/actionworkflow/__init__.py +53 -0
  27. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/anomaly/__init__.py +2 -0
  28. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/application/__init__.py +19 -0
  29. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/assertion/__init__.py +6 -2
  30. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/common/__init__.py +6 -0
  31. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/conversation/__init__.py +29 -0
  32. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/event/notification/settings/__init__.py +2 -0
  33. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/execution/__init__.py +2 -0
  34. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/file/__init__.py +19 -0
  35. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/form/__init__.py +8 -0
  36. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/identity/__init__.py +8 -0
  37. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/knowledge/__init__.py +33 -0
  38. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/logical/__init__.py +15 -0
  39. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/key/__init__.py +14 -0
  40. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/metadata/search/features/__init__.py +2 -0
  41. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/module/__init__.py +31 -0
  42. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/monitor/__init__.py +6 -0
  43. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/notification/__init__.py +19 -0
  44. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/platform/event/v1/__init__.py +4 -0
  45. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/role/__init__.py +2 -0
  46. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/asset/__init__.py +19 -0
  47. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/settings/global/__init__.py +28 -0
  48. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/template/__init__.py +31 -0
  49. acryl_datahub_cloud/metadata/schema.avsc +27843 -23200
  50. acryl_datahub_cloud/metadata/schema_classes.py +29901 -24310
  51. acryl_datahub_cloud/metadata/schemas/ActionRequestInfo.avsc +235 -2
  52. acryl_datahub_cloud/metadata/schemas/ActionWorkflowInfo.avsc +683 -0
  53. acryl_datahub_cloud/metadata/schemas/ActionWorkflowKey.avsc +21 -0
  54. acryl_datahub_cloud/metadata/schemas/Actors.avsc +38 -1
  55. acryl_datahub_cloud/metadata/schemas/ApplicationKey.avsc +31 -0
  56. acryl_datahub_cloud/metadata/schemas/ApplicationProperties.avsc +75 -0
  57. acryl_datahub_cloud/metadata/schemas/Applications.avsc +38 -0
  58. acryl_datahub_cloud/metadata/schemas/AssertionAnalyticsRunEvent.avsc +375 -212
  59. acryl_datahub_cloud/metadata/schemas/AssertionInfo.avsc +147 -20
  60. acryl_datahub_cloud/metadata/schemas/AssertionKey.avsc +1 -1
  61. acryl_datahub_cloud/metadata/schemas/AssertionRunEvent.avsc +191 -21
  62. acryl_datahub_cloud/metadata/schemas/{AssertionSummary.avsc → AssertionRunSummary.avsc} +15 -2
  63. acryl_datahub_cloud/metadata/schemas/AssertionsSummary.avsc +54 -0
  64. acryl_datahub_cloud/metadata/schemas/AssetSettings.avsc +63 -0
  65. acryl_datahub_cloud/metadata/schemas/BusinessAttributeInfo.avsc +7 -3
  66. acryl_datahub_cloud/metadata/schemas/ChartInfo.avsc +20 -6
  67. acryl_datahub_cloud/metadata/schemas/ChartKey.avsc +1 -0
  68. acryl_datahub_cloud/metadata/schemas/ConstraintInfo.avsc +12 -1
  69. acryl_datahub_cloud/metadata/schemas/ContainerKey.avsc +1 -0
  70. acryl_datahub_cloud/metadata/schemas/ContainerProperties.avsc +16 -5
  71. acryl_datahub_cloud/metadata/schemas/CorpGroupEditableInfo.avsc +2 -1
  72. acryl_datahub_cloud/metadata/schemas/CorpGroupInfo.avsc +7 -3
  73. acryl_datahub_cloud/metadata/schemas/CorpGroupKey.avsc +2 -1
  74. acryl_datahub_cloud/metadata/schemas/CorpGroupSettings.avsc +127 -2
  75. acryl_datahub_cloud/metadata/schemas/CorpUserEditableInfo.avsc +1 -1
  76. acryl_datahub_cloud/metadata/schemas/CorpUserInfo.avsc +18 -2
  77. acryl_datahub_cloud/metadata/schemas/CorpUserInvitationStatus.avsc +106 -0
  78. acryl_datahub_cloud/metadata/schemas/CorpUserKey.avsc +4 -1
  79. acryl_datahub_cloud/metadata/schemas/CorpUserSettings.avsc +304 -2
  80. acryl_datahub_cloud/metadata/schemas/CorpUserUsageFeatures.avsc +86 -0
  81. acryl_datahub_cloud/metadata/schemas/DashboardInfo.avsc +11 -5
  82. acryl_datahub_cloud/metadata/schemas/DashboardKey.avsc +1 -0
  83. acryl_datahub_cloud/metadata/schemas/DataContractKey.avsc +2 -1
  84. acryl_datahub_cloud/metadata/schemas/DataFlowInfo.avsc +15 -5
  85. acryl_datahub_cloud/metadata/schemas/DataFlowKey.avsc +1 -0
  86. acryl_datahub_cloud/metadata/schemas/DataHubAiConversationInfo.avsc +256 -0
  87. acryl_datahub_cloud/metadata/schemas/DataHubAiConversationKey.avsc +22 -0
  88. acryl_datahub_cloud/metadata/schemas/DataHubFileInfo.avsc +234 -0
  89. acryl_datahub_cloud/metadata/schemas/DataHubFileKey.avsc +22 -0
  90. acryl_datahub_cloud/metadata/schemas/DataHubIngestionSourceKey.avsc +2 -1
  91. acryl_datahub_cloud/metadata/schemas/DataHubOpenAPISchemaKey.avsc +22 -0
  92. acryl_datahub_cloud/metadata/schemas/DataHubPageModuleKey.avsc +21 -0
  93. acryl_datahub_cloud/metadata/schemas/DataHubPageModuleProperties.avsc +308 -0
  94. acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateKey.avsc +21 -0
  95. acryl_datahub_cloud/metadata/schemas/DataHubPageTemplateProperties.avsc +251 -0
  96. acryl_datahub_cloud/metadata/schemas/DataHubPolicyInfo.avsc +12 -1
  97. acryl_datahub_cloud/metadata/schemas/DataJobInfo.avsc +13 -4
  98. acryl_datahub_cloud/metadata/schemas/DataJobInputOutput.avsc +8 -0
  99. acryl_datahub_cloud/metadata/schemas/DataJobKey.avsc +1 -0
  100. acryl_datahub_cloud/metadata/schemas/DataPlatformInfo.avsc +3 -1
  101. acryl_datahub_cloud/metadata/schemas/DataPlatformInstanceProperties.avsc +5 -2
  102. acryl_datahub_cloud/metadata/schemas/DataProcessKey.avsc +4 -0
  103. acryl_datahub_cloud/metadata/schemas/DataProductKey.avsc +2 -0
  104. acryl_datahub_cloud/metadata/schemas/DataProductProperties.avsc +6 -3
  105. acryl_datahub_cloud/metadata/schemas/DataTransformLogic.avsc +4 -2
  106. acryl_datahub_cloud/metadata/schemas/DataTypeInfo.avsc +5 -0
  107. acryl_datahub_cloud/metadata/schemas/DatasetKey.avsc +10 -2
  108. acryl_datahub_cloud/metadata/schemas/DatasetProperties.avsc +12 -5
  109. acryl_datahub_cloud/metadata/schemas/DatasetUsageStatistics.avsc +8 -0
  110. acryl_datahub_cloud/metadata/schemas/DocumentInfo.avsc +407 -0
  111. acryl_datahub_cloud/metadata/schemas/DocumentKey.avsc +35 -0
  112. acryl_datahub_cloud/metadata/schemas/DocumentSettings.avsc +79 -0
  113. acryl_datahub_cloud/metadata/schemas/DomainKey.avsc +2 -0
  114. acryl_datahub_cloud/metadata/schemas/DomainProperties.avsc +7 -3
  115. acryl_datahub_cloud/metadata/schemas/EditableContainerProperties.avsc +2 -1
  116. acryl_datahub_cloud/metadata/schemas/EditableDashboardProperties.avsc +2 -1
  117. acryl_datahub_cloud/metadata/schemas/EditableDataFlowProperties.avsc +2 -1
  118. acryl_datahub_cloud/metadata/schemas/EditableDataJobProperties.avsc +2 -1
  119. acryl_datahub_cloud/metadata/schemas/EditableDatasetProperties.avsc +2 -1
  120. acryl_datahub_cloud/metadata/schemas/EditableERModelRelationshipProperties.avsc +2 -1
  121. acryl_datahub_cloud/metadata/schemas/EditableMLFeatureProperties.avsc +2 -1
  122. acryl_datahub_cloud/metadata/schemas/EditableMLFeatureTableProperties.avsc +2 -1
  123. acryl_datahub_cloud/metadata/schemas/EditableMLModelGroupProperties.avsc +2 -1
  124. acryl_datahub_cloud/metadata/schemas/EditableMLModelProperties.avsc +2 -1
  125. acryl_datahub_cloud/metadata/schemas/EditableNotebookProperties.avsc +2 -1
  126. acryl_datahub_cloud/metadata/schemas/EditableSchemaMetadata.avsc +4 -2
  127. acryl_datahub_cloud/metadata/schemas/EntityTypeInfo.avsc +5 -0
  128. acryl_datahub_cloud/metadata/schemas/ExecutionRequestArtifactsLocation.avsc +16 -0
  129. acryl_datahub_cloud/metadata/schemas/ExecutionRequestKey.avsc +2 -1
  130. acryl_datahub_cloud/metadata/schemas/FormAssignmentStatus.avsc +36 -0
  131. acryl_datahub_cloud/metadata/schemas/FormInfo.avsc +6 -0
  132. acryl_datahub_cloud/metadata/schemas/FormKey.avsc +3 -1
  133. acryl_datahub_cloud/metadata/schemas/FormNotifications.avsc +69 -0
  134. acryl_datahub_cloud/metadata/schemas/FormSettings.avsc +30 -0
  135. acryl_datahub_cloud/metadata/schemas/GlobalSettingsInfo.avsc +416 -0
  136. acryl_datahub_cloud/metadata/schemas/GlobalTags.avsc +2 -1
  137. acryl_datahub_cloud/metadata/schemas/GlossaryNodeInfo.avsc +3 -1
  138. acryl_datahub_cloud/metadata/schemas/GlossaryNodeKey.avsc +1 -0
  139. acryl_datahub_cloud/metadata/schemas/GlossaryTermInfo.avsc +3 -1
  140. acryl_datahub_cloud/metadata/schemas/GlossaryTermKey.avsc +2 -0
  141. acryl_datahub_cloud/metadata/schemas/IcebergWarehouseInfo.avsc +4 -0
  142. acryl_datahub_cloud/metadata/schemas/IncidentActivityEvent.avsc +3 -3
  143. acryl_datahub_cloud/metadata/schemas/IncidentInfo.avsc +3 -3
  144. acryl_datahub_cloud/metadata/schemas/InferredMetadata.avsc +71 -1
  145. acryl_datahub_cloud/metadata/schemas/InputFields.avsc +2 -1
  146. acryl_datahub_cloud/metadata/schemas/InviteToken.avsc +26 -0
  147. acryl_datahub_cloud/metadata/schemas/LineageFeatures.avsc +67 -42
  148. acryl_datahub_cloud/metadata/schemas/LogicalParent.avsc +145 -0
  149. acryl_datahub_cloud/metadata/schemas/MLFeatureKey.avsc +4 -1
  150. acryl_datahub_cloud/metadata/schemas/MLFeatureTableKey.avsc +4 -1
  151. acryl_datahub_cloud/metadata/schemas/MLModelDeploymentKey.avsc +7 -1
  152. acryl_datahub_cloud/metadata/schemas/MLModelDeploymentProperties.avsc +3 -0
  153. acryl_datahub_cloud/metadata/schemas/MLModelGroupKey.avsc +9 -1
  154. acryl_datahub_cloud/metadata/schemas/MLModelKey.avsc +9 -1
  155. acryl_datahub_cloud/metadata/schemas/MLModelProperties.avsc +4 -2
  156. acryl_datahub_cloud/metadata/schemas/MLPrimaryKeyKey.avsc +4 -1
  157. acryl_datahub_cloud/metadata/schemas/MetadataChangeEvent.avsc +424 -97
  158. acryl_datahub_cloud/metadata/schemas/MetadataChangeLog.avsc +65 -44
  159. acryl_datahub_cloud/metadata/schemas/MetadataChangeProposal.avsc +64 -0
  160. acryl_datahub_cloud/metadata/schemas/MonitorAnomalyEvent.avsc +84 -29
  161. acryl_datahub_cloud/metadata/schemas/MonitorInfo.avsc +221 -23
  162. acryl_datahub_cloud/metadata/schemas/MonitorKey.avsc +9 -1
  163. acryl_datahub_cloud/metadata/schemas/MonitorSuiteInfo.avsc +128 -3
  164. acryl_datahub_cloud/metadata/schemas/NotebookInfo.avsc +5 -2
  165. acryl_datahub_cloud/metadata/schemas/NotebookKey.avsc +1 -0
  166. acryl_datahub_cloud/metadata/schemas/NotificationRequest.avsc +91 -4
  167. acryl_datahub_cloud/metadata/schemas/Operation.avsc +17 -0
  168. acryl_datahub_cloud/metadata/schemas/Ownership.avsc +71 -1
  169. acryl_datahub_cloud/metadata/schemas/QueryProperties.avsc +4 -2
  170. acryl_datahub_cloud/metadata/schemas/QuerySubjects.avsc +2 -13
  171. acryl_datahub_cloud/metadata/schemas/RelationshipChangeEvent.avsc +215 -0
  172. acryl_datahub_cloud/metadata/schemas/RoleProperties.avsc +3 -1
  173. acryl_datahub_cloud/metadata/schemas/SchemaFieldInfo.avsc +3 -1
  174. acryl_datahub_cloud/metadata/schemas/SchemaFieldKey.avsc +3 -0
  175. acryl_datahub_cloud/metadata/schemas/SchemaMetadata.avsc +2 -1
  176. acryl_datahub_cloud/metadata/schemas/SemanticContent.avsc +123 -0
  177. acryl_datahub_cloud/metadata/schemas/StructuredProperties.avsc +69 -0
  178. acryl_datahub_cloud/metadata/schemas/StructuredPropertyDefinition.avsc +15 -4
  179. acryl_datahub_cloud/metadata/schemas/StructuredPropertySettings.avsc +9 -0
  180. acryl_datahub_cloud/metadata/schemas/SubscriptionInfo.avsc +136 -5
  181. acryl_datahub_cloud/metadata/schemas/SubscriptionKey.avsc +2 -1
  182. acryl_datahub_cloud/metadata/schemas/SystemMetadata.avsc +147 -0
  183. acryl_datahub_cloud/metadata/schemas/TagProperties.avsc +3 -1
  184. acryl_datahub_cloud/metadata/schemas/TestInfo.avsc +2 -1
  185. acryl_datahub_cloud/metadata/schemas/UpstreamLineage.avsc +9 -0
  186. acryl_datahub_cloud/metadata/schemas/UsageFeatures.avsc +10 -0
  187. acryl_datahub_cloud/metadata/schemas/__init__.py +3 -3
  188. acryl_datahub_cloud/notifications/__init__.py +0 -0
  189. acryl_datahub_cloud/notifications/notification_recipient_builder.py +399 -0
  190. acryl_datahub_cloud/sdk/__init__.py +69 -0
  191. acryl_datahub_cloud/sdk/assertion/__init__.py +58 -0
  192. acryl_datahub_cloud/sdk/assertion/assertion_base.py +779 -0
  193. acryl_datahub_cloud/sdk/assertion/column_metric_assertion.py +191 -0
  194. acryl_datahub_cloud/sdk/assertion/column_value_assertion.py +431 -0
  195. acryl_datahub_cloud/sdk/assertion/freshness_assertion.py +201 -0
  196. acryl_datahub_cloud/sdk/assertion/schema_assertion.py +268 -0
  197. acryl_datahub_cloud/sdk/assertion/smart_column_metric_assertion.py +212 -0
  198. acryl_datahub_cloud/sdk/assertion/smart_freshness_assertion.py +165 -0
  199. acryl_datahub_cloud/sdk/assertion/smart_sql_assertion.py +156 -0
  200. acryl_datahub_cloud/sdk/assertion/smart_volume_assertion.py +162 -0
  201. acryl_datahub_cloud/sdk/assertion/sql_assertion.py +273 -0
  202. acryl_datahub_cloud/sdk/assertion/types.py +20 -0
  203. acryl_datahub_cloud/sdk/assertion/volume_assertion.py +156 -0
  204. acryl_datahub_cloud/sdk/assertion_client/__init__.py +0 -0
  205. acryl_datahub_cloud/sdk/assertion_client/column_metric.py +545 -0
  206. acryl_datahub_cloud/sdk/assertion_client/column_value.py +617 -0
  207. acryl_datahub_cloud/sdk/assertion_client/freshness.py +371 -0
  208. acryl_datahub_cloud/sdk/assertion_client/helpers.py +166 -0
  209. acryl_datahub_cloud/sdk/assertion_client/schema.py +358 -0
  210. acryl_datahub_cloud/sdk/assertion_client/smart_column_metric.py +540 -0
  211. acryl_datahub_cloud/sdk/assertion_client/smart_freshness.py +373 -0
  212. acryl_datahub_cloud/sdk/assertion_client/smart_sql.py +411 -0
  213. acryl_datahub_cloud/sdk/assertion_client/smart_volume.py +380 -0
  214. acryl_datahub_cloud/sdk/assertion_client/sql.py +410 -0
  215. acryl_datahub_cloud/sdk/assertion_client/volume.py +446 -0
  216. acryl_datahub_cloud/sdk/assertion_input/__init__.py +0 -0
  217. acryl_datahub_cloud/sdk/assertion_input/assertion_input.py +1470 -0
  218. acryl_datahub_cloud/sdk/assertion_input/column_assertion_constants.py +114 -0
  219. acryl_datahub_cloud/sdk/assertion_input/column_assertion_utils.py +284 -0
  220. acryl_datahub_cloud/sdk/assertion_input/column_metric_assertion_input.py +759 -0
  221. acryl_datahub_cloud/sdk/assertion_input/column_metric_constants.py +109 -0
  222. acryl_datahub_cloud/sdk/assertion_input/column_value_assertion_input.py +810 -0
  223. acryl_datahub_cloud/sdk/assertion_input/freshness_assertion_input.py +305 -0
  224. acryl_datahub_cloud/sdk/assertion_input/schema_assertion_input.py +413 -0
  225. acryl_datahub_cloud/sdk/assertion_input/smart_column_metric_assertion_input.py +793 -0
  226. acryl_datahub_cloud/sdk/assertion_input/smart_freshness_assertion_input.py +218 -0
  227. acryl_datahub_cloud/sdk/assertion_input/smart_sql_assertion_input.py +181 -0
  228. acryl_datahub_cloud/sdk/assertion_input/smart_volume_assertion_input.py +189 -0
  229. acryl_datahub_cloud/sdk/assertion_input/sql_assertion_input.py +320 -0
  230. acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +635 -0
  231. acryl_datahub_cloud/sdk/assertions_client.py +1074 -0
  232. acryl_datahub_cloud/sdk/entities/__init__.py +0 -0
  233. acryl_datahub_cloud/sdk/entities/assertion.py +439 -0
  234. acryl_datahub_cloud/sdk/entities/monitor.py +291 -0
  235. acryl_datahub_cloud/sdk/entities/subscription.py +100 -0
  236. acryl_datahub_cloud/sdk/errors.py +34 -0
  237. acryl_datahub_cloud/sdk/resolver_client.py +42 -0
  238. acryl_datahub_cloud/sdk/subscription_client.py +737 -0
  239. {acryl_datahub_cloud-0.3.10rc4.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/METADATA +49 -43
  240. {acryl_datahub_cloud-0.3.10rc4.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/RECORD +243 -145
  241. {acryl_datahub_cloud-0.3.10rc4.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/WHEEL +1 -1
  242. {acryl_datahub_cloud-0.3.10rc4.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/entry_points.txt +1 -0
  243. {acryl_datahub_cloud-0.3.10rc4.dist-info → acryl_datahub_cloud-0.3.16.1rc0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,371 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ from datetime import datetime, timezone
5
+ from typing import TYPE_CHECKING, Optional, Union
6
+
7
+ from acryl_datahub_cloud.sdk.assertion.assertion_base import (
8
+ AssertionMode,
9
+ FreshnessAssertion,
10
+ )
11
+ from acryl_datahub_cloud.sdk.assertion_client.helpers import (
12
+ DEFAULT_CREATED_BY,
13
+ _merge_field,
14
+ _print_experimental_warning,
15
+ retrieve_assertion_and_monitor_by_urn,
16
+ )
17
+ from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
18
+ AssertionIncidentBehaviorInputTypes,
19
+ DetectionMechanismInputTypes,
20
+ TimeWindowSizeInputTypes,
21
+ )
22
+ from acryl_datahub_cloud.sdk.assertion_input.freshness_assertion_input import (
23
+ FreshnessAssertionScheduleCheckType,
24
+ _FreshnessAssertionInput,
25
+ )
26
+ from acryl_datahub_cloud.sdk.entities.assertion import Assertion, TagsInputType
27
+ from acryl_datahub_cloud.sdk.entities.monitor import Monitor
28
+ from acryl_datahub_cloud.sdk.errors import SDKUsageError
29
+ from datahub.metadata import schema_classes as models
30
+ from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn, MonitorUrn
31
+
32
+ if TYPE_CHECKING:
33
+ from datahub.sdk.main_client import DataHubClient
34
+
35
+ logger = logging.getLogger(__name__)
36
+
37
+
38
+ class FreshnessAssertionClient:
39
+ """Client for managing freshness assertions."""
40
+
41
+ def __init__(self, client: "DataHubClient"):
42
+ self.client = client
43
+
44
+ def sync_freshness_assertion(
45
+ self,
46
+ *,
47
+ dataset_urn: Union[str, DatasetUrn],
48
+ urn: Optional[Union[str, AssertionUrn]] = None,
49
+ display_name: Optional[str] = None,
50
+ enabled: Optional[bool] = None,
51
+ detection_mechanism: DetectionMechanismInputTypes = None,
52
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
53
+ tags: Optional[TagsInputType] = None,
54
+ updated_by: Optional[Union[str, CorpUserUrn]] = None,
55
+ freshness_schedule_check_type: Optional[
56
+ Union[
57
+ str,
58
+ FreshnessAssertionScheduleCheckType,
59
+ models.FreshnessAssertionScheduleTypeClass,
60
+ ]
61
+ ] = None,
62
+ schedule: Optional[Union[str, models.CronScheduleClass]] = None,
63
+ lookback_window: Optional[TimeWindowSizeInputTypes] = None,
64
+ ) -> FreshnessAssertion:
65
+ _print_experimental_warning()
66
+ now_utc = datetime.now(timezone.utc)
67
+
68
+ if updated_by is None:
69
+ logger.warning(
70
+ f"updated_by is not set, using {DEFAULT_CREATED_BY} as a placeholder"
71
+ )
72
+ updated_by = DEFAULT_CREATED_BY
73
+
74
+ # 1. Retrieve and merge the assertion input with any existing assertion and monitor entities,
75
+ # or build a new assertion input if the assertion does not exist:
76
+ assertion_input = self._retrieve_and_merge_freshness_assertion_and_monitor(
77
+ dataset_urn=dataset_urn,
78
+ urn=urn,
79
+ display_name=display_name,
80
+ enabled=enabled,
81
+ detection_mechanism=detection_mechanism,
82
+ incident_behavior=incident_behavior,
83
+ tags=tags,
84
+ updated_by=updated_by,
85
+ now_utc=now_utc,
86
+ schedule=schedule,
87
+ freshness_schedule_check_type=freshness_schedule_check_type,
88
+ lookback_window=lookback_window,
89
+ )
90
+
91
+ # 2. Upsert the assertion and monitor entities:
92
+ assertion_entity, monitor_entity = (
93
+ assertion_input.to_assertion_and_monitor_entities()
94
+ )
95
+ # If assertion upsert fails, we won't try to upsert the monitor
96
+ self.client.entities.upsert(assertion_entity)
97
+ # TODO: Wrap monitor upsert in a try-except and delete the assertion if monitor upsert fails (once delete is implemented https://linear.app/acryl-data/issue/OBS-1350/add-delete-method-to-entity-clientpy)
98
+ # try:
99
+ self.client.entities.upsert(monitor_entity)
100
+ # except Exception as e:
101
+ # logger.error(f"Error upserting monitor: {e}")
102
+ # self.client.entities.delete(assertion_entity)
103
+ # raise e
104
+
105
+ return FreshnessAssertion._from_entities(assertion_entity, monitor_entity)
106
+
107
+ def _retrieve_and_merge_freshness_assertion_and_monitor(
108
+ self,
109
+ dataset_urn: Union[str, DatasetUrn],
110
+ urn: Optional[Union[str, AssertionUrn]],
111
+ display_name: Optional[str],
112
+ enabled: Optional[bool],
113
+ detection_mechanism: DetectionMechanismInputTypes,
114
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
115
+ tags: Optional[TagsInputType],
116
+ updated_by: Union[str, CorpUserUrn],
117
+ now_utc: datetime,
118
+ schedule: Optional[Union[str, models.CronScheduleClass]],
119
+ freshness_schedule_check_type: Optional[
120
+ Union[str, models.FreshnessAssertionScheduleTypeClass]
121
+ ] = None,
122
+ lookback_window: Optional[TimeWindowSizeInputTypes] = None,
123
+ ) -> _FreshnessAssertionInput:
124
+ # 1. If urn is not provided, build and return a new assertion input directly
125
+ if urn is None:
126
+ logger.info("URN is not set, building a new assertion input")
127
+ return _FreshnessAssertionInput(
128
+ urn=None,
129
+ entity_client=self.client.entities,
130
+ dataset_urn=dataset_urn,
131
+ display_name=display_name,
132
+ enabled=enabled if enabled is not None else True,
133
+ detection_mechanism=detection_mechanism,
134
+ freshness_schedule_check_type=freshness_schedule_check_type,
135
+ lookback_window=lookback_window,
136
+ incident_behavior=incident_behavior,
137
+ tags=tags,
138
+ created_by=updated_by,
139
+ created_at=now_utc,
140
+ updated_by=updated_by,
141
+ updated_at=now_utc,
142
+ schedule=schedule,
143
+ )
144
+
145
+ # 2. Build initial assertion input for validation
146
+ assertion_input = _FreshnessAssertionInput(
147
+ urn=urn,
148
+ entity_client=self.client.entities,
149
+ dataset_urn=dataset_urn,
150
+ display_name=display_name,
151
+ detection_mechanism=detection_mechanism,
152
+ freshness_schedule_check_type=freshness_schedule_check_type,
153
+ lookback_window=lookback_window,
154
+ incident_behavior=incident_behavior,
155
+ tags=tags,
156
+ created_by=updated_by, # This will be overridden by the actual created_by
157
+ created_at=now_utc, # This will be overridden by the actual created_at
158
+ updated_by=updated_by,
159
+ updated_at=now_utc,
160
+ schedule=schedule,
161
+ )
162
+
163
+ # 3. Retrieve any existing assertion and monitor entities:
164
+ maybe_assertion_entity, monitor_urn, maybe_monitor_entity = (
165
+ self._retrieve_assertion_and_monitor(assertion_input)
166
+ )
167
+
168
+ # 4.1 If the assertion and monitor entities exist, create an assertion object from them:
169
+ if maybe_assertion_entity and maybe_monitor_entity:
170
+ existing_assertion = FreshnessAssertion._from_entities(
171
+ maybe_assertion_entity, maybe_monitor_entity
172
+ )
173
+ # 4.2 If the assertion exists but the monitor does not, create a placeholder monitor entity to be able to create the assertion:
174
+ elif maybe_assertion_entity and not maybe_monitor_entity:
175
+ monitor_mode = (
176
+ "ACTIVE" if enabled else "INACTIVE" if enabled is not None else "ACTIVE"
177
+ )
178
+ existing_assertion = FreshnessAssertion._from_entities(
179
+ maybe_assertion_entity,
180
+ Monitor(id=monitor_urn, info=("ASSERTION", monitor_mode)),
181
+ )
182
+ # 4.3 If the assertion does not exist, build and return a new assertion input:
183
+ elif not maybe_assertion_entity:
184
+ logger.info(
185
+ f"No existing assertion entity found for assertion urn {urn}, building a new assertion input"
186
+ )
187
+ return _FreshnessAssertionInput(
188
+ urn=urn,
189
+ entity_client=self.client.entities,
190
+ dataset_urn=dataset_urn,
191
+ display_name=display_name,
192
+ enabled=enabled if enabled is not None else True,
193
+ detection_mechanism=detection_mechanism,
194
+ freshness_schedule_check_type=freshness_schedule_check_type,
195
+ lookback_window=lookback_window,
196
+ incident_behavior=incident_behavior,
197
+ tags=tags,
198
+ created_by=updated_by,
199
+ created_at=now_utc,
200
+ updated_by=updated_by,
201
+ updated_at=now_utc,
202
+ schedule=schedule,
203
+ )
204
+
205
+ # 5. Check for any issues e.g. different dataset urns
206
+ if (
207
+ existing_assertion
208
+ and hasattr(existing_assertion, "dataset_urn")
209
+ and existing_assertion.dataset_urn != assertion_input.dataset_urn
210
+ ):
211
+ raise SDKUsageError(
212
+ f"Dataset URN mismatch, existing assertion: {existing_assertion.dataset_urn} != new assertion: {dataset_urn}"
213
+ )
214
+
215
+ # 6. Merge the existing assertion with the validated input:
216
+ merged_assertion_input = self._merge_freshness_input(
217
+ dataset_urn=dataset_urn,
218
+ urn=urn,
219
+ display_name=display_name,
220
+ enabled=enabled,
221
+ detection_mechanism=detection_mechanism,
222
+ incident_behavior=incident_behavior,
223
+ tags=tags,
224
+ now_utc=now_utc,
225
+ assertion_input=assertion_input,
226
+ maybe_assertion_entity=maybe_assertion_entity,
227
+ maybe_monitor_entity=maybe_monitor_entity,
228
+ existing_assertion=existing_assertion,
229
+ schedule=schedule,
230
+ freshness_schedule_check_type=freshness_schedule_check_type,
231
+ lookback_window=lookback_window,
232
+ )
233
+
234
+ return merged_assertion_input
235
+
236
+ def _retrieve_assertion_and_monitor(
237
+ self,
238
+ assertion_input: _FreshnessAssertionInput,
239
+ ) -> tuple[Optional[Assertion], MonitorUrn, Optional[Monitor]]:
240
+ """Retrieve the assertion and monitor entities from the DataHub instance.
241
+
242
+ Args:
243
+ assertion_input: The validated input to the function.
244
+
245
+ Returns:
246
+ The assertion and monitor entities.
247
+ """
248
+ assert assertion_input.urn is not None, "URN is required"
249
+ return retrieve_assertion_and_monitor_by_urn(
250
+ self.client, assertion_input.urn, assertion_input.dataset_urn
251
+ )
252
+
253
+ def _merge_freshness_input(
254
+ self,
255
+ dataset_urn: Union[str, DatasetUrn],
256
+ urn: Union[str, AssertionUrn],
257
+ display_name: Optional[str],
258
+ enabled: Optional[bool],
259
+ detection_mechanism: DetectionMechanismInputTypes,
260
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
261
+ tags: Optional[TagsInputType],
262
+ now_utc: datetime,
263
+ assertion_input: _FreshnessAssertionInput,
264
+ maybe_assertion_entity: Optional[Assertion],
265
+ maybe_monitor_entity: Optional[Monitor],
266
+ existing_assertion: FreshnessAssertion,
267
+ schedule: Optional[Union[str, models.CronScheduleClass]],
268
+ freshness_schedule_check_type: Optional[
269
+ Union[str, models.FreshnessAssertionScheduleTypeClass]
270
+ ] = None,
271
+ lookback_window: Optional[TimeWindowSizeInputTypes] = None,
272
+ ) -> _FreshnessAssertionInput:
273
+ """Merge the input with the existing assertion and monitor entities.
274
+
275
+ Args:
276
+ dataset_urn: The urn of the dataset to be monitored.
277
+ urn: The urn of the assertion.
278
+ display_name: The display name of the assertion.
279
+ enabled: Whether the assertion is enabled.
280
+ incident_behavior: The incident behavior to be applied to the assertion.
281
+ tags: The tags to be applied to the assertion.
282
+ now_utc: The current UTC time from when the function is called.
283
+ assertion_input: The validated input to the function.
284
+ maybe_assertion_entity: The existing assertion entity from the DataHub instance.
285
+ maybe_monitor_entity: The existing monitor entity from the DataHub instance.
286
+ existing_assertion: The existing assertion from the DataHub instance.
287
+ schedule: The schedule to be applied to the assertion.
288
+ freshness_schedule_check_type: The freshness schedule check type to be applied to the assertion.
289
+ lookback_window: The lookback window to be applied to the assertion.
290
+
291
+ Returns:
292
+ The merged assertion input.
293
+ """
294
+ merged_assertion_input = _FreshnessAssertionInput(
295
+ urn=urn,
296
+ entity_client=self.client.entities,
297
+ dataset_urn=dataset_urn,
298
+ display_name=_merge_field(
299
+ display_name,
300
+ "display_name",
301
+ assertion_input,
302
+ existing_assertion,
303
+ maybe_assertion_entity.description if maybe_assertion_entity else None,
304
+ ),
305
+ enabled=_merge_field(
306
+ enabled,
307
+ "enabled",
308
+ assertion_input,
309
+ existing_assertion,
310
+ existing_assertion.mode == AssertionMode.ACTIVE
311
+ if existing_assertion
312
+ else None,
313
+ ),
314
+ schedule=_merge_field(
315
+ schedule,
316
+ "schedule",
317
+ assertion_input,
318
+ existing_assertion,
319
+ existing_assertion.schedule if existing_assertion else None,
320
+ ),
321
+ freshness_schedule_check_type=_merge_field(
322
+ freshness_schedule_check_type,
323
+ "freshness_schedule_check_type",
324
+ assertion_input,
325
+ existing_assertion,
326
+ existing_assertion._freshness_schedule_check_type
327
+ if existing_assertion
328
+ else None,
329
+ ),
330
+ lookback_window=_merge_field(
331
+ lookback_window,
332
+ "lookback_window",
333
+ assertion_input,
334
+ existing_assertion,
335
+ existing_assertion.lookback_window if existing_assertion else None,
336
+ ),
337
+ detection_mechanism=_merge_field(
338
+ detection_mechanism,
339
+ "detection_mechanism",
340
+ assertion_input,
341
+ existing_assertion,
342
+ FreshnessAssertion._get_detection_mechanism(
343
+ maybe_assertion_entity, maybe_monitor_entity, default=None
344
+ )
345
+ if maybe_assertion_entity and maybe_monitor_entity
346
+ else None,
347
+ ),
348
+ incident_behavior=_merge_field(
349
+ incident_behavior,
350
+ "incident_behavior",
351
+ assertion_input,
352
+ existing_assertion,
353
+ FreshnessAssertion._get_incident_behavior(maybe_assertion_entity)
354
+ if maybe_assertion_entity
355
+ else None,
356
+ ),
357
+ tags=_merge_field(
358
+ tags,
359
+ "tags",
360
+ assertion_input,
361
+ existing_assertion,
362
+ maybe_assertion_entity.tags if maybe_assertion_entity else None,
363
+ ),
364
+ created_by=existing_assertion.created_by
365
+ or DEFAULT_CREATED_BY, # Override with the existing assertion's created_by or the default created_by if not set
366
+ created_at=existing_assertion.created_at
367
+ or now_utc, # Override with the existing assertion's created_at or now if not set
368
+ updated_by=assertion_input.updated_by, # Override with the input's updated_by
369
+ updated_at=assertion_input.updated_at, # Override with the input's updated_at (now)
370
+ )
371
+ return merged_assertion_input
@@ -0,0 +1,166 @@
1
+ """Helper utilities for assertion clients."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from typing import TYPE_CHECKING, Any, Optional, Union
7
+
8
+ from acryl_datahub_cloud.sdk.assertion.assertion_base import _AssertionPublic
9
+ from acryl_datahub_cloud.sdk.assertion_input.assertion_input import _AssertionInput
10
+ from acryl_datahub_cloud.sdk.entities.assertion import Assertion
11
+ from acryl_datahub_cloud.sdk.entities.monitor import Monitor
12
+ from acryl_datahub_cloud.sdk.errors import SDKUsageError
13
+ from datahub.errors import ItemNotFoundError
14
+ from datahub.metadata.urns import AssertionUrn, CorpUserUrn, DatasetUrn, MonitorUrn
15
+ from datahub.sdk.search_filters import FilterDsl
16
+
17
+ if TYPE_CHECKING:
18
+ from datahub.sdk.main_client import DataHubClient
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+ # TODO: Replace __datahub_system with the actual datahub system user https://linear.app/acryl-data/issue/OBS-1351/auditstamp-actor-hydration-pattern-for-sdk-calls
23
+ DEFAULT_CREATED_BY = CorpUserUrn.from_string("urn:li:corpuser:__datahub_system")
24
+
25
+
26
+ def _merge_field(
27
+ input_field_value: Any,
28
+ input_field_name: str,
29
+ validated_assertion_input: _AssertionInput,
30
+ validated_existing_assertion: _AssertionPublic,
31
+ existing_entity_value: Optional[Any] = None, # TODO: Can we do better than Any?
32
+ ) -> Any:
33
+ """Merge the input field value with any existing entity value or default value.
34
+
35
+ The merge logic is as follows:
36
+ - If the input is None, use the existing value
37
+ - If the input is not None, use the input value
38
+ - If the input is an empty list or empty string, still use the input value (falsy values can be used to unset fields)
39
+ - If the input is a non-empty list or non-empty string, use the input value
40
+ - If the input is None and the existing value is None, use the default value from _AssertionInput
41
+
42
+ Args:
43
+ input_field_value: The value of the field in the input e.g. passed to the function.
44
+ input_field_name: The name of the field in the input.
45
+ validated_assertion_input: The *validated* input to the function.
46
+ validated_existing_assertion: The *validated* existing assertion from the DataHub instance.
47
+ existing_entity_value: The value of the field in the existing entity from the DataHub instance, directly retrieved from the entity.
48
+
49
+ Returns:
50
+ The merged value of the field.
51
+
52
+ """
53
+ if input_field_value is None: # Input value default
54
+ if existing_entity_value is not None: # Existing entity value set
55
+ return existing_entity_value
56
+ elif (
57
+ getattr(validated_existing_assertion, input_field_name) is None
58
+ ): # Validated existing value not set
59
+ return getattr(validated_assertion_input, input_field_name)
60
+ else: # Validated existing value set
61
+ return getattr(validated_existing_assertion, input_field_name)
62
+ else: # Input value set
63
+ return input_field_value
64
+
65
+
66
+ def _print_experimental_warning() -> None:
67
+ print(
68
+ "Warning: The assertions client is experimental and under heavy development. Expect breaking changes."
69
+ )
70
+
71
+
72
+ def _validate_required_field(
73
+ field_value: Optional[Any], field_name: str, context: str
74
+ ) -> None:
75
+ """Validate that a required field is not None and raise SDKUsageError if it is."""
76
+ if field_value is None:
77
+ raise SDKUsageError(f"{field_name} is required {context}")
78
+
79
+
80
+ def resolve_updated_by(
81
+ updated_by: Optional[Union[str, CorpUserUrn]],
82
+ ) -> Union[str, CorpUserUrn]:
83
+ """Resolve the updated_by field, using DEFAULT_CREATED_BY if not provided.
84
+
85
+ Args:
86
+ updated_by: The updated_by value from the user input, or None.
87
+
88
+ Returns:
89
+ The resolved updated_by value.
90
+ """
91
+ if updated_by is None:
92
+ logger.warning(
93
+ f"updated_by is not set, using {DEFAULT_CREATED_BY} as a placeholder"
94
+ )
95
+ return DEFAULT_CREATED_BY
96
+ return updated_by
97
+
98
+
99
+ def retrieve_assertion_and_monitor_by_urn(
100
+ client: "DataHubClient",
101
+ assertion_urn: Union[str, AssertionUrn],
102
+ dataset_urn: Union[str, DatasetUrn],
103
+ ) -> tuple[Optional[Assertion], MonitorUrn, Optional[Monitor]]:
104
+ """Retrieve the assertion and monitor entities from the DataHub instance by URN.
105
+
106
+ Args:
107
+ client: The DataHub client.
108
+ assertion_urn: The assertion URN.
109
+ dataset_urn: The dataset URN.
110
+
111
+ Returns:
112
+ A tuple of (assertion entity or None, monitor URN, monitor entity or None).
113
+ """
114
+ urn: AssertionUrn = (
115
+ assertion_urn
116
+ if isinstance(assertion_urn, AssertionUrn)
117
+ else AssertionUrn.from_string(assertion_urn)
118
+ )
119
+ _dataset_urn: DatasetUrn = (
120
+ dataset_urn
121
+ if isinstance(dataset_urn, DatasetUrn)
122
+ else DatasetUrn.from_string(dataset_urn)
123
+ )
124
+
125
+ # Get assertion entity
126
+ maybe_assertion_entity: Optional[Assertion] = None
127
+ try:
128
+ entity = client.entities.get(urn)
129
+ if entity is not None:
130
+ assert isinstance(entity, Assertion)
131
+ maybe_assertion_entity = entity
132
+ except ItemNotFoundError:
133
+ pass
134
+
135
+ # Get monitor entity by searching for monitors where assertionUrn equals the assertion urn
136
+ monitor_urn: Optional[MonitorUrn] = None
137
+ maybe_monitor_entity: Optional[Monitor] = None
138
+ try:
139
+ # Search for monitor entities with assertionUrn matching the assertion urn
140
+ monitor_filter = FilterDsl.and_(
141
+ FilterDsl.entity_type("monitor"),
142
+ FilterDsl.custom_filter("assertionUrn", "EQUAL", [str(urn)]),
143
+ )
144
+ monitor_urns = list(client.search.get_urns(filter=monitor_filter))
145
+
146
+ if monitor_urns:
147
+ # Log if there are multiple monitors found, because this is unexpected
148
+ if len(monitor_urns) > 1:
149
+ logger.warning(
150
+ f"Multiple monitors found for assertion {urn}, which should never happen: {monitor_urns}"
151
+ )
152
+ # Use the first matching monitor
153
+ monitor_urn = MonitorUrn.from_string(str(monitor_urns[0]))
154
+ entity = client.entities.get(monitor_urn)
155
+ if entity is not None:
156
+ assert isinstance(entity, Monitor)
157
+ maybe_monitor_entity = entity
158
+ except ItemNotFoundError as e:
159
+ logger.debug(f"Could not find monitor for assertion {urn}: {e}")
160
+ pass
161
+
162
+ # If no monitor found via search, fall back to creating a new monitor with the dataset urn and assertion urn
163
+ if monitor_urn is None:
164
+ monitor_urn = Monitor._ensure_id(id=(_dataset_urn, urn))
165
+
166
+ return maybe_assertion_entity, monitor_urn, maybe_monitor_entity