acryl-datahub-cloud 0.3.12rc8__py3-none-any.whl → 0.3.12rc10__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.

@@ -17,7 +17,7 @@ from acryl_datahub_cloud.sdk.assertion.smart_column_metric_assertion import (
17
17
  SmartColumnMetricAssertion,
18
18
  )
19
19
  from acryl_datahub_cloud.sdk.assertion_input.assertion_input import (
20
- AssertionIncidentBehavior,
20
+ AssertionIncidentBehaviorInputTypes,
21
21
  DetectionMechanismInputTypes,
22
22
  ExclusionWindowInputTypes,
23
23
  InferenceSensitivity,
@@ -89,76 +89,41 @@ class AssertionsClient:
89
89
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
90
90
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
91
91
  training_data_lookback_days: Optional[int] = None,
92
- incident_behavior: Optional[
93
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
94
- ] = None,
92
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
95
93
  tags: Optional[TagsInputType] = None,
96
94
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
97
95
  ) -> SmartFreshnessAssertion:
98
96
  """Upsert and merge a smart freshness assertion.
99
97
 
100
- Note: keyword arguments are required.
98
+ Note:
99
+ Keyword arguments are required.
101
100
 
102
101
  Upsert and merge is a combination of create and update. If the assertion does not exist,
103
102
  it will be created. If it does exist, it will be updated. Existing assertion fields will
104
103
  be updated if the input value is not None. If the input value is None, the existing value
105
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
106
- empty string.
104
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
105
+ empty string), it will be unset.
107
106
 
108
107
  Schedule behavior:
109
- - Create case: Uses default hourly schedule ("0 * * * *")
110
- - Update case: Preserves existing schedule from backend (not modifiable)
108
+ - Create case: Uses default hourly schedule ("0 * * * *")
109
+ - Update case: Preserves existing schedule from backend (not modifiable)
111
110
 
112
111
  Args:
113
- dataset_urn: The urn of the dataset to be monitored.
114
- urn: The urn of the assertion. If not provided, a urn will be generated and the
115
- assertion will be _created_ in the DataHub instance.
116
- display_name: The display name of the assertion. If not provided, a random display
117
- name will be generated.
118
- enabled: Whether the assertion is enabled. If not provided, the existing value
119
- will be preserved.
120
- detection_mechanism: The detection mechanism to be used for the assertion. Information
121
- schema is recommended. Valid values are:
112
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
113
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
114
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
115
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
116
+ detection_mechanism (DetectionMechanismInputTypes): The detection mechanism to be used for the assertion. Information schema is recommended. Valid values are:
122
117
  - "information_schema" or DetectionMechanism.INFORMATION_SCHEMA
123
118
  - "audit_log" or DetectionMechanism.AUDIT_LOG
124
- - {
125
- "type": "last_modified_column",
126
- "column_name": "last_modified",
127
- "additional_filter": "last_modified > '2021-01-01'",
128
- } or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified',
129
- additional_filter='last_modified > 2021-01-01')
119
+ - {"type": "last_modified_column", "column_name": "last_modified", "additional_filter": "last_modified > '2021-01-01'"} or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified', additional_filter='last_modified > 2021-01-01')
130
120
  - "datahub_operation" or DetectionMechanism.DATAHUB_OPERATION
131
- sensitivity: The sensitivity to be applied to the assertion. Valid values are:
132
- - "low" or InferenceSensitivity.LOW
133
- - "medium" or InferenceSensitivity.MEDIUM
134
- - "high" or InferenceSensitivity.HIGH
135
- exclusion_windows: The exclusion windows to be applied to the assertion, currently only
136
- fixed range exclusion windows are supported. Valid values are:
137
- - from datetime.datetime objects: {
138
- "start": "datetime(2025, 1, 1, 0, 0, 0)",
139
- "end": "datetime(2025, 1, 2, 0, 0, 0)",
140
- }
141
- - from string datetimes: {
142
- "start": "2025-01-01T00:00:00",
143
- "end": "2025-01-02T00:00:00",
144
- }
145
- - from FixedRangeExclusionWindow objects: FixedRangeExclusionWindow(
146
- start=datetime(2025, 1, 1, 0, 0, 0),
147
- end=datetime(2025, 1, 2, 0, 0, 0)
148
- )
149
- training_data_lookback_days: The training data lookback days to be applied to the
150
- assertion as an integer.
151
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
152
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
153
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
154
- tags: The tags to be applied to the assertion. Valid values are:
155
- - a list of strings (strings will be converted to TagUrn objects)
156
- - a list of TagUrn objects
157
- - a list of TagAssociationClass objects
158
- updated_by: Optional urn of the user who updated the assertion. The format is
159
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
160
- The default is the datahub system user.
161
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
121
+ sensitivity (Optional[Union[str, InferenceSensitivity]]): The sensitivity to be applied to the assertion. Valid values are: "low", "medium", "high".
122
+ exclusion_windows (Optional[ExclusionWindowInputTypes]): The exclusion windows to be applied to the assertion. Only fixed range exclusion windows are supported.
123
+ training_data_lookback_days (Optional[int]): The training data lookback days to be applied to the assertion as an integer.
124
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass" or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
125
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
126
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
162
127
 
163
128
  Returns:
164
129
  SmartFreshnessAssertion: The created or updated assertion.
@@ -261,9 +226,7 @@ class AssertionsClient:
261
226
  sensitivity: Optional[Union[str, InferenceSensitivity]],
262
227
  exclusion_windows: Optional[ExclusionWindowInputTypes],
263
228
  training_data_lookback_days: Optional[int],
264
- incident_behavior: Optional[
265
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
266
- ],
229
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
267
230
  tags: Optional[TagsInputType],
268
231
  updated_by: Optional[Union[str, CorpUserUrn]],
269
232
  now_utc: datetime,
@@ -346,9 +309,7 @@ class AssertionsClient:
346
309
  sensitivity: Optional[Union[str, InferenceSensitivity]],
347
310
  exclusion_windows: Optional[ExclusionWindowInputTypes],
348
311
  training_data_lookback_days: Optional[int],
349
- incident_behavior: Optional[
350
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
351
- ],
312
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
352
313
  tags: Optional[TagsInputType],
353
314
  updated_by: Optional[Union[str, CorpUserUrn]],
354
315
  now_utc: datetime,
@@ -431,9 +392,7 @@ class AssertionsClient:
431
392
  display_name: Optional[str],
432
393
  enabled: Optional[bool],
433
394
  detection_mechanism: DetectionMechanismInputTypes,
434
- incident_behavior: Optional[
435
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
436
- ],
395
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
437
396
  tags: Optional[TagsInputType],
438
397
  updated_by: Optional[Union[str, CorpUserUrn]],
439
398
  now_utc: datetime,
@@ -518,9 +477,7 @@ class AssertionsClient:
518
477
  display_name: Optional[str],
519
478
  enabled: Optional[bool],
520
479
  detection_mechanism: DetectionMechanismInputTypes,
521
- incident_behavior: Optional[
522
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
523
- ],
480
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
524
481
  tags: Optional[TagsInputType],
525
482
  updated_by: Optional[Union[str, CorpUserUrn]],
526
483
  now_utc: datetime,
@@ -634,9 +591,7 @@ class AssertionsClient:
634
591
  enabled: Optional[bool],
635
592
  criteria: SqlAssertionCriteria,
636
593
  statement: str,
637
- incident_behavior: Optional[
638
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
639
- ],
594
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
640
595
  tags: Optional[TagsInputType],
641
596
  updated_by: Optional[Union[str, CorpUserUrn]],
642
597
  now_utc: datetime,
@@ -758,9 +713,7 @@ class AssertionsClient:
758
713
  sensitivity: Optional[Union[str, InferenceSensitivity]],
759
714
  exclusion_windows: Optional[ExclusionWindowInputTypes],
760
715
  training_data_lookback_days: Optional[int],
761
- incident_behavior: Optional[
762
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
763
- ],
716
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
764
717
  tags: Optional[TagsInputType],
765
718
  now_utc: datetime,
766
719
  assertion_input: _SmartFreshnessAssertionInput,
@@ -886,9 +839,7 @@ class AssertionsClient:
886
839
  display_name: Optional[str],
887
840
  enabled: Optional[bool],
888
841
  detection_mechanism: DetectionMechanismInputTypes,
889
- incident_behavior: Optional[
890
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
891
- ],
842
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
892
843
  tags: Optional[TagsInputType],
893
844
  now_utc: datetime,
894
845
  assertion_input: _FreshnessAssertionInput,
@@ -1008,9 +959,7 @@ class AssertionsClient:
1008
959
  display_name: Optional[str],
1009
960
  enabled: Optional[bool],
1010
961
  detection_mechanism: DetectionMechanismInputTypes,
1011
- incident_behavior: Optional[
1012
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1013
- ],
962
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
1014
963
  tags: Optional[TagsInputType],
1015
964
  now_utc: datetime,
1016
965
  assertion_input: _VolumeAssertionInput,
@@ -1119,9 +1068,7 @@ class AssertionsClient:
1119
1068
  enabled: Optional[bool],
1120
1069
  criteria: SqlAssertionCriteria,
1121
1070
  statement: str,
1122
- incident_behavior: Optional[
1123
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1124
- ],
1071
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
1125
1072
  tags: Optional[TagsInputType],
1126
1073
  now_utc: datetime,
1127
1074
  assertion_input: _SqlAssertionInput,
@@ -1227,9 +1174,7 @@ class AssertionsClient:
1227
1174
  sensitivity: Optional[Union[str, InferenceSensitivity]],
1228
1175
  exclusion_windows: Optional[ExclusionWindowInputTypes],
1229
1176
  training_data_lookback_days: Optional[int],
1230
- incident_behavior: Optional[
1231
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1232
- ],
1177
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
1233
1178
  tags: Optional[TagsInputType],
1234
1179
  schedule: Optional[Union[str, models.CronScheduleClass]],
1235
1180
  now_utc: datetime,
@@ -1359,9 +1304,7 @@ class AssertionsClient:
1359
1304
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
1360
1305
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
1361
1306
  training_data_lookback_days: Optional[int] = None,
1362
- incident_behavior: Optional[
1363
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1364
- ] = None,
1307
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
1365
1308
  tags: Optional[TagsInputType] = None,
1366
1309
  created_by: Optional[Union[str, CorpUserUrn]] = None,
1367
1310
  ) -> SmartFreshnessAssertion:
@@ -1410,6 +1353,8 @@ class AssertionsClient:
1410
1353
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
1411
1354
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
1412
1355
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
1356
+ - A list of the above values (strings or enum values)
1357
+ - None (default behavior)
1413
1358
  tags: The tags to be applied to the assertion. Valid values are:
1414
1359
  - a list of strings (strings will be converted to TagUrn objects)
1415
1360
  - a list of TagUrn objects
@@ -1470,9 +1415,7 @@ class AssertionsClient:
1470
1415
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
1471
1416
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
1472
1417
  training_data_lookback_days: Optional[int] = None,
1473
- incident_behavior: Optional[
1474
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1475
- ] = None,
1418
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
1476
1419
  tags: Optional[TagsInputType] = None,
1477
1420
  created_by: Optional[Union[str, CorpUserUrn]] = None,
1478
1421
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -1526,6 +1469,8 @@ class AssertionsClient:
1526
1469
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
1527
1470
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
1528
1471
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
1472
+ - A list of the above values (strings or enum values)
1473
+ - None (default behavior)
1529
1474
  tags: The tags to be applied to the assertion. Valid values are:
1530
1475
  - a list of strings (strings will be converted to TagUrn objects)
1531
1476
  - a list of TagUrn objects
@@ -1593,9 +1538,7 @@ class AssertionsClient:
1593
1538
  ] = None,
1594
1539
  lookback_window: Optional[TimeWindowSizeInputTypes] = None,
1595
1540
  detection_mechanism: DetectionMechanismInputTypes = None,
1596
- incident_behavior: Optional[
1597
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1598
- ] = None,
1541
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
1599
1542
  tags: Optional[TagsInputType] = None,
1600
1543
  created_by: Optional[Union[str, CorpUserUrn]] = None,
1601
1544
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -1633,6 +1576,8 @@ class AssertionsClient:
1633
1576
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
1634
1577
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
1635
1578
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
1579
+ - A list of the above values (strings or enum values)
1580
+ - None (default behavior)
1636
1581
  tags: The tags to be applied to the assertion. Valid values are:
1637
1582
  - a list of strings (strings will be converted to TagUrn objects)
1638
1583
  - a list of TagUrn objects
@@ -1695,9 +1640,7 @@ class AssertionsClient:
1695
1640
  display_name: Optional[str] = None,
1696
1641
  enabled: bool = True,
1697
1642
  detection_mechanism: DetectionMechanismInputTypes = None,
1698
- incident_behavior: Optional[
1699
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1700
- ] = None,
1643
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
1701
1644
  tags: Optional[TagsInputType] = None,
1702
1645
  created_by: Optional[Union[str, CorpUserUrn]] = None,
1703
1646
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -1733,6 +1676,8 @@ class AssertionsClient:
1733
1676
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
1734
1677
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
1735
1678
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
1679
+ - A list of the above values (strings or enum values)
1680
+ - None (default behavior)
1736
1681
  tags: The tags to be applied to the assertion. Valid values are:
1737
1682
  - a list of strings (strings will be converted to TagUrn objects)
1738
1683
  - a list of TagUrn objects
@@ -1828,9 +1773,7 @@ class AssertionsClient:
1828
1773
  Union[float, int], tuple[Union[float, int], Union[float, int]]
1829
1774
  ],
1830
1775
  statement: str,
1831
- incident_behavior: Optional[
1832
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1833
- ],
1776
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
1834
1777
  tags: Optional[TagsInputType],
1835
1778
  created_by: Optional[Union[str, CorpUserUrn]] = None,
1836
1779
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -1863,6 +1806,8 @@ class AssertionsClient:
1863
1806
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
1864
1807
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
1865
1808
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
1809
+ - A list of the above values (strings or enum values)
1810
+ - None (default behavior)
1866
1811
  tags: The tags to be applied to the assertion. Valid values are:
1867
1812
  - a list of strings (strings will be converted to TagUrn objects)
1868
1813
  - a list of TagUrn objects
@@ -1932,88 +1877,42 @@ class AssertionsClient:
1932
1877
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
1933
1878
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
1934
1879
  training_data_lookback_days: Optional[int] = None,
1935
- incident_behavior: Optional[
1936
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
1937
- ] = None,
1880
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
1938
1881
  tags: Optional[TagsInputType] = None,
1939
1882
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
1940
1883
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
1941
1884
  ) -> SmartVolumeAssertion:
1942
1885
  """Upsert and merge a smart volume assertion.
1943
1886
 
1944
- Note: keyword arguments are required.
1887
+ Note:
1888
+ Keyword arguments are required.
1945
1889
 
1946
1890
  Upsert and merge is a combination of create and update. If the assertion does not exist,
1947
1891
  it will be created. If it does exist, it will be updated. Existing assertion fields will
1948
1892
  be updated if the input value is not None. If the input value is None, the existing value
1949
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
1950
- empty string.
1893
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
1894
+ empty string), it will be unset.
1951
1895
 
1952
1896
  Schedule behavior:
1953
- - Create case: Uses default hourly schedule (\"0 * * * *\") or provided schedule
1954
- - Update case: Different than `sync_smart_freshness_assertion`, schedule is updated.
1897
+ - Create case: Uses default hourly schedule ("0 * * * *") or provided schedule
1898
+ - Update case: Schedule is updated if provided, otherwise existing schedule is preserved.
1955
1899
 
1956
1900
  Args:
1957
- dataset_urn: The urn of the dataset to be monitored.
1958
- urn: The urn of the assertion. If not provided, a urn will be generated and the assertion
1959
- will be _created_ in the DataHub instance.
1960
- display_name: The display name of the assertion. If not provided, a random display name
1961
- will be generated.
1962
- enabled: Whether the assertion is enabled. If not provided, the existing value
1963
- will be preserved.
1964
- detection_mechanism: The detection mechanism to be used for the assertion. Information
1965
- schema is recommended. Valid values are:
1901
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
1902
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
1903
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
1904
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
1905
+ detection_mechanism (DetectionMechanismInputTypes): The detection mechanism to be used for the assertion. Information schema is recommended. Valid values are:
1966
1906
  - "information_schema" or DetectionMechanism.INFORMATION_SCHEMA
1967
- - "audit_log" or DetectionMechanism.AUDIT_LOG
1968
- - {
1969
- "type": "last_modified_column",
1970
- "column_name": "last_modified",
1971
- "additional_filter": "last_modified > '2021-01-01'",
1972
- } or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified',
1973
- additional_filter='last_modified > 2021-01-01')
1974
- - {
1975
- "type": "high_watermark_column",
1976
- "column_name": "id",
1977
- "additional_filter": "id > 1000",
1978
- } or DetectionMechanism.HIGH_WATERMARK_COLUMN(column_name='id',
1979
- additional_filter='id > 1000')
1980
- - "datahub_operation" or DetectionMechanism.DATAHUB_OPERATION
1981
- sensitivity: The sensitivity to be applied to the assertion. Valid values are:
1982
- - "low" or InferenceSensitivity.LOW
1983
- - "medium" or InferenceSensitivity.MEDIUM
1984
- - "high" or InferenceSensitivity.HIGH
1985
- exclusion_windows: The exclusion windows to be applied to the assertion, currently only
1986
- fixed range exclusion windows are supported. Valid values are:
1987
- - from datetime.datetime objects: {
1988
- "start": "datetime(2025, 1, 1, 0, 0, 0)",
1989
- "end": "datetime(2025, 1, 2, 0, 0, 0)",
1990
- }
1991
- - from string datetimes: {
1992
- "start": "2025-01-01T00:00:00",
1993
- "end": "2025-01-02T00:00:00",
1994
- }
1995
- - from FixedRangeExclusionWindow objects: FixedRangeExclusionWindow(
1996
- start=datetime(2025, 1, 1, 0, 0, 0),
1997
- end=datetime(2025, 1, 2, 0, 0, 0)
1998
- )
1999
- training_data_lookback_days: The training data lookback days to be applied to the
2000
- assertion as an integer.
2001
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
2002
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
2003
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
2004
- tags: The tags to be applied to the assertion. Valid values are:
2005
- - a list of strings (strings will be converted to TagUrn objects)
2006
- - a list of TagUrn objects
2007
- - a list of TagAssociationClass objects
2008
- updated_by: Optional urn of the user who updated the assertion. The format is
2009
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
2010
- The default is the datahub system user.
2011
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
2012
- schedule: Optional cron formatted schedule for the assertion. If not provided, a default
2013
- schedule will be used. The schedule determines when the assertion will be evaluated.
2014
- The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone.
2015
- Alternatively, a models.CronScheduleClass object can be provided with string parameters
2016
- cron and timezone. Use `from datahub.metadata import schema_classes as models` to import the class.
1907
+ - {"type": "query", "additional_filter": "value > 1000"} or DetectionMechanism.QUERY(additional_filter='value > 1000')
1908
+ - "dataset_profile" or DetectionMechanism.DATASET_PROFILE
1909
+ sensitivity (Optional[Union[str, InferenceSensitivity]]): The sensitivity to be applied to the assertion. Valid values are: "low", "medium", "high".
1910
+ exclusion_windows (Optional[ExclusionWindowInputTypes]): The exclusion windows to be applied to the assertion. Only fixed range exclusion windows are supported.
1911
+ training_data_lookback_days (Optional[int]): The training data lookback days to be applied to the assertion as an integer.
1912
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass", or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
1913
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
1914
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
1915
+ schedule (Optional[Union[str, models.CronScheduleClass]]): Optional cron formatted schedule for the assertion. If not provided, a default schedule will be used. The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone. Alternatively, a models.CronScheduleClass object can be provided.
2017
1916
 
2018
1917
  Returns:
2019
1918
  SmartVolumeAssertion: The created or updated assertion.
@@ -2126,97 +2025,50 @@ class AssertionsClient:
2126
2025
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
2127
2026
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
2128
2027
  training_data_lookback_days: Optional[int] = None,
2129
- incident_behavior: Optional[
2130
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2131
- ] = None,
2028
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
2132
2029
  tags: Optional[TagsInputType] = None,
2133
2030
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
2134
2031
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
2135
2032
  ) -> SmartColumnMetricAssertion:
2136
2033
  """Upsert and merge a smart column metric assertion.
2137
2034
 
2138
- Note: keyword arguments are required.
2035
+ Note:
2036
+ Keyword arguments are required.
2139
2037
 
2140
2038
  Upsert and merge is a combination of create and update. If the assertion does not exist,
2141
2039
  it will be created. If it does exist, it will be updated.
2142
2040
 
2143
2041
  Existing assertion fields will be updated if the input value is not None. If the input value is None, the existing value
2144
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
2145
- empty string.
2042
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
2043
+ empty string), it will be unset.
2044
+
2045
+ Schedule behavior:
2046
+ - Create case: Uses default schedule of every 6 hours or provided schedule
2047
+ - Update case: Uses existing schedule or provided schedule.
2146
2048
 
2147
2049
  Args:
2148
- dataset_urn: The urn of the dataset to be monitored. (Required)
2149
- column_name: The name of the column to be monitored. (Required)
2150
- metric_type: The type of the metric to be monitored. (Required)
2151
- operator: The operator to be used for the assertion. (Required)
2152
- value: The value to be used for the assertion. (Required if operator requires a value)
2153
- value_type: The type of the value to be used for the assertion. (Required if operator requires a value)
2154
- range: The range to be used for the assertion. (Required if operator requires a range)
2155
- range_type: The type of the range to be used for the assertion. (Required if operator requires a range)
2156
- urn: The urn of the assertion. If not provided, a urn will be generated and the assertion
2157
- will be _created_ in the DataHub instance.
2158
- display_name: The display name of the assertion. If not provided, a random display name
2159
- will be generated.
2160
- enabled: Whether the assertion is enabled. If not provided, the existing value
2161
- will be preserved.
2162
- detection_mechanism: The detection mechanism to be used for the assertion. Valid values are:
2163
- - All rows query datahub dataset profile:
2050
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
2051
+ column_name (str): The name of the column to be monitored.
2052
+ metric_type (MetricInputType): The type of the metric to be monitored.
2053
+ operator (OperatorInputType): The operator to be used for the assertion.
2054
+ value (Optional[ValueInputType]): The value to be used for the assertion. Required if operator requires a value.
2055
+ value_type (Optional[ValueTypeInputType]): The type of the value to be used for the assertion. Required if operator requires a value.
2056
+ range (Optional[RangeInputType]): The range to be used for the assertion. Required if operator requires a range.
2057
+ range_type (Optional[RangeTypeInputType]): The type of the range to be used for the assertion. Required if operator requires a range.
2058
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
2059
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
2060
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
2061
+ detection_mechanism (DetectionMechanismInputTypes): The detection mechanism to be used for the assertion. Valid values are (additional_filter is optional):
2164
2062
  - "all_rows_query_datahub_dataset_profile" or DetectionMechanism.ALL_ROWS_QUERY_DATAHUB_DATASET_PROFILE
2165
-
2166
- - All rows query:
2167
- - "all_rows_query" or DetectionMechanism.ALL_ROWS_QUERY
2168
- - with optional additional filter: DetectionMechanism.ALL_ROWS_QUERY(additional_filter='last_modified > 2021-01-01')
2169
- - Or as a dict: {
2170
- "type": "all_rows_query",
2171
- "additional_filter": "last_modified > '2021-01-01'", # optional
2172
- }
2173
-
2174
- - Changed rows query:
2175
- - For changed rows query, you need to pass a supported column type (Number, Date or Time)
2176
- - DetectionMechanism.CHANGED_ROWS_QUERY(column_name='last_modified')
2177
- - With optional additional filter: DetectionMechanism.CHANGED_ROWS_QUERY(column_name='last_modified', additional_filter='last_modified > 2021-01-01')
2178
- - Or as a dict: {
2179
- "type": "changed_rows_query",
2180
- "column_name": "last_modified",
2181
- "additional_filter": "last_modified > '2021-01-01'", # optional
2182
- }
2183
-
2184
- sensitivity: The sensitivity to be applied to the assertion. Valid values are:
2185
- - "low" or InferenceSensitivity.LOW
2186
- - "medium" or InferenceSensitivity.MEDIUM
2187
- - "high" or InferenceSensitivity.HIGH
2188
- exclusion_windows: The exclusion windows to be applied to the assertion, currently only
2189
- fixed range exclusion windows are supported. Valid values are:
2190
- - from datetime.datetime objects: {
2191
- "start": "datetime(2025, 1, 1, 0, 0, 0)",
2192
- "end": "datetime(2025, 1, 2, 0, 0, 0)",
2193
- }
2194
- - from string datetimes: {
2195
- "start": "2025-01-01T00:00:00",
2196
- "end": "2025-01-02T00:00:00",
2197
- }
2198
- - from FixedRangeExclusionWindow objects: FixedRangeExclusionWindow(
2199
- start=datetime(2025, 1, 1, 0, 0, 0),
2200
- end=datetime(2025, 1, 2, 0, 0, 0)
2201
- )
2202
- training_data_lookback_days: The training data lookback days to be applied to the
2203
- assertion as an integer.
2204
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
2205
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
2206
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
2207
- tags: The tags to be applied to the assertion. Valid values are:
2208
- - a list of strings (strings will be converted to TagUrn objects)
2209
- - a list of TagUrn objects
2210
- - a list of TagAssociationClass objects
2211
- updated_by: Optional urn of the user who updated the assertion. The format is
2212
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
2213
- The default is the datahub system user.
2214
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
2215
- schedule: Optional cron formatted schedule for the assertion. If not provided, a default
2216
- schedule of every 6 hours will be used. The schedule determines when the assertion will be evaluated.
2217
- The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone.
2218
- Alternatively, a models.CronScheduleClass object can be provided with string parameters
2219
- cron and timezone. Use `from datahub.metadata import schema_classes as models` to import the class.
2063
+ - "all_rows_query" or DetectionMechanism.ALL_ROWS_QUERY(), or with additional_filter: {"type": "all_rows_query", "additional_filter": "last_modified > '2021-01-01'"} or DetectionMechanism.ALL_ROWS_QUERY(additional_filter='last_modified > 2021-01-01')
2064
+ - {"type": "changed_rows_query", "column_name": "last_modified", "additional_filter": "last_modified > '2021-01-01'"} or DetectionMechanism.CHANGED_ROWS_QUERY(column_name='last_modified', additional_filter='last_modified > 2021-01-01')
2065
+ sensitivity (Optional[Union[str, InferenceSensitivity]]): The sensitivity to be applied to the assertion. Valid values are: "low", "medium", "high".
2066
+ exclusion_windows (Optional[ExclusionWindowInputTypes]): The exclusion windows to be applied to the assertion. Only fixed range exclusion windows are supported.
2067
+ training_data_lookback_days (Optional[int]): The training data lookback days to be applied to the assertion as an integer.
2068
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass", or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
2069
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
2070
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
2071
+ schedule (Optional[Union[str, models.CronScheduleClass]]): Optional cron formatted schedule for the assertion. If not provided, a default schedule of every 6 hours will be used. The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone. Alternatively, a models.CronScheduleClass object can be provided.
2220
2072
 
2221
2073
  Returns:
2222
2074
  SmartColumnMetricAssertion: The created or updated assertion.
@@ -2351,9 +2203,7 @@ class AssertionsClient:
2351
2203
  sensitivity: Optional[Union[str, InferenceSensitivity]] = None,
2352
2204
  exclusion_windows: Optional[ExclusionWindowInputTypes] = None,
2353
2205
  training_data_lookback_days: Optional[int] = None,
2354
- incident_behavior: Optional[
2355
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2356
- ] = None,
2206
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
2357
2207
  tags: Optional[TagsInputType] = None,
2358
2208
  created_by: Optional[Union[str, CorpUserUrn]] = None,
2359
2209
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -2414,6 +2264,8 @@ class AssertionsClient:
2414
2264
  incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
2415
2265
  - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
2416
2266
  - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
2267
+ - A list of the above values (strings or enum values)
2268
+ - None (default behavior)
2417
2269
  tags: The tags to be applied to the assertion. Valid values are:
2418
2270
  - a list of strings (strings will be converted to TagUrn objects)
2419
2271
  - a list of TagUrn objects
@@ -2497,9 +2349,7 @@ class AssertionsClient:
2497
2349
  sensitivity: Optional[Union[str, InferenceSensitivity]],
2498
2350
  exclusion_windows: Optional[ExclusionWindowInputTypes],
2499
2351
  training_data_lookback_days: Optional[int],
2500
- incident_behavior: Optional[
2501
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2502
- ],
2352
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
2503
2353
  tags: Optional[TagsInputType],
2504
2354
  updated_by: Optional[Union[str, CorpUserUrn]],
2505
2355
  now_utc: datetime,
@@ -2605,9 +2455,7 @@ class AssertionsClient:
2605
2455
  sensitivity: Optional[Union[str, InferenceSensitivity]],
2606
2456
  exclusion_windows: Optional[ExclusionWindowInputTypes],
2607
2457
  training_data_lookback_days: Optional[int],
2608
- incident_behavior: Optional[
2609
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2610
- ],
2458
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes],
2611
2459
  tags: Optional[TagsInputType],
2612
2460
  schedule: Optional[Union[str, models.CronScheduleClass]],
2613
2461
  now_utc: datetime,
@@ -2829,9 +2677,7 @@ class AssertionsClient:
2829
2677
  display_name: Optional[str] = None,
2830
2678
  enabled: Optional[bool] = None,
2831
2679
  detection_mechanism: DetectionMechanismInputTypes = None,
2832
- incident_behavior: Optional[
2833
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2834
- ] = None,
2680
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
2835
2681
  tags: Optional[TagsInputType] = None,
2836
2682
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
2837
2683
  freshness_schedule_check_type: Optional[
@@ -2842,59 +2688,36 @@ class AssertionsClient:
2842
2688
  ) -> FreshnessAssertion:
2843
2689
  """Upsert and merge a freshness assertion.
2844
2690
 
2845
- Note: keyword arguments are required.
2691
+ Note:
2692
+ Keyword arguments are required.
2846
2693
 
2847
2694
  Upsert and merge is a combination of create and update. If the assertion does not exist,
2848
2695
  it will be created. If it does exist, it will be updated. Existing assertion fields will
2849
2696
  be updated if the input value is not None. If the input value is None, the existing value
2850
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
2851
- empty string.
2697
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
2698
+ empty string), it will be unset.
2852
2699
 
2853
2700
  Schedule behavior:
2854
- - Create case: Uses default daily schedule (\"0 0 * * *\") or provided schedule
2855
- - Update case: Uses existing schedule or provided schedule.
2701
+ - Create case: Uses default daily schedule ("0 0 * * *") or provided schedule
2702
+ - Update case: Uses existing schedule or provided schedule.
2856
2703
 
2857
2704
  Args:
2858
- dataset_urn: The urn of the dataset to be monitored.
2859
- urn: The urn of the assertion. If not provided, a urn will be generated and the assertion
2860
- will be _created_ in the DataHub instance.
2861
- display_name: The display name of the assertion. If not provided, a random display name
2862
- will be generated.
2863
- enabled: Whether the assertion is enabled. If not provided, the existing value
2864
- will be preserved.
2865
- detection_mechanism: The detection mechanism to be used for the assertion. Information
2866
- schema is recommended. Valid values are:
2705
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
2706
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
2707
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
2708
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
2709
+ detection_mechanism (DetectionMechanismInputTypes): The detection mechanism to be used for the assertion. Information schema is recommended. Valid values are:
2867
2710
  - "information_schema" or DetectionMechanism.INFORMATION_SCHEMA
2868
2711
  - "audit_log" or DetectionMechanism.AUDIT_LOG
2869
- - {
2870
- "type": "last_modified_column",
2871
- "column_name": "last_modified",
2872
- "additional_filter": "last_modified > '2021-01-01'",
2873
- } or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified',
2874
- additional_filter='last_modified > 2021-01-01')
2875
- - {
2876
- "type": "high_watermark_column",
2877
- "column_name": "id",
2878
- "additional_filter": "id > 1000",
2879
- } or DetectionMechanism.HIGH_WATERMARK_COLUMN(column_name='id',
2880
- additional_filter='id > 1000')
2712
+ - {"type": "last_modified_column", "column_name": "last_modified", "additional_filter": "last_modified > '2021-01-01'"} or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified', additional_filter='last_modified > 2021-01-01')
2713
+ - {"type": "high_watermark_column", "column_name": "id", "additional_filter": "id > 1000"} or DetectionMechanism.HIGH_WATERMARK_COLUMN(column_name='id', additional_filter='id > 1000')
2881
2714
  - "datahub_operation" or DetectionMechanism.DATAHUB_OPERATION
2882
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
2883
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
2884
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
2885
- tags: The tags to be applied to the assertion. Valid values are:
2886
- - a list of strings (strings will be converted to TagUrn objects)
2887
- - a list of TagUrn objects
2888
- - a list of TagAssociationClass objects
2889
- updated_by: Optional urn of the user who updated the assertion. The format is
2890
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
2891
- The default is the datahub system user.
2892
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
2893
- schedule: Optional cron formatted schedule for the assertion. If not provided, a default
2894
- schedule will be used. The schedule determines when the assertion will be evaluated.
2895
- The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone.
2896
- Alternatively, a models.CronScheduleClass object can be provided with string parameters
2897
- cron and timezone. Use `from datahub.metadata import schema_classes as models` to import the class.
2715
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass", or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
2716
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
2717
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
2718
+ freshness_schedule_check_type (Optional[Union[str, models.FreshnessAssertionScheduleTypeClass]]): The freshness schedule check type to be applied to the assertion. Valid values are: "since_the_last_check", "cron".
2719
+ schedule (Optional[Union[str, models.CronScheduleClass]]): Optional cron formatted schedule for the assertion. If not provided, a default schedule will be used. The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone. Alternatively, a models.CronScheduleClass object can be provided.
2720
+ lookback_window (Optional[TimeWindowSizeInputTypes]): The lookback window to be applied to the assertion.
2898
2721
 
2899
2722
  Returns:
2900
2723
  FreshnessAssertion: The created or updated assertion.
@@ -2994,9 +2817,7 @@ class AssertionsClient:
2994
2817
  display_name: Optional[str] = None,
2995
2818
  enabled: Optional[bool] = None,
2996
2819
  detection_mechanism: DetectionMechanismInputTypes = None,
2997
- incident_behavior: Optional[
2998
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
2999
- ] = None,
2820
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
3000
2821
  tags: Optional[TagsInputType] = None,
3001
2822
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
3002
2823
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
@@ -3009,75 +2830,36 @@ class AssertionsClient:
3009
2830
  ) -> VolumeAssertion:
3010
2831
  """Upsert and merge a volume assertion.
3011
2832
 
3012
- Note: keyword arguments are required.
2833
+ Note:
2834
+ Keyword arguments are required.
3013
2835
 
3014
2836
  Upsert and merge is a combination of create and update. If the assertion does not exist,
3015
2837
  it will be created. If it does exist, it will be updated. Existing assertion fields will
3016
2838
  be updated if the input value is not None. If the input value is None, the existing value
3017
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
3018
- empty string.
2839
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
2840
+ empty string), it will be unset.
3019
2841
 
3020
2842
  Schedule behavior:
3021
- - Create case: Uses default daily schedule ("0 0 * * *") or provided schedule
3022
- - Update case: Uses existing schedule or provided schedule.
2843
+ - Create case: Uses default daily schedule ("0 0 * * *") or provided schedule
2844
+ - Update case: Uses existing schedule or provided schedule.
3023
2845
 
3024
2846
  Args:
3025
- dataset_urn: The urn of the dataset to be monitored.
3026
- urn: The urn of the assertion. If not provided, a urn will be generated and the assertion
3027
- will be _created_ in the DataHub instance.
3028
- display_name: The display name of the assertion. If not provided, a random display name
3029
- will be generated.
3030
- enabled: Whether the assertion is enabled. If not provided, the existing value
3031
- will be preserved.
3032
- detection_mechanism: The detection mechanism to be used for the assertion. Information
3033
- schema is recommended. Valid values are:
2847
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
2848
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
2849
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
2850
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
2851
+ detection_mechanism (DetectionMechanismInputTypes): The detection mechanism to be used for the assertion. Information schema is recommended. Valid values are (additional_filter is optional):
3034
2852
  - "information_schema" or DetectionMechanism.INFORMATION_SCHEMA
3035
- - "audit_log" or DetectionMechanism.AUDIT_LOG
3036
- - {
3037
- "type": "last_modified_column",
3038
- "column_name": "last_modified",
3039
- "additional_filter": "last_modified > '2021-01-01'",
3040
- } or DetectionMechanism.LAST_MODIFIED_COLUMN(column_name='last_modified',
3041
- additional_filter='last_modified > 2021-01-01')
3042
- - "datahub_operation" or DetectionMechanism.DATAHUB_OPERATION
3043
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
3044
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
3045
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
3046
- tags: The tags to be applied to the assertion. Valid values are:
3047
- - a list of strings (strings will be converted to TagUrn objects)
3048
- - a list of TagUrn objects
3049
- - a list of TagAssociationClass objects
3050
- updated_by: Optional urn of the user who updated the assertion. The format is
3051
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
3052
- The default is the datahub system user.
3053
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
3054
- schedule: Optional cron formatted schedule for the assertion. If not provided, a default
3055
- schedule will be used. The schedule determines when the assertion will be evaluated.
3056
- The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone.
3057
- Alternatively, a models.CronScheduleClass object can be provided with string parameters
3058
- cron and timezone. Use `from datahub.metadata import schema_classes as models` to import the class.
3059
- criteria_type: Optional type of volume assertion. Must be either VolumeAssertionDefinitionType.ROW_COUNT_TOTAL or VolumeAssertionDefinitionType.ROW_COUNT_CHANGE.
3060
- Raw string values are also accepted: "ROW_COUNT_TOTAL" or "ROW_COUNT_CHANGE".
3061
- If not provided, the existing definition from the backend will be preserved (for update operations).
3062
- Required when creating a new assertion (when urn is None).
3063
- criteria_change_type: Optional change type for row count change assertions. Must be either VolumeAssertionDefinitionChangeKind.ABSOLUTE
3064
- or VolumeAssertionDefinitionChangeKind.PERCENT. Required when criteria_type is VolumeAssertionDefinitionType.ROW_COUNT_CHANGE. Ignored when criteria_type
3065
- is VolumeAssertionDefinitionType.ROW_COUNT_TOTAL. If not provided, existing value is preserved for updates.
3066
- Raw string values are also accepted: "ABSOLUTE" or "PERCENTAGE".
3067
- criteria_operator: Optional comparison operator for the assertion. Must be a VolumeAssertionOperator value:
3068
- - VolumeAssertionOperator.GREATER_THAN_OR_EQUAL_TO
3069
- - VolumeAssertionOperator.LESS_THAN_OR_EQUAL_TO
3070
- - VolumeAssertionOperator.BETWEEN
3071
- Raw string values are also accepted: "GREATER_THAN_OR_EQUAL_TO", "LESS_THAN_OR_EQUAL_TO", "BETWEEN".
3072
- If not provided, existing value is preserved for updates. Required when creating a new assertion.
3073
- criteria_parameters: Optional parameters for the assertion. For single-value operators
3074
- (GREATER_THAN_OR_EQUAL_TO, LESS_THAN_OR_EQUAL_TO), provide a single number.
3075
- For BETWEEN operator, provide a tuple of two numbers (min_value, max_value).
3076
- If not provided, existing value is preserved for updates. Required when creating a new assertion.
3077
-
3078
- Examples:
3079
- - For single value: 100 or 50.5
3080
- - For BETWEEN: (10, 100) or (5.0, 15.5)
2853
+ - {"type": "query", "additional_filter": "value > 1000"} or DetectionMechanism.QUERY(additional_filter='value > 1000')
2854
+ - "dataset_profile" or DetectionMechanism.DATASET_PROFILE
2855
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass", or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
2856
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
2857
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
2858
+ schedule (Optional[Union[str, models.CronScheduleClass]]): Optional cron formatted schedule for the assertion. If not provided, a default schedule will be used. The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone. Alternatively, a models.CronScheduleClass object can be provided.
2859
+ criteria_type (Optional[Union[str, VolumeAssertionDefinitionType]]): Optional type of volume assertion. Must be either VolumeAssertionDefinitionType.ROW_COUNT_TOTAL or VolumeAssertionDefinitionType.ROW_COUNT_CHANGE. If not provided, the existing definition from the backend will be preserved (for update operations). Required when creating a new assertion (when urn is None).
2860
+ criteria_change_type (Optional[Union[str, VolumeAssertionDefinitionChangeKind]]): Optional change type for row count change assertions. Required when criteria_type is VolumeAssertionDefinitionType.ROW_COUNT_CHANGE. Ignored when criteria_type is VolumeAssertionDefinitionType.ROW_COUNT_TOTAL. If not provided, existing value is preserved for updates.
2861
+ criteria_operator (Optional[Union[str, VolumeAssertionOperator]]): Optional comparison operator for the assertion. Must be a VolumeAssertionOperator value. If not provided, existing value is preserved for updates. Required when creating a new assertion.
2862
+ criteria_parameters (Optional[VolumeAssertionDefinitionParameters]): Optional parameters for the assertion. For single-value operators provide a single number. For BETWEEN operator, provide a tuple of two numbers (min_value, max_value). If not provided, existing value is preserved for updates. Required when creating a new assertion.
3081
2863
 
3082
2864
  Returns:
3083
2865
  VolumeAssertion: The created or updated assertion.
@@ -3248,70 +3030,40 @@ class AssertionsClient:
3248
3030
  criteria_parameters: Union[
3249
3031
  Union[float, int], tuple[Union[float, int], Union[float, int]]
3250
3032
  ],
3251
- incident_behavior: Optional[
3252
- Union[AssertionIncidentBehavior, list[AssertionIncidentBehavior]]
3253
- ] = None,
3033
+ incident_behavior: Optional[AssertionIncidentBehaviorInputTypes] = None,
3254
3034
  tags: Optional[TagsInputType] = None,
3255
3035
  updated_by: Optional[Union[str, CorpUserUrn]] = None,
3256
3036
  schedule: Optional[Union[str, models.CronScheduleClass]] = None,
3257
3037
  ) -> SqlAssertion:
3258
3038
  """Upsert and merge a sql assertion.
3259
3039
 
3260
- Note: keyword arguments are required.
3040
+ Note:
3041
+ Keyword arguments are required.
3261
3042
 
3262
3043
  Upsert and merge is a combination of create and update. If the assertion does not exist,
3263
3044
  it will be created. If it does exist, it will be updated. Existing assertion fields will
3264
3045
  be updated if the input value is not None. If the input value is None, the existing value
3265
- will be preserved. If the input value can be un-set e.g. by passing an empty list or
3266
- empty string.
3046
+ will be preserved. If the input value can be un-set (e.g. by passing an empty list or
3047
+ empty string), it will be unset.
3267
3048
 
3268
3049
  Schedule behavior:
3269
- - Create case: Uses default daily schedule (\"0 0 * * *\") or provided schedule
3270
- - Update case: Uses existing schedule or provided schedule.
3050
+ - Create case: Uses default daily schedule ("0 0 * * *") or provided schedule
3051
+ - Update case: Uses existing schedule or provided schedule.
3271
3052
 
3272
3053
  Args:
3273
- dataset_urn: The urn of the dataset to be monitored.
3274
- urn: The urn of the assertion. If not provided, a urn will be generated and the assertion
3275
- will be _created_ in the DataHub instance.
3276
- display_name: The display name of the assertion. If not provided, a random display name
3277
- will be generated.
3278
- enabled: Whether the assertion is enabled. If not provided, the existing value
3279
- will be preserved.
3280
- criteria_type: The type of sql assertion. Valid values are:
3281
- - "METRIC" -> Looks at the current value of the metric.
3282
- - "METRIC_CHANGE" -> Looks at the change in the metric between the current and previous run.
3283
- criteria_change_type: The change type of the assertion, if the type is "METRIC_CHANGE". Valid values are:
3284
- - "ABSOLUTE" -> Looks at the absolute change in the metric.
3285
- - "PERCENTAGE" -> Looks at the percentage change in the metric.
3286
- criteria_operator: The operator to be used for the assertion. Valid values are:
3287
- - "GREATER_THAN" -> The metric value is greater than the threshold.
3288
- - "LESS_THAN" -> The metric value is less than the threshold.
3289
- - "GREATER_THAN_OR_EQUAL_TO" -> The metric value is greater than or equal to the threshold.
3290
- - "LESS_THAN_OR_EQUAL_TO" -> The metric value is less than or equal to the threshold.
3291
- - "EQUAL_TO" -> The metric value is equal to the threshold.
3292
- - "NOT_EQUAL_TO" -> The metric value is not equal to the threshold.
3293
- - "BETWEEN" -> The metric value is between the two thresholds.
3294
- criteria_parameters: The parameters to be used for the assertion. This can be a single value or a tuple range.
3295
- - If the operator is "BETWEEN", the value is a tuple of two values, with format min, max.
3296
- - If the operator is not "BETWEEN", the value is a single value.
3297
- statement: The SQL statement to be used for the assertion.
3298
- - "SELECT COUNT(*) FROM table WHERE column > 100"
3299
- incident_behavior: The incident behavior to be applied to the assertion. Valid values are:
3300
- - "raise_on_fail" or AssertionIncidentBehavior.RAISE_ON_FAIL
3301
- - "resolve_on_pass" or AssertionIncidentBehavior.RESOLVE_ON_PASS
3302
- tags: The tags to be applied to the assertion. Valid values are:
3303
- - a list of strings (strings will be converted to TagUrn objects)
3304
- - a list of TagUrn objects
3305
- - a list of TagAssociationClass objects
3306
- updated_by: Optional urn of the user who updated the assertion. The format is
3307
- "urn:li:corpuser:<username>", which you can find on the Users & Groups page.
3308
- The default is the datahub system user.
3309
- TODO: Retrieve the SDK user as the default instead of the datahub system user.
3310
- schedule: Optional cron formatted schedule for the assertion. If not provided, a default
3311
- schedule will be used. The schedule determines when the assertion will be evaluated.
3312
- The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone.
3313
- Alternatively, a models.CronScheduleClass object can be provided with string parameters
3314
- cron and timezone. Use `from datahub.metadata import schema_classes as models` to import the class.
3054
+ dataset_urn (Union[str, DatasetUrn]): The urn of the dataset to be monitored.
3055
+ urn (Optional[Union[str, AssertionUrn]]): The urn of the assertion. If not provided, a urn will be generated and the assertion will be created in the DataHub instance.
3056
+ display_name (Optional[str]): The display name of the assertion. If not provided, a random display name will be generated.
3057
+ enabled (Optional[bool]): Whether the assertion is enabled. If not provided, the existing value will be preserved.
3058
+ statement (str): The SQL statement to be used for the assertion.
3059
+ criteria_type (Union[SqlAssertionType, str]): The type of sql assertion. Valid values are: "METRIC", "METRIC_CHANGE".
3060
+ criteria_change_type (Optional[Union[SqlAssertionChangeType, str]]): The change type of the assertion, if the type is "METRIC_CHANGE". Valid values are: "ABSOLUTE", "PERCENTAGE".
3061
+ criteria_operator (Union[SqlAssertionOperator, str]): The operator to be used for the assertion. Valid values are: "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL_TO", "LESS_THAN_OR_EQUAL_TO", "EQUAL_TO", "NOT_EQUAL_TO", "BETWEEN".
3062
+ criteria_parameters (Union[float, int, tuple[float, int]]): The parameters to be used for the assertion. This can be a single value or a tuple range. If the operator is "BETWEEN", the value is a tuple of two values, with format min, max. If the operator is not "BETWEEN", the value is a single value.
3063
+ incident_behavior (Optional[Union[str, list[str], AssertionIncidentBehavior, list[AssertionIncidentBehavior]]]): The incident behavior to be applied to the assertion. Valid values are: "raise_on_fail", "resolve_on_pass", or the typed ones (AssertionIncidentBehavior.RAISE_ON_FAIL and AssertionIncidentBehavior.RESOLVE_ON_PASS).
3064
+ tags (Optional[TagsInputType]): The tags to be applied to the assertion. Valid values are: a list of strings, TagUrn objects, or TagAssociationClass objects.
3065
+ updated_by (Optional[Union[str, CorpUserUrn]]): Optional urn of the user who updated the assertion. The format is "urn:li:corpuser:<username>". The default is the datahub system user.
3066
+ schedule (Optional[Union[str, models.CronScheduleClass]]): Optional cron formatted schedule for the assertion. If not provided, a default schedule will be used. The format is a cron expression, e.g. "0 * * * *" for every hour using UTC timezone. Alternatively, a models.CronScheduleClass object can be provided.
3315
3067
 
3316
3068
  Returns:
3317
3069
  SqlAssertion: The created or updated assertion.