acryl-datahub-cloud 0.3.12rc6__py3-none-any.whl → 0.3.12rc7__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/metadata/_urns/urn_defs.py +1934 -1934
- acryl_datahub_cloud/metadata/schema.avsc +23968 -23968
- acryl_datahub_cloud/metadata/schema_classes.py +658 -658
- acryl_datahub_cloud/sdk/assertion/assertion_base.py +157 -24
- acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +630 -0
- acryl_datahub_cloud/sdk/assertions_client.py +529 -2
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc7.dist-info}/METADATA +41 -41
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc7.dist-info}/RECORD +12 -11
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc7.dist-info}/WHEEL +0 -0
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc7.dist-info}/entry_points.txt +0 -0
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc7.dist-info}/top_level.txt +0 -0
|
@@ -39,6 +39,10 @@ from acryl_datahub_cloud.sdk.assertion_input.smart_column_metric_assertion_input
|
|
|
39
39
|
from acryl_datahub_cloud.sdk.assertion_input.sql_assertion_input import (
|
|
40
40
|
SqlAssertionCriteria,
|
|
41
41
|
)
|
|
42
|
+
from acryl_datahub_cloud.sdk.assertion_input.volume_assertion_input import (
|
|
43
|
+
VolumeAssertionDefinition,
|
|
44
|
+
_VolumeAssertionDefinitionTypes,
|
|
45
|
+
)
|
|
42
46
|
from acryl_datahub_cloud.sdk.entities.assertion import Assertion
|
|
43
47
|
from acryl_datahub_cloud.sdk.entities.monitor import (
|
|
44
48
|
Monitor,
|
|
@@ -981,6 +985,135 @@ class SmartVolumeAssertion(_HasSchedule, _HasSmartFunctionality, _AssertionPubli
|
|
|
981
985
|
raise SDKNotYetSupportedError(f"DatasetVolumeSourceType {source_type}")
|
|
982
986
|
|
|
983
987
|
|
|
988
|
+
class VolumeAssertion(_HasSchedule, _AssertionPublic):
|
|
989
|
+
"""
|
|
990
|
+
A class that represents a volume assertion.
|
|
991
|
+
"""
|
|
992
|
+
|
|
993
|
+
def __init__(
|
|
994
|
+
self,
|
|
995
|
+
*,
|
|
996
|
+
urn: AssertionUrn,
|
|
997
|
+
dataset_urn: DatasetUrn,
|
|
998
|
+
display_name: str,
|
|
999
|
+
mode: AssertionMode,
|
|
1000
|
+
schedule: models.CronScheduleClass,
|
|
1001
|
+
definition: _VolumeAssertionDefinitionTypes,
|
|
1002
|
+
tags: list[TagUrn],
|
|
1003
|
+
incident_behavior: list[AssertionIncidentBehavior],
|
|
1004
|
+
detection_mechanism: Optional[
|
|
1005
|
+
_DetectionMechanismTypes
|
|
1006
|
+
] = DEFAULT_DETECTION_MECHANISM,
|
|
1007
|
+
created_by: Optional[CorpUserUrn] = None,
|
|
1008
|
+
created_at: Union[datetime, None] = None,
|
|
1009
|
+
updated_by: Optional[CorpUserUrn] = None,
|
|
1010
|
+
updated_at: Optional[datetime] = None,
|
|
1011
|
+
):
|
|
1012
|
+
"""
|
|
1013
|
+
Initialize a volume assertion.
|
|
1014
|
+
|
|
1015
|
+
Note: Values can be accessed, but not set on the assertion object.
|
|
1016
|
+
To update an assertion, use the `upsert_*` method.
|
|
1017
|
+
Args:
|
|
1018
|
+
urn: The urn of the assertion.
|
|
1019
|
+
dataset_urn: The urn of the dataset that the assertion is for.
|
|
1020
|
+
display_name: The display name of the assertion.
|
|
1021
|
+
mode: The mode of the assertion (active, inactive).
|
|
1022
|
+
schedule: The schedule of the assertion.
|
|
1023
|
+
definition: The volume assertion definition (RowCountTotal or RowCountChange).
|
|
1024
|
+
tags: The tags applied to the assertion.
|
|
1025
|
+
incident_behavior: Whether to raise or resolve an incident when the assertion fails / passes.
|
|
1026
|
+
detection_mechanism: The detection mechanism of the assertion.
|
|
1027
|
+
created_by: The urn of the user that created the assertion.
|
|
1028
|
+
created_at: The timestamp of when the assertion was created.
|
|
1029
|
+
updated_by: The urn of the user that updated the assertion.
|
|
1030
|
+
updated_at: The timestamp of when the assertion was updated.
|
|
1031
|
+
"""
|
|
1032
|
+
_HasSchedule.__init__(self, schedule=schedule)
|
|
1033
|
+
_AssertionPublic.__init__(
|
|
1034
|
+
self,
|
|
1035
|
+
urn=urn,
|
|
1036
|
+
dataset_urn=dataset_urn,
|
|
1037
|
+
display_name=display_name,
|
|
1038
|
+
mode=mode,
|
|
1039
|
+
incident_behavior=incident_behavior,
|
|
1040
|
+
detection_mechanism=detection_mechanism,
|
|
1041
|
+
created_by=created_by,
|
|
1042
|
+
created_at=created_at,
|
|
1043
|
+
updated_by=updated_by,
|
|
1044
|
+
updated_at=updated_at,
|
|
1045
|
+
tags=tags,
|
|
1046
|
+
)
|
|
1047
|
+
self._definition = definition
|
|
1048
|
+
|
|
1049
|
+
@property
|
|
1050
|
+
def definition(self) -> _VolumeAssertionDefinitionTypes:
|
|
1051
|
+
return self._definition
|
|
1052
|
+
|
|
1053
|
+
@staticmethod
|
|
1054
|
+
def _get_volume_definition(
|
|
1055
|
+
assertion: Assertion,
|
|
1056
|
+
) -> _VolumeAssertionDefinitionTypes:
|
|
1057
|
+
"""Get volume assertion definition from a DataHub assertion entity."""
|
|
1058
|
+
return VolumeAssertionDefinition.from_assertion(assertion)
|
|
1059
|
+
|
|
1060
|
+
@staticmethod
|
|
1061
|
+
def _get_detection_mechanism(
|
|
1062
|
+
assertion: Assertion,
|
|
1063
|
+
monitor: Monitor,
|
|
1064
|
+
default: Optional[_DetectionMechanismTypes] = DEFAULT_DETECTION_MECHANISM,
|
|
1065
|
+
) -> Optional[_DetectionMechanismTypes]:
|
|
1066
|
+
"""Get the detection mechanism for volume assertions."""
|
|
1067
|
+
parameters = _AssertionPublic._get_validated_detection_context(
|
|
1068
|
+
monitor,
|
|
1069
|
+
assertion,
|
|
1070
|
+
models.AssertionEvaluationParametersTypeClass.DATASET_VOLUME,
|
|
1071
|
+
models.VolumeAssertionInfoClass,
|
|
1072
|
+
default,
|
|
1073
|
+
)
|
|
1074
|
+
if parameters is None:
|
|
1075
|
+
return default
|
|
1076
|
+
if parameters.datasetVolumeParameters is None:
|
|
1077
|
+
logger.warning(
|
|
1078
|
+
f"Monitor does not have datasetVolumeParameters, defaulting detection mechanism to {DEFAULT_DETECTION_MECHANISM}"
|
|
1079
|
+
)
|
|
1080
|
+
if default is None:
|
|
1081
|
+
return DEFAULT_DETECTION_MECHANISM
|
|
1082
|
+
else:
|
|
1083
|
+
return default
|
|
1084
|
+
source_type = parameters.datasetVolumeParameters.sourceType
|
|
1085
|
+
if source_type == models.DatasetVolumeSourceTypeClass.INFORMATION_SCHEMA:
|
|
1086
|
+
return DetectionMechanism.INFORMATION_SCHEMA
|
|
1087
|
+
elif source_type == models.DatasetVolumeSourceTypeClass.QUERY:
|
|
1088
|
+
additional_filter = _AssertionPublic._get_additional_filter(assertion)
|
|
1089
|
+
return DetectionMechanism.QUERY(additional_filter=additional_filter)
|
|
1090
|
+
elif source_type == models.DatasetVolumeSourceTypeClass.DATAHUB_DATASET_PROFILE:
|
|
1091
|
+
return DetectionMechanism.DATASET_PROFILE
|
|
1092
|
+
else:
|
|
1093
|
+
raise SDKNotYetSupportedError(f"DatasetVolumeSourceType {source_type}")
|
|
1094
|
+
|
|
1095
|
+
@classmethod
|
|
1096
|
+
def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
|
|
1097
|
+
"""
|
|
1098
|
+
Create a volume assertion from the assertion and monitor entities.
|
|
1099
|
+
"""
|
|
1100
|
+
return cls(
|
|
1101
|
+
urn=assertion.urn,
|
|
1102
|
+
dataset_urn=assertion.dataset,
|
|
1103
|
+
display_name=assertion.description or "",
|
|
1104
|
+
mode=cls._get_mode(monitor),
|
|
1105
|
+
schedule=cls._get_schedule(monitor),
|
|
1106
|
+
definition=cls._get_volume_definition(assertion),
|
|
1107
|
+
incident_behavior=cls._get_incident_behavior(assertion),
|
|
1108
|
+
detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
|
|
1109
|
+
created_by=cls._get_created_by(assertion),
|
|
1110
|
+
created_at=cls._get_created_at(assertion),
|
|
1111
|
+
updated_by=cls._get_updated_by(assertion),
|
|
1112
|
+
updated_at=cls._get_updated_at(assertion),
|
|
1113
|
+
tags=cls._get_tags(assertion),
|
|
1114
|
+
)
|
|
1115
|
+
|
|
1116
|
+
|
|
984
1117
|
class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
985
1118
|
"""
|
|
986
1119
|
A class that represents a freshness assertion.
|
|
@@ -1095,30 +1228,6 @@ class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
|
1095
1228
|
f"Assertion {assertion.urn} is not a freshness assertion"
|
|
1096
1229
|
)
|
|
1097
1230
|
|
|
1098
|
-
@classmethod
|
|
1099
|
-
def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
|
|
1100
|
-
"""
|
|
1101
|
-
Create a freshness assertion from the assertion and monitor entities.
|
|
1102
|
-
"""
|
|
1103
|
-
return cls(
|
|
1104
|
-
urn=assertion.urn,
|
|
1105
|
-
dataset_urn=assertion.dataset,
|
|
1106
|
-
display_name=assertion.description or "",
|
|
1107
|
-
mode=cls._get_mode(monitor),
|
|
1108
|
-
schedule=cls._get_schedule(monitor),
|
|
1109
|
-
freshness_schedule_check_type=cls._get_freshness_schedule_check_type(
|
|
1110
|
-
assertion
|
|
1111
|
-
),
|
|
1112
|
-
lookback_window=cls._get_lookback_window(assertion),
|
|
1113
|
-
incident_behavior=cls._get_incident_behavior(assertion),
|
|
1114
|
-
detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
|
|
1115
|
-
created_by=cls._get_created_by(assertion),
|
|
1116
|
-
created_at=cls._get_created_at(assertion),
|
|
1117
|
-
updated_by=cls._get_updated_by(assertion),
|
|
1118
|
-
updated_at=cls._get_updated_at(assertion),
|
|
1119
|
-
tags=cls._get_tags(assertion),
|
|
1120
|
-
)
|
|
1121
|
-
|
|
1122
1231
|
@staticmethod
|
|
1123
1232
|
def _get_detection_mechanism(
|
|
1124
1233
|
assertion: Assertion,
|
|
@@ -1156,6 +1265,30 @@ class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
|
1156
1265
|
else:
|
|
1157
1266
|
raise SDKNotYetSupportedError(f"DatasetFreshnessSourceType {source_type}")
|
|
1158
1267
|
|
|
1268
|
+
@classmethod
|
|
1269
|
+
def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
|
|
1270
|
+
"""
|
|
1271
|
+
Create a freshness assertion from the assertion and monitor entities.
|
|
1272
|
+
"""
|
|
1273
|
+
return cls(
|
|
1274
|
+
urn=assertion.urn,
|
|
1275
|
+
dataset_urn=assertion.dataset,
|
|
1276
|
+
display_name=assertion.description or "",
|
|
1277
|
+
mode=cls._get_mode(monitor),
|
|
1278
|
+
schedule=cls._get_schedule(monitor),
|
|
1279
|
+
freshness_schedule_check_type=cls._get_freshness_schedule_check_type(
|
|
1280
|
+
assertion
|
|
1281
|
+
),
|
|
1282
|
+
lookback_window=cls._get_lookback_window(assertion),
|
|
1283
|
+
incident_behavior=cls._get_incident_behavior(assertion),
|
|
1284
|
+
detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
|
|
1285
|
+
created_by=cls._get_created_by(assertion),
|
|
1286
|
+
created_at=cls._get_created_at(assertion),
|
|
1287
|
+
updated_by=cls._get_updated_by(assertion),
|
|
1288
|
+
updated_at=cls._get_updated_at(assertion),
|
|
1289
|
+
tags=cls._get_tags(assertion),
|
|
1290
|
+
)
|
|
1291
|
+
|
|
1159
1292
|
|
|
1160
1293
|
class SqlAssertion(_AssertionPublic, _HasSchedule):
|
|
1161
1294
|
"""
|