acryl-datahub-cloud 0.3.12rc6__py3-none-any.whl → 0.3.12rc8__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/datahub_forms_notifications/forms_notifications_source.py +13 -3
- acryl_datahub_cloud/metadata/_urns/urn_defs.py +1856 -1856
- acryl_datahub_cloud/metadata/schema.avsc +23385 -23855
- acryl_datahub_cloud/metadata/schema_classes.py +644 -644
- acryl_datahub_cloud/metadata/schemas/ConstraintInfo.avsc +1 -1
- acryl_datahub_cloud/metadata/schemas/DataHubPolicyInfo.avsc +1 -1
- acryl_datahub_cloud/metadata/schemas/MetadataChangeEvent.avsc +1 -1
- acryl_datahub_cloud/metadata/schemas/SubscriptionKey.avsc +2 -1
- acryl_datahub_cloud/sdk/assertion/assertion_base.py +176 -26
- acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +650 -0
- acryl_datahub_cloud/sdk/assertions_client.py +685 -45
- acryl_datahub_cloud/sdk/subscription_client.py +47 -11
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc8.dist-info}/METADATA +35 -35
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc8.dist-info}/RECORD +18 -17
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc8.dist-info}/WHEEL +0 -0
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc8.dist-info}/entry_points.txt +0 -0
- {acryl_datahub_cloud-0.3.12rc6.dist-info → acryl_datahub_cloud-0.3.12rc8.dist-info}/top_level.txt +0 -0
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"null",
|
|
137
137
|
"com.linkedin.pegasus2avro.policy.PolicyMatchFilter"
|
|
138
138
|
],
|
|
139
|
-
"name": "
|
|
139
|
+
"name": "privilegeConstraints",
|
|
140
140
|
"default": null,
|
|
141
141
|
"doc": "Constraints around what sub-resources operations are allowed to modify, i.e. NOT_EQUALS - cannot modify a particular defined tag, EQUALS - can only modify a particular defined tag, STARTS_WITH - can only modify a tag starting with xyz"
|
|
142
142
|
}
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"null",
|
|
147
147
|
"com.linkedin.pegasus2avro.policy.PolicyMatchFilter"
|
|
148
148
|
],
|
|
149
|
-
"name": "
|
|
149
|
+
"name": "privilegeConstraints",
|
|
150
150
|
"default": null,
|
|
151
151
|
"doc": "Constraints around what sub-resources operations are allowed to modify, i.e. NOT_EQUALS - cannot modify a particular defined tag, EQUALS - can only modify a particular defined tag, STARTS_WITH - can only modify a tag starting with xyz"
|
|
152
152
|
}
|
|
@@ -8668,7 +8668,7 @@
|
|
|
8668
8668
|
"null",
|
|
8669
8669
|
"com.linkedin.pegasus2avro.policy.PolicyMatchFilter"
|
|
8670
8670
|
],
|
|
8671
|
-
"name": "
|
|
8671
|
+
"name": "privilegeConstraints",
|
|
8672
8672
|
"default": null,
|
|
8673
8673
|
"doc": "Constraints around what sub-resources operations are allowed to modify, i.e. NOT_EQUALS - cannot modify a particular defined tag, EQUALS - can only modify a particular defined tag, STARTS_WITH - can only modify a tag starting with xyz"
|
|
8674
8674
|
}
|
|
@@ -37,7 +37,14 @@ from acryl_datahub_cloud.sdk.assertion_input.smart_column_metric_assertion_input
|
|
|
37
37
|
ValueTypeInputType,
|
|
38
38
|
)
|
|
39
39
|
from acryl_datahub_cloud.sdk.assertion_input.sql_assertion_input import (
|
|
40
|
+
SqlAssertionChangeType,
|
|
40
41
|
SqlAssertionCriteria,
|
|
42
|
+
SqlAssertionOperator,
|
|
43
|
+
SqlAssertionType,
|
|
44
|
+
)
|
|
45
|
+
from acryl_datahub_cloud.sdk.assertion_input.volume_assertion_input import (
|
|
46
|
+
VolumeAssertionDefinition,
|
|
47
|
+
_VolumeAssertionDefinitionTypes,
|
|
41
48
|
)
|
|
42
49
|
from acryl_datahub_cloud.sdk.entities.assertion import Assertion
|
|
43
50
|
from acryl_datahub_cloud.sdk.entities.monitor import (
|
|
@@ -981,6 +988,135 @@ class SmartVolumeAssertion(_HasSchedule, _HasSmartFunctionality, _AssertionPubli
|
|
|
981
988
|
raise SDKNotYetSupportedError(f"DatasetVolumeSourceType {source_type}")
|
|
982
989
|
|
|
983
990
|
|
|
991
|
+
class VolumeAssertion(_HasSchedule, _AssertionPublic):
|
|
992
|
+
"""
|
|
993
|
+
A class that represents a volume assertion.
|
|
994
|
+
"""
|
|
995
|
+
|
|
996
|
+
def __init__(
|
|
997
|
+
self,
|
|
998
|
+
*,
|
|
999
|
+
urn: AssertionUrn,
|
|
1000
|
+
dataset_urn: DatasetUrn,
|
|
1001
|
+
display_name: str,
|
|
1002
|
+
mode: AssertionMode,
|
|
1003
|
+
schedule: models.CronScheduleClass,
|
|
1004
|
+
definition: _VolumeAssertionDefinitionTypes,
|
|
1005
|
+
tags: list[TagUrn],
|
|
1006
|
+
incident_behavior: list[AssertionIncidentBehavior],
|
|
1007
|
+
detection_mechanism: Optional[
|
|
1008
|
+
_DetectionMechanismTypes
|
|
1009
|
+
] = DEFAULT_DETECTION_MECHANISM,
|
|
1010
|
+
created_by: Optional[CorpUserUrn] = None,
|
|
1011
|
+
created_at: Union[datetime, None] = None,
|
|
1012
|
+
updated_by: Optional[CorpUserUrn] = None,
|
|
1013
|
+
updated_at: Optional[datetime] = None,
|
|
1014
|
+
):
|
|
1015
|
+
"""
|
|
1016
|
+
Initialize a volume assertion.
|
|
1017
|
+
|
|
1018
|
+
Note: Values can be accessed, but not set on the assertion object.
|
|
1019
|
+
To update an assertion, use the `upsert_*` method.
|
|
1020
|
+
Args:
|
|
1021
|
+
urn: The urn of the assertion.
|
|
1022
|
+
dataset_urn: The urn of the dataset that the assertion is for.
|
|
1023
|
+
display_name: The display name of the assertion.
|
|
1024
|
+
mode: The mode of the assertion (active, inactive).
|
|
1025
|
+
schedule: The schedule of the assertion.
|
|
1026
|
+
definition: The volume assertion definition (RowCountTotal or RowCountChange).
|
|
1027
|
+
tags: The tags applied to the assertion.
|
|
1028
|
+
incident_behavior: Whether to raise or resolve an incident when the assertion fails / passes.
|
|
1029
|
+
detection_mechanism: The detection mechanism of the assertion.
|
|
1030
|
+
created_by: The urn of the user that created the assertion.
|
|
1031
|
+
created_at: The timestamp of when the assertion was created.
|
|
1032
|
+
updated_by: The urn of the user that updated the assertion.
|
|
1033
|
+
updated_at: The timestamp of when the assertion was updated.
|
|
1034
|
+
"""
|
|
1035
|
+
_HasSchedule.__init__(self, schedule=schedule)
|
|
1036
|
+
_AssertionPublic.__init__(
|
|
1037
|
+
self,
|
|
1038
|
+
urn=urn,
|
|
1039
|
+
dataset_urn=dataset_urn,
|
|
1040
|
+
display_name=display_name,
|
|
1041
|
+
mode=mode,
|
|
1042
|
+
incident_behavior=incident_behavior,
|
|
1043
|
+
detection_mechanism=detection_mechanism,
|
|
1044
|
+
created_by=created_by,
|
|
1045
|
+
created_at=created_at,
|
|
1046
|
+
updated_by=updated_by,
|
|
1047
|
+
updated_at=updated_at,
|
|
1048
|
+
tags=tags,
|
|
1049
|
+
)
|
|
1050
|
+
self._definition = definition
|
|
1051
|
+
|
|
1052
|
+
@property
|
|
1053
|
+
def definition(self) -> _VolumeAssertionDefinitionTypes:
|
|
1054
|
+
return self._definition
|
|
1055
|
+
|
|
1056
|
+
@staticmethod
|
|
1057
|
+
def _get_volume_definition(
|
|
1058
|
+
assertion: Assertion,
|
|
1059
|
+
) -> _VolumeAssertionDefinitionTypes:
|
|
1060
|
+
"""Get volume assertion definition from a DataHub assertion entity."""
|
|
1061
|
+
return VolumeAssertionDefinition.from_assertion(assertion)
|
|
1062
|
+
|
|
1063
|
+
@staticmethod
|
|
1064
|
+
def _get_detection_mechanism(
|
|
1065
|
+
assertion: Assertion,
|
|
1066
|
+
monitor: Monitor,
|
|
1067
|
+
default: Optional[_DetectionMechanismTypes] = DEFAULT_DETECTION_MECHANISM,
|
|
1068
|
+
) -> Optional[_DetectionMechanismTypes]:
|
|
1069
|
+
"""Get the detection mechanism for volume assertions."""
|
|
1070
|
+
parameters = _AssertionPublic._get_validated_detection_context(
|
|
1071
|
+
monitor,
|
|
1072
|
+
assertion,
|
|
1073
|
+
models.AssertionEvaluationParametersTypeClass.DATASET_VOLUME,
|
|
1074
|
+
models.VolumeAssertionInfoClass,
|
|
1075
|
+
default,
|
|
1076
|
+
)
|
|
1077
|
+
if parameters is None:
|
|
1078
|
+
return default
|
|
1079
|
+
if parameters.datasetVolumeParameters is None:
|
|
1080
|
+
logger.warning(
|
|
1081
|
+
f"Monitor does not have datasetVolumeParameters, defaulting detection mechanism to {DEFAULT_DETECTION_MECHANISM}"
|
|
1082
|
+
)
|
|
1083
|
+
if default is None:
|
|
1084
|
+
return DEFAULT_DETECTION_MECHANISM
|
|
1085
|
+
else:
|
|
1086
|
+
return default
|
|
1087
|
+
source_type = parameters.datasetVolumeParameters.sourceType
|
|
1088
|
+
if source_type == models.DatasetVolumeSourceTypeClass.INFORMATION_SCHEMA:
|
|
1089
|
+
return DetectionMechanism.INFORMATION_SCHEMA
|
|
1090
|
+
elif source_type == models.DatasetVolumeSourceTypeClass.QUERY:
|
|
1091
|
+
additional_filter = _AssertionPublic._get_additional_filter(assertion)
|
|
1092
|
+
return DetectionMechanism.QUERY(additional_filter=additional_filter)
|
|
1093
|
+
elif source_type == models.DatasetVolumeSourceTypeClass.DATAHUB_DATASET_PROFILE:
|
|
1094
|
+
return DetectionMechanism.DATASET_PROFILE
|
|
1095
|
+
else:
|
|
1096
|
+
raise SDKNotYetSupportedError(f"DatasetVolumeSourceType {source_type}")
|
|
1097
|
+
|
|
1098
|
+
@classmethod
|
|
1099
|
+
def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
|
|
1100
|
+
"""
|
|
1101
|
+
Create a volume 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
|
+
definition=cls._get_volume_definition(assertion),
|
|
1110
|
+
incident_behavior=cls._get_incident_behavior(assertion),
|
|
1111
|
+
detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
|
|
1112
|
+
created_by=cls._get_created_by(assertion),
|
|
1113
|
+
created_at=cls._get_created_at(assertion),
|
|
1114
|
+
updated_by=cls._get_updated_by(assertion),
|
|
1115
|
+
updated_at=cls._get_updated_at(assertion),
|
|
1116
|
+
tags=cls._get_tags(assertion),
|
|
1117
|
+
)
|
|
1118
|
+
|
|
1119
|
+
|
|
984
1120
|
class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
985
1121
|
"""
|
|
986
1122
|
A class that represents a freshness assertion.
|
|
@@ -1095,30 +1231,6 @@ class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
|
1095
1231
|
f"Assertion {assertion.urn} is not a freshness assertion"
|
|
1096
1232
|
)
|
|
1097
1233
|
|
|
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
1234
|
@staticmethod
|
|
1123
1235
|
def _get_detection_mechanism(
|
|
1124
1236
|
assertion: Assertion,
|
|
@@ -1156,6 +1268,30 @@ class FreshnessAssertion(_HasSchedule, _AssertionPublic):
|
|
|
1156
1268
|
else:
|
|
1157
1269
|
raise SDKNotYetSupportedError(f"DatasetFreshnessSourceType {source_type}")
|
|
1158
1270
|
|
|
1271
|
+
@classmethod
|
|
1272
|
+
def _from_entities(cls, assertion: Assertion, monitor: Monitor) -> Self:
|
|
1273
|
+
"""
|
|
1274
|
+
Create a freshness assertion from the assertion and monitor entities.
|
|
1275
|
+
"""
|
|
1276
|
+
return cls(
|
|
1277
|
+
urn=assertion.urn,
|
|
1278
|
+
dataset_urn=assertion.dataset,
|
|
1279
|
+
display_name=assertion.description or "",
|
|
1280
|
+
mode=cls._get_mode(monitor),
|
|
1281
|
+
schedule=cls._get_schedule(monitor),
|
|
1282
|
+
freshness_schedule_check_type=cls._get_freshness_schedule_check_type(
|
|
1283
|
+
assertion
|
|
1284
|
+
),
|
|
1285
|
+
lookback_window=cls._get_lookback_window(assertion),
|
|
1286
|
+
incident_behavior=cls._get_incident_behavior(assertion),
|
|
1287
|
+
detection_mechanism=cls._get_detection_mechanism(assertion, monitor),
|
|
1288
|
+
created_by=cls._get_created_by(assertion),
|
|
1289
|
+
created_at=cls._get_created_at(assertion),
|
|
1290
|
+
updated_by=cls._get_updated_by(assertion),
|
|
1291
|
+
updated_at=cls._get_updated_at(assertion),
|
|
1292
|
+
tags=cls._get_tags(assertion),
|
|
1293
|
+
)
|
|
1294
|
+
|
|
1159
1295
|
|
|
1160
1296
|
class SqlAssertion(_AssertionPublic, _HasSchedule):
|
|
1161
1297
|
"""
|
|
@@ -1223,8 +1359,22 @@ class SqlAssertion(_AssertionPublic, _HasSchedule):
|
|
|
1223
1359
|
return self._statement
|
|
1224
1360
|
|
|
1225
1361
|
@property
|
|
1226
|
-
def
|
|
1227
|
-
return self._criteria
|
|
1362
|
+
def criteria_type(self) -> Union[SqlAssertionType, str]:
|
|
1363
|
+
return self._criteria.type
|
|
1364
|
+
|
|
1365
|
+
@property
|
|
1366
|
+
def criteria_change_type(self) -> Optional[Union[SqlAssertionChangeType, str]]:
|
|
1367
|
+
return self._criteria.change_type
|
|
1368
|
+
|
|
1369
|
+
@property
|
|
1370
|
+
def criteria_operator(self) -> Union[SqlAssertionOperator, str]:
|
|
1371
|
+
return self._criteria.operator
|
|
1372
|
+
|
|
1373
|
+
@property
|
|
1374
|
+
def criteria_parameters(
|
|
1375
|
+
self,
|
|
1376
|
+
) -> Union[Union[float, int], tuple[Union[float, int], Union[float, int]]]:
|
|
1377
|
+
return self._criteria.parameters
|
|
1228
1378
|
|
|
1229
1379
|
@staticmethod
|
|
1230
1380
|
def _get_detection_mechanism(
|