databricks-sdk 0.50.0__py3-none-any.whl → 0.52.0__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 databricks-sdk might be problematic. Click here for more details.

@@ -61,6 +61,18 @@ class AccessControl:
61
61
  )
62
62
 
63
63
 
64
+ class Aggregation(Enum):
65
+
66
+ AVG = "AVG"
67
+ COUNT = "COUNT"
68
+ COUNT_DISTINCT = "COUNT_DISTINCT"
69
+ MAX = "MAX"
70
+ MEDIAN = "MEDIAN"
71
+ MIN = "MIN"
72
+ STDDEV = "STDDEV"
73
+ SUM = "SUM"
74
+
75
+
64
76
  @dataclass
65
77
  class Alert:
66
78
  condition: Optional[AlertCondition] = None
@@ -306,6 +318,17 @@ class AlertConditionThreshold:
306
318
  return cls(value=_from_dict(d, "value", AlertOperandValue))
307
319
 
308
320
 
321
+ class AlertEvaluationState(Enum):
322
+ """UNSPECIFIED - default unspecify value for proto enum, do not use it in the code UNKNOWN - alert
323
+ not yet evaluated TRIGGERED - alert is triggered OK - alert is not triggered ERROR - alert
324
+ evaluation failed"""
325
+
326
+ ERROR = "ERROR"
327
+ OK = "OK"
328
+ TRIGGERED = "TRIGGERED"
329
+ UNKNOWN = "UNKNOWN"
330
+
331
+
309
332
  @dataclass
310
333
  class AlertOperandColumn:
311
334
  name: Optional[str] = None
@@ -609,6 +632,394 @@ class AlertState(Enum):
609
632
  UNKNOWN = "UNKNOWN"
610
633
 
611
634
 
635
+ @dataclass
636
+ class AlertV2:
637
+ create_time: Optional[str] = None
638
+ """The timestamp indicating when the alert was created."""
639
+
640
+ custom_description: Optional[str] = None
641
+ """Custom description for the alert. support mustache template."""
642
+
643
+ custom_summary: Optional[str] = None
644
+ """Custom summary for the alert. support mustache template."""
645
+
646
+ display_name: Optional[str] = None
647
+ """The display name of the alert."""
648
+
649
+ evaluation: Optional[AlertV2Evaluation] = None
650
+
651
+ id: Optional[str] = None
652
+ """UUID identifying the alert."""
653
+
654
+ lifecycle_state: Optional[LifecycleState] = None
655
+ """Indicates whether the query is trashed."""
656
+
657
+ owner_user_name: Optional[str] = None
658
+ """The owner's username. This field is set to "Unavailable" if the user has been deleted."""
659
+
660
+ parent_path: Optional[str] = None
661
+ """The workspace path of the folder containing the alert. Can only be set on create, and cannot be
662
+ updated."""
663
+
664
+ query_text: Optional[str] = None
665
+ """Text of the query to be run."""
666
+
667
+ run_as_user_name: Optional[str] = None
668
+ """The run as username. This field is set to "Unavailable" if the user has been deleted."""
669
+
670
+ schedule: Optional[CronSchedule] = None
671
+
672
+ update_time: Optional[str] = None
673
+ """The timestamp indicating when the alert was updated."""
674
+
675
+ warehouse_id: Optional[str] = None
676
+ """ID of the SQL warehouse attached to the alert."""
677
+
678
+ def as_dict(self) -> dict:
679
+ """Serializes the AlertV2 into a dictionary suitable for use as a JSON request body."""
680
+ body = {}
681
+ if self.create_time is not None:
682
+ body["create_time"] = self.create_time
683
+ if self.custom_description is not None:
684
+ body["custom_description"] = self.custom_description
685
+ if self.custom_summary is not None:
686
+ body["custom_summary"] = self.custom_summary
687
+ if self.display_name is not None:
688
+ body["display_name"] = self.display_name
689
+ if self.evaluation:
690
+ body["evaluation"] = self.evaluation.as_dict()
691
+ if self.id is not None:
692
+ body["id"] = self.id
693
+ if self.lifecycle_state is not None:
694
+ body["lifecycle_state"] = self.lifecycle_state.value
695
+ if self.owner_user_name is not None:
696
+ body["owner_user_name"] = self.owner_user_name
697
+ if self.parent_path is not None:
698
+ body["parent_path"] = self.parent_path
699
+ if self.query_text is not None:
700
+ body["query_text"] = self.query_text
701
+ if self.run_as_user_name is not None:
702
+ body["run_as_user_name"] = self.run_as_user_name
703
+ if self.schedule:
704
+ body["schedule"] = self.schedule.as_dict()
705
+ if self.update_time is not None:
706
+ body["update_time"] = self.update_time
707
+ if self.warehouse_id is not None:
708
+ body["warehouse_id"] = self.warehouse_id
709
+ return body
710
+
711
+ def as_shallow_dict(self) -> dict:
712
+ """Serializes the AlertV2 into a shallow dictionary of its immediate attributes."""
713
+ body = {}
714
+ if self.create_time is not None:
715
+ body["create_time"] = self.create_time
716
+ if self.custom_description is not None:
717
+ body["custom_description"] = self.custom_description
718
+ if self.custom_summary is not None:
719
+ body["custom_summary"] = self.custom_summary
720
+ if self.display_name is not None:
721
+ body["display_name"] = self.display_name
722
+ if self.evaluation:
723
+ body["evaluation"] = self.evaluation
724
+ if self.id is not None:
725
+ body["id"] = self.id
726
+ if self.lifecycle_state is not None:
727
+ body["lifecycle_state"] = self.lifecycle_state
728
+ if self.owner_user_name is not None:
729
+ body["owner_user_name"] = self.owner_user_name
730
+ if self.parent_path is not None:
731
+ body["parent_path"] = self.parent_path
732
+ if self.query_text is not None:
733
+ body["query_text"] = self.query_text
734
+ if self.run_as_user_name is not None:
735
+ body["run_as_user_name"] = self.run_as_user_name
736
+ if self.schedule:
737
+ body["schedule"] = self.schedule
738
+ if self.update_time is not None:
739
+ body["update_time"] = self.update_time
740
+ if self.warehouse_id is not None:
741
+ body["warehouse_id"] = self.warehouse_id
742
+ return body
743
+
744
+ @classmethod
745
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2:
746
+ """Deserializes the AlertV2 from a dictionary."""
747
+ return cls(
748
+ create_time=d.get("create_time", None),
749
+ custom_description=d.get("custom_description", None),
750
+ custom_summary=d.get("custom_summary", None),
751
+ display_name=d.get("display_name", None),
752
+ evaluation=_from_dict(d, "evaluation", AlertV2Evaluation),
753
+ id=d.get("id", None),
754
+ lifecycle_state=_enum(d, "lifecycle_state", LifecycleState),
755
+ owner_user_name=d.get("owner_user_name", None),
756
+ parent_path=d.get("parent_path", None),
757
+ query_text=d.get("query_text", None),
758
+ run_as_user_name=d.get("run_as_user_name", None),
759
+ schedule=_from_dict(d, "schedule", CronSchedule),
760
+ update_time=d.get("update_time", None),
761
+ warehouse_id=d.get("warehouse_id", None),
762
+ )
763
+
764
+
765
+ @dataclass
766
+ class AlertV2Evaluation:
767
+ comparison_operator: Optional[ComparisonOperator] = None
768
+ """Operator used for comparison in alert evaluation."""
769
+
770
+ empty_result_state: Optional[AlertEvaluationState] = None
771
+ """Alert state if result is empty."""
772
+
773
+ last_evaluated_at: Optional[str] = None
774
+ """Timestamp of the last evaluation."""
775
+
776
+ notification: Optional[AlertV2Notification] = None
777
+ """User or Notification Destination to notify when alert is triggered."""
778
+
779
+ source: Optional[AlertV2OperandColumn] = None
780
+ """Source column from result to use to evaluate alert"""
781
+
782
+ state: Optional[AlertEvaluationState] = None
783
+ """Latest state of alert evaluation."""
784
+
785
+ threshold: Optional[AlertV2Operand] = None
786
+ """Threshold to user for alert evaluation, can be a column or a value."""
787
+
788
+ def as_dict(self) -> dict:
789
+ """Serializes the AlertV2Evaluation into a dictionary suitable for use as a JSON request body."""
790
+ body = {}
791
+ if self.comparison_operator is not None:
792
+ body["comparison_operator"] = self.comparison_operator.value
793
+ if self.empty_result_state is not None:
794
+ body["empty_result_state"] = self.empty_result_state.value
795
+ if self.last_evaluated_at is not None:
796
+ body["last_evaluated_at"] = self.last_evaluated_at
797
+ if self.notification:
798
+ body["notification"] = self.notification.as_dict()
799
+ if self.source:
800
+ body["source"] = self.source.as_dict()
801
+ if self.state is not None:
802
+ body["state"] = self.state.value
803
+ if self.threshold:
804
+ body["threshold"] = self.threshold.as_dict()
805
+ return body
806
+
807
+ def as_shallow_dict(self) -> dict:
808
+ """Serializes the AlertV2Evaluation into a shallow dictionary of its immediate attributes."""
809
+ body = {}
810
+ if self.comparison_operator is not None:
811
+ body["comparison_operator"] = self.comparison_operator
812
+ if self.empty_result_state is not None:
813
+ body["empty_result_state"] = self.empty_result_state
814
+ if self.last_evaluated_at is not None:
815
+ body["last_evaluated_at"] = self.last_evaluated_at
816
+ if self.notification:
817
+ body["notification"] = self.notification
818
+ if self.source:
819
+ body["source"] = self.source
820
+ if self.state is not None:
821
+ body["state"] = self.state
822
+ if self.threshold:
823
+ body["threshold"] = self.threshold
824
+ return body
825
+
826
+ @classmethod
827
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2Evaluation:
828
+ """Deserializes the AlertV2Evaluation from a dictionary."""
829
+ return cls(
830
+ comparison_operator=_enum(d, "comparison_operator", ComparisonOperator),
831
+ empty_result_state=_enum(d, "empty_result_state", AlertEvaluationState),
832
+ last_evaluated_at=d.get("last_evaluated_at", None),
833
+ notification=_from_dict(d, "notification", AlertV2Notification),
834
+ source=_from_dict(d, "source", AlertV2OperandColumn),
835
+ state=_enum(d, "state", AlertEvaluationState),
836
+ threshold=_from_dict(d, "threshold", AlertV2Operand),
837
+ )
838
+
839
+
840
+ @dataclass
841
+ class AlertV2Notification:
842
+ notify_on_ok: Optional[bool] = None
843
+ """Whether to notify alert subscribers when alert returns back to normal."""
844
+
845
+ retrigger_seconds: Optional[int] = None
846
+ """Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it
847
+ can be triggered again. If 0 or not specified, the alert will not be triggered again."""
848
+
849
+ subscriptions: Optional[List[AlertV2Subscription]] = None
850
+
851
+ def as_dict(self) -> dict:
852
+ """Serializes the AlertV2Notification into a dictionary suitable for use as a JSON request body."""
853
+ body = {}
854
+ if self.notify_on_ok is not None:
855
+ body["notify_on_ok"] = self.notify_on_ok
856
+ if self.retrigger_seconds is not None:
857
+ body["retrigger_seconds"] = self.retrigger_seconds
858
+ if self.subscriptions:
859
+ body["subscriptions"] = [v.as_dict() for v in self.subscriptions]
860
+ return body
861
+
862
+ def as_shallow_dict(self) -> dict:
863
+ """Serializes the AlertV2Notification into a shallow dictionary of its immediate attributes."""
864
+ body = {}
865
+ if self.notify_on_ok is not None:
866
+ body["notify_on_ok"] = self.notify_on_ok
867
+ if self.retrigger_seconds is not None:
868
+ body["retrigger_seconds"] = self.retrigger_seconds
869
+ if self.subscriptions:
870
+ body["subscriptions"] = self.subscriptions
871
+ return body
872
+
873
+ @classmethod
874
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2Notification:
875
+ """Deserializes the AlertV2Notification from a dictionary."""
876
+ return cls(
877
+ notify_on_ok=d.get("notify_on_ok", None),
878
+ retrigger_seconds=d.get("retrigger_seconds", None),
879
+ subscriptions=_repeated_dict(d, "subscriptions", AlertV2Subscription),
880
+ )
881
+
882
+
883
+ @dataclass
884
+ class AlertV2Operand:
885
+ column: Optional[AlertV2OperandColumn] = None
886
+
887
+ value: Optional[AlertV2OperandValue] = None
888
+
889
+ def as_dict(self) -> dict:
890
+ """Serializes the AlertV2Operand into a dictionary suitable for use as a JSON request body."""
891
+ body = {}
892
+ if self.column:
893
+ body["column"] = self.column.as_dict()
894
+ if self.value:
895
+ body["value"] = self.value.as_dict()
896
+ return body
897
+
898
+ def as_shallow_dict(self) -> dict:
899
+ """Serializes the AlertV2Operand into a shallow dictionary of its immediate attributes."""
900
+ body = {}
901
+ if self.column:
902
+ body["column"] = self.column
903
+ if self.value:
904
+ body["value"] = self.value
905
+ return body
906
+
907
+ @classmethod
908
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2Operand:
909
+ """Deserializes the AlertV2Operand from a dictionary."""
910
+ return cls(
911
+ column=_from_dict(d, "column", AlertV2OperandColumn), value=_from_dict(d, "value", AlertV2OperandValue)
912
+ )
913
+
914
+
915
+ @dataclass
916
+ class AlertV2OperandColumn:
917
+ aggregation: Optional[Aggregation] = None
918
+
919
+ display: Optional[str] = None
920
+
921
+ name: Optional[str] = None
922
+
923
+ def as_dict(self) -> dict:
924
+ """Serializes the AlertV2OperandColumn into a dictionary suitable for use as a JSON request body."""
925
+ body = {}
926
+ if self.aggregation is not None:
927
+ body["aggregation"] = self.aggregation.value
928
+ if self.display is not None:
929
+ body["display"] = self.display
930
+ if self.name is not None:
931
+ body["name"] = self.name
932
+ return body
933
+
934
+ def as_shallow_dict(self) -> dict:
935
+ """Serializes the AlertV2OperandColumn into a shallow dictionary of its immediate attributes."""
936
+ body = {}
937
+ if self.aggregation is not None:
938
+ body["aggregation"] = self.aggregation
939
+ if self.display is not None:
940
+ body["display"] = self.display
941
+ if self.name is not None:
942
+ body["name"] = self.name
943
+ return body
944
+
945
+ @classmethod
946
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2OperandColumn:
947
+ """Deserializes the AlertV2OperandColumn from a dictionary."""
948
+ return cls(
949
+ aggregation=_enum(d, "aggregation", Aggregation), display=d.get("display", None), name=d.get("name", None)
950
+ )
951
+
952
+
953
+ @dataclass
954
+ class AlertV2OperandValue:
955
+ bool_value: Optional[bool] = None
956
+
957
+ double_value: Optional[float] = None
958
+
959
+ string_value: Optional[str] = None
960
+
961
+ def as_dict(self) -> dict:
962
+ """Serializes the AlertV2OperandValue into a dictionary suitable for use as a JSON request body."""
963
+ body = {}
964
+ if self.bool_value is not None:
965
+ body["bool_value"] = self.bool_value
966
+ if self.double_value is not None:
967
+ body["double_value"] = self.double_value
968
+ if self.string_value is not None:
969
+ body["string_value"] = self.string_value
970
+ return body
971
+
972
+ def as_shallow_dict(self) -> dict:
973
+ """Serializes the AlertV2OperandValue into a shallow dictionary of its immediate attributes."""
974
+ body = {}
975
+ if self.bool_value is not None:
976
+ body["bool_value"] = self.bool_value
977
+ if self.double_value is not None:
978
+ body["double_value"] = self.double_value
979
+ if self.string_value is not None:
980
+ body["string_value"] = self.string_value
981
+ return body
982
+
983
+ @classmethod
984
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2OperandValue:
985
+ """Deserializes the AlertV2OperandValue from a dictionary."""
986
+ return cls(
987
+ bool_value=d.get("bool_value", None),
988
+ double_value=d.get("double_value", None),
989
+ string_value=d.get("string_value", None),
990
+ )
991
+
992
+
993
+ @dataclass
994
+ class AlertV2Subscription:
995
+ destination_id: Optional[str] = None
996
+
997
+ user_email: Optional[str] = None
998
+
999
+ def as_dict(self) -> dict:
1000
+ """Serializes the AlertV2Subscription into a dictionary suitable for use as a JSON request body."""
1001
+ body = {}
1002
+ if self.destination_id is not None:
1003
+ body["destination_id"] = self.destination_id
1004
+ if self.user_email is not None:
1005
+ body["user_email"] = self.user_email
1006
+ return body
1007
+
1008
+ def as_shallow_dict(self) -> dict:
1009
+ """Serializes the AlertV2Subscription into a shallow dictionary of its immediate attributes."""
1010
+ body = {}
1011
+ if self.destination_id is not None:
1012
+ body["destination_id"] = self.destination_id
1013
+ if self.user_email is not None:
1014
+ body["user_email"] = self.user_email
1015
+ return body
1016
+
1017
+ @classmethod
1018
+ def from_dict(cls, d: Dict[str, Any]) -> AlertV2Subscription:
1019
+ """Deserializes the AlertV2Subscription from a dictionary."""
1020
+ return cls(destination_id=d.get("destination_id", None), user_email=d.get("user_email", None))
1021
+
1022
+
612
1023
  @dataclass
613
1024
  class BaseChunkInfo:
614
1025
  """Describes metadata for a particular chunk, within a result set; this structure is used both
@@ -948,6 +1359,18 @@ class ColumnInfoTypeName(Enum):
948
1359
  USER_DEFINED_TYPE = "USER_DEFINED_TYPE"
949
1360
 
950
1361
 
1362
+ class ComparisonOperator(Enum):
1363
+
1364
+ EQUAL = "EQUAL"
1365
+ GREATER_THAN = "GREATER_THAN"
1366
+ GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL"
1367
+ IS_NOT_NULL = "IS_NOT_NULL"
1368
+ IS_NULL = "IS_NULL"
1369
+ LESS_THAN = "LESS_THAN"
1370
+ LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL"
1371
+ NOT_EQUAL = "NOT_EQUAL"
1372
+
1373
+
951
1374
  @dataclass
952
1375
  class CreateAlert:
953
1376
  name: str
@@ -1012,11 +1435,17 @@ class CreateAlert:
1012
1435
  class CreateAlertRequest:
1013
1436
  alert: Optional[CreateAlertRequestAlert] = None
1014
1437
 
1438
+ auto_resolve_display_name: Optional[bool] = None
1439
+ """If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the
1440
+ alert's display name conflicts with an existing alert's display name."""
1441
+
1015
1442
  def as_dict(self) -> dict:
1016
1443
  """Serializes the CreateAlertRequest into a dictionary suitable for use as a JSON request body."""
1017
1444
  body = {}
1018
1445
  if self.alert:
1019
1446
  body["alert"] = self.alert.as_dict()
1447
+ if self.auto_resolve_display_name is not None:
1448
+ body["auto_resolve_display_name"] = self.auto_resolve_display_name
1020
1449
  return body
1021
1450
 
1022
1451
  def as_shallow_dict(self) -> dict:
@@ -1024,12 +1453,17 @@ class CreateAlertRequest:
1024
1453
  body = {}
1025
1454
  if self.alert:
1026
1455
  body["alert"] = self.alert
1456
+ if self.auto_resolve_display_name is not None:
1457
+ body["auto_resolve_display_name"] = self.auto_resolve_display_name
1027
1458
  return body
1028
1459
 
1029
1460
  @classmethod
1030
1461
  def from_dict(cls, d: Dict[str, Any]) -> CreateAlertRequest:
1031
1462
  """Deserializes the CreateAlertRequest from a dictionary."""
1032
- return cls(alert=_from_dict(d, "alert", CreateAlertRequestAlert))
1463
+ return cls(
1464
+ alert=_from_dict(d, "alert", CreateAlertRequestAlert),
1465
+ auto_resolve_display_name=d.get("auto_resolve_display_name", None),
1466
+ )
1033
1467
 
1034
1468
 
1035
1469
  @dataclass
@@ -1121,13 +1555,43 @@ class CreateAlertRequestAlert:
1121
1555
  )
1122
1556
 
1123
1557
 
1558
+ @dataclass
1559
+ class CreateAlertV2Request:
1560
+ alert: Optional[AlertV2] = None
1561
+
1562
+ def as_dict(self) -> dict:
1563
+ """Serializes the CreateAlertV2Request into a dictionary suitable for use as a JSON request body."""
1564
+ body = {}
1565
+ if self.alert:
1566
+ body["alert"] = self.alert.as_dict()
1567
+ return body
1568
+
1569
+ def as_shallow_dict(self) -> dict:
1570
+ """Serializes the CreateAlertV2Request into a shallow dictionary of its immediate attributes."""
1571
+ body = {}
1572
+ if self.alert:
1573
+ body["alert"] = self.alert
1574
+ return body
1575
+
1576
+ @classmethod
1577
+ def from_dict(cls, d: Dict[str, Any]) -> CreateAlertV2Request:
1578
+ """Deserializes the CreateAlertV2Request from a dictionary."""
1579
+ return cls(alert=_from_dict(d, "alert", AlertV2))
1580
+
1581
+
1124
1582
  @dataclass
1125
1583
  class CreateQueryRequest:
1584
+ auto_resolve_display_name: Optional[bool] = None
1585
+ """If true, automatically resolve query display name conflicts. Otherwise, fail the request if the
1586
+ query's display name conflicts with an existing query's display name."""
1587
+
1126
1588
  query: Optional[CreateQueryRequestQuery] = None
1127
1589
 
1128
1590
  def as_dict(self) -> dict:
1129
1591
  """Serializes the CreateQueryRequest into a dictionary suitable for use as a JSON request body."""
1130
1592
  body = {}
1593
+ if self.auto_resolve_display_name is not None:
1594
+ body["auto_resolve_display_name"] = self.auto_resolve_display_name
1131
1595
  if self.query:
1132
1596
  body["query"] = self.query.as_dict()
1133
1597
  return body
@@ -1135,6 +1599,8 @@ class CreateQueryRequest:
1135
1599
  def as_shallow_dict(self) -> dict:
1136
1600
  """Serializes the CreateQueryRequest into a shallow dictionary of its immediate attributes."""
1137
1601
  body = {}
1602
+ if self.auto_resolve_display_name is not None:
1603
+ body["auto_resolve_display_name"] = self.auto_resolve_display_name
1138
1604
  if self.query:
1139
1605
  body["query"] = self.query
1140
1606
  return body
@@ -1142,7 +1608,10 @@ class CreateQueryRequest:
1142
1608
  @classmethod
1143
1609
  def from_dict(cls, d: Dict[str, Any]) -> CreateQueryRequest:
1144
1610
  """Deserializes the CreateQueryRequest from a dictionary."""
1145
- return cls(query=_from_dict(d, "query", CreateQueryRequestQuery))
1611
+ return cls(
1612
+ auto_resolve_display_name=d.get("auto_resolve_display_name", None),
1613
+ query=_from_dict(d, "query", CreateQueryRequestQuery),
1614
+ )
1146
1615
 
1147
1616
 
1148
1617
  @dataclass
@@ -1590,6 +2059,54 @@ class CreateWidget:
1590
2059
  )
1591
2060
 
1592
2061
 
2062
+ @dataclass
2063
+ class CronSchedule:
2064
+ pause_status: Optional[SchedulePauseStatus] = None
2065
+ """Indicate whether this schedule is paused or not."""
2066
+
2067
+ quartz_cron_schedule: Optional[str] = None
2068
+ """A cron expression using quartz syntax that specifies the schedule for this pipeline. Should use
2069
+ the quartz format described here:
2070
+ http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html"""
2071
+
2072
+ timezone_id: Optional[str] = None
2073
+ """A Java timezone id. The schedule will be resolved using this timezone. This will be combined
2074
+ with the quartz_cron_schedule to determine the schedule. See
2075
+ https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html
2076
+ for details."""
2077
+
2078
+ def as_dict(self) -> dict:
2079
+ """Serializes the CronSchedule into a dictionary suitable for use as a JSON request body."""
2080
+ body = {}
2081
+ if self.pause_status is not None:
2082
+ body["pause_status"] = self.pause_status.value
2083
+ if self.quartz_cron_schedule is not None:
2084
+ body["quartz_cron_schedule"] = self.quartz_cron_schedule
2085
+ if self.timezone_id is not None:
2086
+ body["timezone_id"] = self.timezone_id
2087
+ return body
2088
+
2089
+ def as_shallow_dict(self) -> dict:
2090
+ """Serializes the CronSchedule into a shallow dictionary of its immediate attributes."""
2091
+ body = {}
2092
+ if self.pause_status is not None:
2093
+ body["pause_status"] = self.pause_status
2094
+ if self.quartz_cron_schedule is not None:
2095
+ body["quartz_cron_schedule"] = self.quartz_cron_schedule
2096
+ if self.timezone_id is not None:
2097
+ body["timezone_id"] = self.timezone_id
2098
+ return body
2099
+
2100
+ @classmethod
2101
+ def from_dict(cls, d: Dict[str, Any]) -> CronSchedule:
2102
+ """Deserializes the CronSchedule from a dictionary."""
2103
+ return cls(
2104
+ pause_status=_enum(d, "pause_status", SchedulePauseStatus),
2105
+ quartz_cron_schedule=d.get("quartz_cron_schedule", None),
2106
+ timezone_id=d.get("timezone_id", None),
2107
+ )
2108
+
2109
+
1593
2110
  @dataclass
1594
2111
  class Dashboard:
1595
2112
  """A JSON representing a dashboard containing widgets of visualizations and text boxes."""
@@ -2614,7 +3131,7 @@ class EndpointInfo:
2614
3131
  Supported values: - Must be unique within an org. - Must be less than 100 characters."""
2615
3132
 
2616
3133
  num_active_sessions: Optional[int] = None
2617
- """current number of active sessions for the warehouse"""
3134
+ """Deprecated. current number of active sessions for the warehouse"""
2618
3135
 
2619
3136
  num_clusters: Optional[int] = None
2620
3137
  """current number of clusters running for the service"""
@@ -3419,7 +3936,7 @@ class GetWarehouseResponse:
3419
3936
  Supported values: - Must be unique within an org. - Must be less than 100 characters."""
3420
3937
 
3421
3938
  num_active_sessions: Optional[int] = None
3422
- """current number of active sessions for the warehouse"""
3939
+ """Deprecated. current number of active sessions for the warehouse"""
3423
3940
 
3424
3941
  num_clusters: Optional[int] = None
3425
3942
  """current number of clusters running for the service"""
@@ -4270,6 +4787,36 @@ class ListAlertsResponseAlert:
4270
4787
  )
4271
4788
 
4272
4789
 
4790
+ @dataclass
4791
+ class ListAlertsV2Response:
4792
+ next_page_token: Optional[str] = None
4793
+
4794
+ results: Optional[List[AlertV2]] = None
4795
+
4796
+ def as_dict(self) -> dict:
4797
+ """Serializes the ListAlertsV2Response into a dictionary suitable for use as a JSON request body."""
4798
+ body = {}
4799
+ if self.next_page_token is not None:
4800
+ body["next_page_token"] = self.next_page_token
4801
+ if self.results:
4802
+ body["results"] = [v.as_dict() for v in self.results]
4803
+ return body
4804
+
4805
+ def as_shallow_dict(self) -> dict:
4806
+ """Serializes the ListAlertsV2Response into a shallow dictionary of its immediate attributes."""
4807
+ body = {}
4808
+ if self.next_page_token is not None:
4809
+ body["next_page_token"] = self.next_page_token
4810
+ if self.results:
4811
+ body["results"] = self.results
4812
+ return body
4813
+
4814
+ @classmethod
4815
+ def from_dict(cls, d: Dict[str, Any]) -> ListAlertsV2Response:
4816
+ """Deserializes the ListAlertsV2Response from a dictionary."""
4817
+ return cls(next_page_token=d.get("next_page_token", None), results=_repeated_dict(d, "results", AlertV2))
4818
+
4819
+
4273
4820
  class ListOrder(Enum):
4274
4821
 
4275
4822
  CREATED_AT = "created_at"
@@ -6185,6 +6732,12 @@ class RunAsRole(Enum):
6185
6732
  VIEWER = "viewer"
6186
6733
 
6187
6734
 
6735
+ class SchedulePauseStatus(Enum):
6736
+
6737
+ PAUSED = "PAUSED"
6738
+ UNPAUSED = "UNPAUSED"
6739
+
6740
+
6188
6741
  @dataclass
6189
6742
  class ServiceError:
6190
6743
  error_code: Optional[ServiceErrorCode] = None
@@ -6993,6 +7546,52 @@ class UpdateAlertRequestAlert:
6993
7546
  )
6994
7547
 
6995
7548
 
7549
+ @dataclass
7550
+ class UpdateAlertV2Request:
7551
+ update_mask: str
7552
+ """The field mask must be a single string, with multiple fields separated by commas (no spaces).
7553
+ The field path is relative to the resource object, using a dot (`.`) to navigate sub-fields
7554
+ (e.g., `author.given_name`). Specification of elements in sequence or map fields is not allowed,
7555
+ as only the entire collection field can be specified. Field names must exactly match the
7556
+ resource field names.
7557
+
7558
+ A field mask of `*` indicates full replacement. It’s recommended to always explicitly list the
7559
+ fields being updated and avoid using `*` wildcards, as it can lead to unintended results if the
7560
+ API changes in the future."""
7561
+
7562
+ alert: Optional[AlertV2] = None
7563
+
7564
+ id: Optional[str] = None
7565
+ """UUID identifying the alert."""
7566
+
7567
+ def as_dict(self) -> dict:
7568
+ """Serializes the UpdateAlertV2Request into a dictionary suitable for use as a JSON request body."""
7569
+ body = {}
7570
+ if self.alert:
7571
+ body["alert"] = self.alert.as_dict()
7572
+ if self.id is not None:
7573
+ body["id"] = self.id
7574
+ if self.update_mask is not None:
7575
+ body["update_mask"] = self.update_mask
7576
+ return body
7577
+
7578
+ def as_shallow_dict(self) -> dict:
7579
+ """Serializes the UpdateAlertV2Request into a shallow dictionary of its immediate attributes."""
7580
+ body = {}
7581
+ if self.alert:
7582
+ body["alert"] = self.alert
7583
+ if self.id is not None:
7584
+ body["id"] = self.id
7585
+ if self.update_mask is not None:
7586
+ body["update_mask"] = self.update_mask
7587
+ return body
7588
+
7589
+ @classmethod
7590
+ def from_dict(cls, d: Dict[str, Any]) -> UpdateAlertV2Request:
7591
+ """Deserializes the UpdateAlertV2Request from a dictionary."""
7592
+ return cls(alert=_from_dict(d, "alert", AlertV2), id=d.get("id", None), update_mask=d.get("update_mask", None))
7593
+
7594
+
6996
7595
  @dataclass
6997
7596
  class UpdateQueryRequest:
6998
7597
  update_mask: str
@@ -7902,18 +8501,25 @@ class AlertsAPI:
7902
8501
  def __init__(self, api_client):
7903
8502
  self._api = api_client
7904
8503
 
7905
- def create(self, *, alert: Optional[CreateAlertRequestAlert] = None) -> Alert:
8504
+ def create(
8505
+ self, *, alert: Optional[CreateAlertRequestAlert] = None, auto_resolve_display_name: Optional[bool] = None
8506
+ ) -> Alert:
7906
8507
  """Create an alert.
7907
8508
 
7908
8509
  Creates an alert.
7909
8510
 
7910
8511
  :param alert: :class:`CreateAlertRequestAlert` (optional)
8512
+ :param auto_resolve_display_name: bool (optional)
8513
+ If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the
8514
+ alert's display name conflicts with an existing alert's display name.
7911
8515
 
7912
8516
  :returns: :class:`Alert`
7913
8517
  """
7914
8518
  body = {}
7915
8519
  if alert is not None:
7916
8520
  body["alert"] = alert.as_dict()
8521
+ if auto_resolve_display_name is not None:
8522
+ body["auto_resolve_display_name"] = auto_resolve_display_name
7917
8523
  headers = {
7918
8524
  "Accept": "application/json",
7919
8525
  "Content-Type": "application/json",
@@ -8193,6 +8799,131 @@ class AlertsLegacyAPI:
8193
8799
  self._api.do("PUT", f"/api/2.0/preview/sql/alerts/{alert_id}", body=body, headers=headers)
8194
8800
 
8195
8801
 
8802
+ class AlertsV2API:
8803
+ """TODO: Add description"""
8804
+
8805
+ def __init__(self, api_client):
8806
+ self._api = api_client
8807
+
8808
+ def create_alert(self, *, alert: Optional[AlertV2] = None) -> AlertV2:
8809
+ """Create an alert.
8810
+
8811
+ Create Alert
8812
+
8813
+ :param alert: :class:`AlertV2` (optional)
8814
+
8815
+ :returns: :class:`AlertV2`
8816
+ """
8817
+ body = {}
8818
+ if alert is not None:
8819
+ body["alert"] = alert.as_dict()
8820
+ headers = {
8821
+ "Accept": "application/json",
8822
+ "Content-Type": "application/json",
8823
+ }
8824
+
8825
+ res = self._api.do("POST", "/api/2.0/alerts", body=body, headers=headers)
8826
+ return AlertV2.from_dict(res)
8827
+
8828
+ def get_alert(self, id: str) -> AlertV2:
8829
+ """Get an alert.
8830
+
8831
+ Gets an alert.
8832
+
8833
+ :param id: str
8834
+
8835
+ :returns: :class:`AlertV2`
8836
+ """
8837
+
8838
+ headers = {
8839
+ "Accept": "application/json",
8840
+ }
8841
+
8842
+ res = self._api.do("GET", f"/api/2.0/alerts/{id}", headers=headers)
8843
+ return AlertV2.from_dict(res)
8844
+
8845
+ def list_alerts(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[AlertV2]:
8846
+ """List alerts.
8847
+
8848
+ Gets a list of alerts accessible to the user, ordered by creation time.
8849
+
8850
+ :param page_size: int (optional)
8851
+ :param page_token: str (optional)
8852
+
8853
+ :returns: Iterator over :class:`AlertV2`
8854
+ """
8855
+
8856
+ query = {}
8857
+ if page_size is not None:
8858
+ query["page_size"] = page_size
8859
+ if page_token is not None:
8860
+ query["page_token"] = page_token
8861
+ headers = {
8862
+ "Accept": "application/json",
8863
+ }
8864
+
8865
+ while True:
8866
+ json = self._api.do("GET", "/api/2.0/alerts", query=query, headers=headers)
8867
+ if "results" in json:
8868
+ for v in json["results"]:
8869
+ yield AlertV2.from_dict(v)
8870
+ if "next_page_token" not in json or not json["next_page_token"]:
8871
+ return
8872
+ query["page_token"] = json["next_page_token"]
8873
+
8874
+ def trash_alert(self, id: str):
8875
+ """Delete an alert.
8876
+
8877
+ Moves an alert to the trash. Trashed alerts immediately disappear from list views, and can no longer
8878
+ trigger. You can restore a trashed alert through the UI. A trashed alert is permanently deleted after
8879
+ 30 days.
8880
+
8881
+ :param id: str
8882
+
8883
+
8884
+ """
8885
+
8886
+ headers = {
8887
+ "Accept": "application/json",
8888
+ }
8889
+
8890
+ self._api.do("DELETE", f"/api/2.0/alerts/{id}", headers=headers)
8891
+
8892
+ def update_alert(self, id: str, update_mask: str, *, alert: Optional[AlertV2] = None) -> AlertV2:
8893
+ """Update an alert.
8894
+
8895
+ Update alert
8896
+
8897
+ :param id: str
8898
+ UUID identifying the alert.
8899
+ :param update_mask: str
8900
+ The field mask must be a single string, with multiple fields separated by commas (no spaces). The
8901
+ field path is relative to the resource object, using a dot (`.`) to navigate sub-fields (e.g.,
8902
+ `author.given_name`). Specification of elements in sequence or map fields is not allowed, as only
8903
+ the entire collection field can be specified. Field names must exactly match the resource field
8904
+ names.
8905
+
8906
+ A field mask of `*` indicates full replacement. It’s recommended to always explicitly list the
8907
+ fields being updated and avoid using `*` wildcards, as it can lead to unintended results if the API
8908
+ changes in the future.
8909
+ :param alert: :class:`AlertV2` (optional)
8910
+
8911
+ :returns: :class:`AlertV2`
8912
+ """
8913
+ body = {}
8914
+ if alert is not None:
8915
+ body["alert"] = alert.as_dict()
8916
+ if update_mask is not None:
8917
+ body["update_mask"] = update_mask
8918
+ headers = {
8919
+ "Accept": "application/json",
8920
+ "Content-Type": "application/json",
8921
+ }
8922
+
8923
+ res = self._api.do("PATCH", f"/api/2.0/alerts/{id}", body=body, headers=headers)
8924
+ return AlertV2.from_dict(res)
8925
+
8926
+
8196
8927
  class DashboardWidgetsAPI:
8197
8928
  """This is an evolving API that facilitates the addition and removal of widgets from existing dashboards
8198
8929
  within the Databricks Workspace. Data structures may change over time."""
@@ -8678,16 +9409,23 @@ class QueriesAPI:
8678
9409
  def __init__(self, api_client):
8679
9410
  self._api = api_client
8680
9411
 
8681
- def create(self, *, query: Optional[CreateQueryRequestQuery] = None) -> Query:
9412
+ def create(
9413
+ self, *, auto_resolve_display_name: Optional[bool] = None, query: Optional[CreateQueryRequestQuery] = None
9414
+ ) -> Query:
8682
9415
  """Create a query.
8683
9416
 
8684
9417
  Creates a query.
8685
9418
 
9419
+ :param auto_resolve_display_name: bool (optional)
9420
+ If true, automatically resolve query display name conflicts. Otherwise, fail the request if the
9421
+ query's display name conflicts with an existing query's display name.
8686
9422
  :param query: :class:`CreateQueryRequestQuery` (optional)
8687
9423
 
8688
9424
  :returns: :class:`Query`
8689
9425
  """
8690
9426
  body = {}
9427
+ if auto_resolve_display_name is not None:
9428
+ body["auto_resolve_display_name"] = auto_resolve_display_name
8691
9429
  if query is not None:
8692
9430
  body["query"] = query.as_dict()
8693
9431
  headers = {