acryl-datahub-cloud 0.3.12rc7__py3-none-any.whl → 0.3.12rc9__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/datahub_reporting/datahub_form_reporting.py +29 -13
- acryl_datahub_cloud/metadata/_urns/urn_defs.py +1898 -1898
- acryl_datahub_cloud/metadata/schema.avsc +18520 -18981
- acryl_datahub_cloud/metadata/schema_classes.py +671 -671
- 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/metadata/schemas/UsageFeatures.avsc +9 -0
- acryl_datahub_cloud/sdk/assertion/assertion_base.py +19 -2
- acryl_datahub_cloud/sdk/assertion_input/volume_assertion_input.py +47 -27
- acryl_datahub_cloud/sdk/assertions_client.py +211 -98
- acryl_datahub_cloud/sdk/subscription_client.py +47 -11
- {acryl_datahub_cloud-0.3.12rc7.dist-info → acryl_datahub_cloud-0.3.12rc9.dist-info}/METADATA +41 -41
- {acryl_datahub_cloud-0.3.12rc7.dist-info → acryl_datahub_cloud-0.3.12rc9.dist-info}/RECORD +20 -20
- {acryl_datahub_cloud-0.3.12rc7.dist-info → acryl_datahub_cloud-0.3.12rc9.dist-info}/WHEEL +0 -0
- {acryl_datahub_cloud-0.3.12rc7.dist-info → acryl_datahub_cloud-0.3.12rc9.dist-info}/entry_points.txt +0 -0
- {acryl_datahub_cloud-0.3.12rc7.dist-info → acryl_datahub_cloud-0.3.12rc9.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
|
}
|
|
@@ -160,6 +160,15 @@
|
|
|
160
160
|
"doc": "Overall rank of the dataset based on the the last 30 days insert/update operation count on a platform\nIt returns one plus the number of rows proceeding or equals to the current row in the ordering. "
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
+
"Searchable": {
|
|
164
|
+
"/*": {
|
|
165
|
+
"addToFilters": true,
|
|
166
|
+
"fieldName": "topUsersLast30Days",
|
|
167
|
+
"fieldType": "URN",
|
|
168
|
+
"filterNameOverride": "Top users last 30 days",
|
|
169
|
+
"hasValuesFieldName": "hasTopUsersLast30Days"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
163
172
|
"type": [
|
|
164
173
|
"null",
|
|
165
174
|
{
|
|
@@ -37,7 +37,10 @@ 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,
|
|
41
44
|
)
|
|
42
45
|
from acryl_datahub_cloud.sdk.assertion_input.volume_assertion_input import (
|
|
43
46
|
VolumeAssertionDefinition,
|
|
@@ -1356,8 +1359,22 @@ class SqlAssertion(_AssertionPublic, _HasSchedule):
|
|
|
1356
1359
|
return self._statement
|
|
1357
1360
|
|
|
1358
1361
|
@property
|
|
1359
|
-
def
|
|
1360
|
-
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
|
|
1361
1378
|
|
|
1362
1379
|
@staticmethod
|
|
1363
1380
|
def _get_detection_mechanism(
|
|
@@ -4,7 +4,6 @@ from enum import Enum
|
|
|
4
4
|
from typing import Any, Optional, Tuple, Union
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel, Extra
|
|
7
|
-
from typing_extensions import Literal
|
|
8
7
|
|
|
9
8
|
from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
|
|
10
9
|
DEFAULT_EVERY_SIX_HOURS_SCHEDULE,
|
|
@@ -30,6 +29,29 @@ from datahub.sdk.entity_client import EntityClient
|
|
|
30
29
|
# TODO: better naming for "volume assertion definition"
|
|
31
30
|
|
|
32
31
|
|
|
32
|
+
# Type aliases and enums for volume assertions
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class VolumeAssertionDefinitionType(str, Enum):
|
|
36
|
+
ROW_COUNT_TOTAL = models.VolumeAssertionTypeClass.ROW_COUNT_TOTAL
|
|
37
|
+
ROW_COUNT_CHANGE = models.VolumeAssertionTypeClass.ROW_COUNT_CHANGE
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Currently supported volume assertion definition types
|
|
41
|
+
CURRENTLY_SUPPORTED_VOLUME_ASSERTION_DEFINITIONS = [
|
|
42
|
+
VolumeAssertionDefinitionType.ROW_COUNT_TOTAL,
|
|
43
|
+
VolumeAssertionDefinitionType.ROW_COUNT_CHANGE,
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class VolumeAssertionDefinitionChangeKind(str, Enum):
|
|
48
|
+
ABSOLUTE = models.AssertionValueChangeTypeClass.ABSOLUTE
|
|
49
|
+
PERCENTAGE = models.AssertionValueChangeTypeClass.PERCENTAGE
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
VolumeAssertionDefinitionParameters = Union[float, Tuple[float, float]]
|
|
53
|
+
|
|
54
|
+
|
|
33
55
|
class VolumeAssertionOperator(str, Enum):
|
|
34
56
|
"""Valid operators for volume assertions."""
|
|
35
57
|
|
|
@@ -46,16 +68,16 @@ class _AbstractVolumeAssertionDefinition(BaseModel, ABC):
|
|
|
46
68
|
|
|
47
69
|
|
|
48
70
|
class RowCountTotal(_AbstractVolumeAssertionDefinition):
|
|
49
|
-
type:
|
|
71
|
+
type: VolumeAssertionDefinitionType = VolumeAssertionDefinitionType.ROW_COUNT_TOTAL
|
|
50
72
|
operator: VolumeAssertionOperator
|
|
51
|
-
parameters:
|
|
73
|
+
parameters: VolumeAssertionDefinitionParameters
|
|
52
74
|
|
|
53
75
|
|
|
54
76
|
class RowCountChange(_AbstractVolumeAssertionDefinition):
|
|
55
|
-
type:
|
|
56
|
-
kind:
|
|
77
|
+
type: VolumeAssertionDefinitionType = VolumeAssertionDefinitionType.ROW_COUNT_CHANGE
|
|
78
|
+
kind: VolumeAssertionDefinitionChangeKind
|
|
57
79
|
operator: VolumeAssertionOperator
|
|
58
|
-
parameters:
|
|
80
|
+
parameters: VolumeAssertionDefinitionParameters
|
|
59
81
|
|
|
60
82
|
|
|
61
83
|
_VOLUME_ASSERTION_DEFINITION_CONCRETE_TYPES = (
|
|
@@ -78,7 +100,7 @@ class VolumeAssertionDefinition:
|
|
|
78
100
|
|
|
79
101
|
@staticmethod
|
|
80
102
|
def _validate_between_parameters(
|
|
81
|
-
parameters:
|
|
103
|
+
parameters: VolumeAssertionDefinitionParameters, assertion_type: str
|
|
82
104
|
) -> None:
|
|
83
105
|
"""Validate parameters for BETWEEN operator."""
|
|
84
106
|
if not isinstance(parameters, tuple) or len(parameters) != 2:
|
|
@@ -88,7 +110,7 @@ class VolumeAssertionDefinition:
|
|
|
88
110
|
|
|
89
111
|
@staticmethod
|
|
90
112
|
def _validate_single_value_parameters(
|
|
91
|
-
parameters:
|
|
113
|
+
parameters: VolumeAssertionDefinitionParameters,
|
|
92
114
|
operator_enum: VolumeAssertionOperator,
|
|
93
115
|
assertion_type: str,
|
|
94
116
|
) -> None:
|
|
@@ -123,7 +145,7 @@ class VolumeAssertionDefinition:
|
|
|
123
145
|
@staticmethod
|
|
124
146
|
def _validate_operator_and_parameters(
|
|
125
147
|
operator: Union[str, VolumeAssertionOperator],
|
|
126
|
-
parameters:
|
|
148
|
+
parameters: VolumeAssertionDefinitionParameters,
|
|
127
149
|
assertion_type: str,
|
|
128
150
|
) -> None:
|
|
129
151
|
"""Validate that operator and parameters are compatible for volume assertions."""
|
|
@@ -162,9 +184,12 @@ class VolumeAssertionDefinition:
|
|
|
162
184
|
) from e
|
|
163
185
|
|
|
164
186
|
# Check for valid assertion type first
|
|
165
|
-
if assertion_type not in
|
|
187
|
+
if assertion_type not in CURRENTLY_SUPPORTED_VOLUME_ASSERTION_DEFINITIONS:
|
|
188
|
+
supported_types = ", ".join(
|
|
189
|
+
[t.value for t in CURRENTLY_SUPPORTED_VOLUME_ASSERTION_DEFINITIONS]
|
|
190
|
+
)
|
|
166
191
|
raise SDKUsageError(
|
|
167
|
-
f"Unknown volume assertion type: {assertion_type}. Supported types:
|
|
192
|
+
f"Unknown volume assertion type: {assertion_type}. Supported types: {supported_types}"
|
|
168
193
|
)
|
|
169
194
|
|
|
170
195
|
# Extract operator and parameters for validation
|
|
@@ -197,19 +222,19 @@ class VolumeAssertionDefinition:
|
|
|
197
222
|
operator
|
|
198
223
|
)
|
|
199
224
|
|
|
200
|
-
if assertion_type ==
|
|
225
|
+
if assertion_type == VolumeAssertionDefinitionType.ROW_COUNT_TOTAL:
|
|
201
226
|
try:
|
|
202
227
|
return RowCountTotal(**definition_dict)
|
|
203
228
|
except Exception as e:
|
|
204
229
|
raise SDKUsageError(
|
|
205
|
-
f"Failed to create
|
|
230
|
+
f"Failed to create {VolumeAssertionDefinitionType.ROW_COUNT_TOTAL.value} volume assertion: {str(e)}"
|
|
206
231
|
) from e
|
|
207
|
-
else: # assertion_type ==
|
|
232
|
+
else: # assertion_type == VolumeAssertionDefinitionType.ROW_COUNT_CHANGE
|
|
208
233
|
try:
|
|
209
234
|
return RowCountChange(**definition_dict)
|
|
210
235
|
except Exception as e:
|
|
211
236
|
raise SDKUsageError(
|
|
212
|
-
f"Failed to create
|
|
237
|
+
f"Failed to create {VolumeAssertionDefinitionType.ROW_COUNT_CHANGE.value} volume assertion: {str(e)}"
|
|
213
238
|
) from e
|
|
214
239
|
|
|
215
240
|
@staticmethod
|
|
@@ -328,7 +353,7 @@ class VolumeAssertionDefinition:
|
|
|
328
353
|
# Map kind to DataHub assertion value change type
|
|
329
354
|
change_type = (
|
|
330
355
|
models.AssertionValueChangeTypeClass.ABSOLUTE
|
|
331
|
-
if definition.kind ==
|
|
356
|
+
if definition.kind == VolumeAssertionDefinitionChangeKind.ABSOLUTE
|
|
332
357
|
else models.AssertionValueChangeTypeClass.PERCENTAGE
|
|
333
358
|
)
|
|
334
359
|
|
|
@@ -364,7 +389,7 @@ class VolumeAssertionDefinition:
|
|
|
364
389
|
@staticmethod
|
|
365
390
|
def _build_assertion_parameters(
|
|
366
391
|
operator: VolumeAssertionOperator,
|
|
367
|
-
parameters:
|
|
392
|
+
parameters: VolumeAssertionDefinitionParameters,
|
|
368
393
|
) -> models.AssertionStdParametersClass:
|
|
369
394
|
"""Build assertion parameters for DataHub model classes.
|
|
370
395
|
|
|
@@ -408,7 +433,7 @@ class VolumeAssertionDefinition:
|
|
|
408
433
|
assertion_urn: str,
|
|
409
434
|
operator: VolumeAssertionOperator,
|
|
410
435
|
parameters: models.AssertionStdParametersClass,
|
|
411
|
-
) ->
|
|
436
|
+
) -> VolumeAssertionDefinitionParameters:
|
|
412
437
|
"""Extract parameters from assertion based on operator type."""
|
|
413
438
|
if operator.value == "BETWEEN":
|
|
414
439
|
if parameters.minValue is None or parameters.maxValue is None:
|
|
@@ -451,10 +476,10 @@ class VolumeAssertionDefinition:
|
|
|
451
476
|
parameters = VolumeAssertionDefinition._extract_volume_parameters(
|
|
452
477
|
str(assertion.urn), operator, row_count_change.parameters
|
|
453
478
|
)
|
|
454
|
-
kind:
|
|
455
|
-
|
|
479
|
+
kind: VolumeAssertionDefinitionChangeKind = (
|
|
480
|
+
VolumeAssertionDefinitionChangeKind.ABSOLUTE
|
|
456
481
|
if row_count_change.type == models.AssertionValueChangeTypeClass.ABSOLUTE
|
|
457
|
-
else
|
|
482
|
+
else VolumeAssertionDefinitionChangeKind.PERCENTAGE
|
|
458
483
|
)
|
|
459
484
|
return RowCountChange(operator=operator, parameters=parameters, kind=kind)
|
|
460
485
|
|
|
@@ -498,6 +523,7 @@ class _VolumeAssertionInput(_AssertionInput):
|
|
|
498
523
|
# Required fields
|
|
499
524
|
dataset_urn: Union[str, DatasetUrn],
|
|
500
525
|
entity_client: EntityClient, # Needed to get the schema field spec for the detection mechanism if needed
|
|
526
|
+
definition: VolumeAssertionDefinitionInputTypes,
|
|
501
527
|
urn: Optional[Union[str, AssertionUrn]] = None,
|
|
502
528
|
# Optional fields
|
|
503
529
|
display_name: Optional[str] = None,
|
|
@@ -512,10 +538,6 @@ class _VolumeAssertionInput(_AssertionInput):
|
|
|
512
538
|
created_at: datetime,
|
|
513
539
|
updated_by: Union[str, CorpUserUrn],
|
|
514
540
|
updated_at: datetime,
|
|
515
|
-
# volume assertion fields
|
|
516
|
-
definition: Optional[
|
|
517
|
-
VolumeAssertionDefinitionInputTypes
|
|
518
|
-
] = None, # TBC: default value does not make sense
|
|
519
541
|
):
|
|
520
542
|
_AssertionInput.__init__(
|
|
521
543
|
self,
|
|
@@ -535,8 +557,6 @@ class _VolumeAssertionInput(_AssertionInput):
|
|
|
535
557
|
updated_at=updated_at,
|
|
536
558
|
)
|
|
537
559
|
|
|
538
|
-
if definition is None:
|
|
539
|
-
raise SDKUsageError("Volume assertion definition is required")
|
|
540
560
|
self.definition = VolumeAssertionDefinition.parse(definition)
|
|
541
561
|
|
|
542
562
|
def _assertion_type(self) -> str:
|