databricks-sdk 0.29.0__py3-none-any.whl → 0.31.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.

Files changed (30) hide show
  1. databricks/sdk/__init__.py +89 -21
  2. databricks/sdk/config.py +61 -75
  3. databricks/sdk/core.py +16 -9
  4. databricks/sdk/credentials_provider.py +15 -15
  5. databricks/sdk/data_plane.py +65 -0
  6. databricks/sdk/errors/overrides.py +8 -0
  7. databricks/sdk/errors/platform.py +5 -0
  8. databricks/sdk/mixins/files.py +12 -4
  9. databricks/sdk/service/apps.py +977 -0
  10. databricks/sdk/service/billing.py +602 -218
  11. databricks/sdk/service/catalog.py +324 -34
  12. databricks/sdk/service/compute.py +766 -81
  13. databricks/sdk/service/dashboards.py +628 -18
  14. databricks/sdk/service/iam.py +99 -88
  15. databricks/sdk/service/jobs.py +332 -23
  16. databricks/sdk/service/marketplace.py +2 -122
  17. databricks/sdk/service/oauth2.py +127 -70
  18. databricks/sdk/service/pipelines.py +72 -52
  19. databricks/sdk/service/serving.py +303 -750
  20. databricks/sdk/service/settings.py +423 -4
  21. databricks/sdk/service/sharing.py +235 -25
  22. databricks/sdk/service/sql.py +2328 -544
  23. databricks/sdk/useragent.py +151 -0
  24. databricks/sdk/version.py +1 -1
  25. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/METADATA +36 -16
  26. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/RECORD +30 -27
  27. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/WHEEL +1 -1
  28. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/LICENSE +0 -0
  29. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/NOTICE +0 -0
  30. {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.31.0.dist-info}/top_level.txt +0 -0
@@ -46,69 +46,206 @@ class AccessControl:
46
46
 
47
47
  @dataclass
48
48
  class Alert:
49
- created_at: Optional[str] = None
50
- """Timestamp when the alert was created."""
49
+ condition: Optional[AlertCondition] = None
50
+ """Trigger conditions of the alert."""
51
51
 
52
- id: Optional[str] = None
53
- """Alert ID."""
52
+ create_time: Optional[str] = None
53
+ """The timestamp indicating when the alert was created."""
54
54
 
55
- last_triggered_at: Optional[str] = None
56
- """Timestamp when the alert was last triggered."""
55
+ custom_body: Optional[str] = None
56
+ """Custom body of alert notification, if it exists. See [here] for custom templating instructions.
57
+
58
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
57
59
 
58
- name: Optional[str] = None
59
- """Name of the alert."""
60
+ custom_subject: Optional[str] = None
61
+ """Custom subject of alert notification, if it exists. This can include email subject entries and
62
+ Slack notification headers, for example. See [here] for custom templating instructions.
63
+
64
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
60
65
 
61
- options: Optional[AlertOptions] = None
62
- """Alert configuration options."""
66
+ display_name: Optional[str] = None
67
+ """The display name of the alert."""
63
68
 
64
- parent: Optional[str] = None
65
- """The identifier of the workspace folder containing the object."""
69
+ id: Optional[str] = None
70
+ """UUID identifying the alert."""
66
71
 
67
- query: Optional[AlertQuery] = None
72
+ lifecycle_state: Optional[LifecycleState] = None
73
+ """The workspace state of the alert. Used for tracking trashed status."""
68
74
 
69
- rearm: Optional[int] = None
70
- """Number of seconds after being triggered before the alert rearms itself and can be triggered
71
- again. If `null`, alert will never be triggered again."""
75
+ owner_user_name: Optional[str] = None
76
+ """The owner's username. This field is set to "Unavailable" if the user has been deleted."""
77
+
78
+ parent_path: Optional[str] = None
79
+ """The workspace path of the folder containing the alert."""
80
+
81
+ query_id: Optional[str] = None
82
+ """UUID of the query attached to the alert."""
83
+
84
+ seconds_to_retrigger: Optional[int] = None
85
+ """Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it
86
+ can be triggered again. If 0 or not specified, the alert will not be triggered again."""
72
87
 
73
88
  state: Optional[AlertState] = None
74
- """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated
75
- and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions)."""
89
+ """Current state of the alert's trigger status. This field is set to UNKNOWN if the alert has not
90
+ yet been evaluated or ran into an error during the last evaluation."""
76
91
 
77
- updated_at: Optional[str] = None
78
- """Timestamp when the alert was last updated."""
92
+ trigger_time: Optional[str] = None
93
+ """Timestamp when the alert was last triggered, if the alert has been triggered before."""
79
94
 
80
- user: Optional[User] = None
95
+ update_time: Optional[str] = None
96
+ """The timestamp indicating when the alert was updated."""
81
97
 
82
98
  def as_dict(self) -> dict:
83
99
  """Serializes the Alert into a dictionary suitable for use as a JSON request body."""
84
100
  body = {}
85
- if self.created_at is not None: body['created_at'] = self.created_at
101
+ if self.condition: body['condition'] = self.condition.as_dict()
102
+ if self.create_time is not None: body['create_time'] = self.create_time
103
+ if self.custom_body is not None: body['custom_body'] = self.custom_body
104
+ if self.custom_subject is not None: body['custom_subject'] = self.custom_subject
105
+ if self.display_name is not None: body['display_name'] = self.display_name
86
106
  if self.id is not None: body['id'] = self.id
87
- if self.last_triggered_at is not None: body['last_triggered_at'] = self.last_triggered_at
88
- if self.name is not None: body['name'] = self.name
89
- if self.options: body['options'] = self.options.as_dict()
90
- if self.parent is not None: body['parent'] = self.parent
91
- if self.query: body['query'] = self.query.as_dict()
92
- if self.rearm is not None: body['rearm'] = self.rearm
107
+ if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state.value
108
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
109
+ if self.parent_path is not None: body['parent_path'] = self.parent_path
110
+ if self.query_id is not None: body['query_id'] = self.query_id
111
+ if self.seconds_to_retrigger is not None: body['seconds_to_retrigger'] = self.seconds_to_retrigger
93
112
  if self.state is not None: body['state'] = self.state.value
94
- if self.updated_at is not None: body['updated_at'] = self.updated_at
95
- if self.user: body['user'] = self.user.as_dict()
113
+ if self.trigger_time is not None: body['trigger_time'] = self.trigger_time
114
+ if self.update_time is not None: body['update_time'] = self.update_time
96
115
  return body
97
116
 
98
117
  @classmethod
99
118
  def from_dict(cls, d: Dict[str, any]) -> Alert:
100
119
  """Deserializes the Alert from a dictionary."""
101
- return cls(created_at=d.get('created_at', None),
120
+ return cls(condition=_from_dict(d, 'condition', AlertCondition),
121
+ create_time=d.get('create_time', None),
122
+ custom_body=d.get('custom_body', None),
123
+ custom_subject=d.get('custom_subject', None),
124
+ display_name=d.get('display_name', None),
102
125
  id=d.get('id', None),
103
- last_triggered_at=d.get('last_triggered_at', None),
104
- name=d.get('name', None),
105
- options=_from_dict(d, 'options', AlertOptions),
106
- parent=d.get('parent', None),
107
- query=_from_dict(d, 'query', AlertQuery),
108
- rearm=d.get('rearm', None),
126
+ lifecycle_state=_enum(d, 'lifecycle_state', LifecycleState),
127
+ owner_user_name=d.get('owner_user_name', None),
128
+ parent_path=d.get('parent_path', None),
129
+ query_id=d.get('query_id', None),
130
+ seconds_to_retrigger=d.get('seconds_to_retrigger', None),
109
131
  state=_enum(d, 'state', AlertState),
110
- updated_at=d.get('updated_at', None),
111
- user=_from_dict(d, 'user', User))
132
+ trigger_time=d.get('trigger_time', None),
133
+ update_time=d.get('update_time', None))
134
+
135
+
136
+ @dataclass
137
+ class AlertCondition:
138
+ empty_result_state: Optional[AlertState] = None
139
+ """Alert state if result is empty."""
140
+
141
+ op: Optional[AlertOperator] = None
142
+ """Operator used for comparison in alert evaluation."""
143
+
144
+ operand: Optional[AlertConditionOperand] = None
145
+ """Name of the column from the query result to use for comparison in alert evaluation."""
146
+
147
+ threshold: Optional[AlertConditionThreshold] = None
148
+ """Threshold value used for comparison in alert evaluation."""
149
+
150
+ def as_dict(self) -> dict:
151
+ """Serializes the AlertCondition into a dictionary suitable for use as a JSON request body."""
152
+ body = {}
153
+ if self.empty_result_state is not None: body['empty_result_state'] = self.empty_result_state.value
154
+ if self.op is not None: body['op'] = self.op.value
155
+ if self.operand: body['operand'] = self.operand.as_dict()
156
+ if self.threshold: body['threshold'] = self.threshold.as_dict()
157
+ return body
158
+
159
+ @classmethod
160
+ def from_dict(cls, d: Dict[str, any]) -> AlertCondition:
161
+ """Deserializes the AlertCondition from a dictionary."""
162
+ return cls(empty_result_state=_enum(d, 'empty_result_state', AlertState),
163
+ op=_enum(d, 'op', AlertOperator),
164
+ operand=_from_dict(d, 'operand', AlertConditionOperand),
165
+ threshold=_from_dict(d, 'threshold', AlertConditionThreshold))
166
+
167
+
168
+ @dataclass
169
+ class AlertConditionOperand:
170
+ column: Optional[AlertOperandColumn] = None
171
+
172
+ def as_dict(self) -> dict:
173
+ """Serializes the AlertConditionOperand into a dictionary suitable for use as a JSON request body."""
174
+ body = {}
175
+ if self.column: body['column'] = self.column.as_dict()
176
+ return body
177
+
178
+ @classmethod
179
+ def from_dict(cls, d: Dict[str, any]) -> AlertConditionOperand:
180
+ """Deserializes the AlertConditionOperand from a dictionary."""
181
+ return cls(column=_from_dict(d, 'column', AlertOperandColumn))
182
+
183
+
184
+ @dataclass
185
+ class AlertConditionThreshold:
186
+ value: Optional[AlertOperandValue] = None
187
+
188
+ def as_dict(self) -> dict:
189
+ """Serializes the AlertConditionThreshold into a dictionary suitable for use as a JSON request body."""
190
+ body = {}
191
+ if self.value: body['value'] = self.value.as_dict()
192
+ return body
193
+
194
+ @classmethod
195
+ def from_dict(cls, d: Dict[str, any]) -> AlertConditionThreshold:
196
+ """Deserializes the AlertConditionThreshold from a dictionary."""
197
+ return cls(value=_from_dict(d, 'value', AlertOperandValue))
198
+
199
+
200
+ @dataclass
201
+ class AlertOperandColumn:
202
+ name: Optional[str] = None
203
+
204
+ def as_dict(self) -> dict:
205
+ """Serializes the AlertOperandColumn into a dictionary suitable for use as a JSON request body."""
206
+ body = {}
207
+ if self.name is not None: body['name'] = self.name
208
+ return body
209
+
210
+ @classmethod
211
+ def from_dict(cls, d: Dict[str, any]) -> AlertOperandColumn:
212
+ """Deserializes the AlertOperandColumn from a dictionary."""
213
+ return cls(name=d.get('name', None))
214
+
215
+
216
+ @dataclass
217
+ class AlertOperandValue:
218
+ bool_value: Optional[bool] = None
219
+
220
+ double_value: Optional[float] = None
221
+
222
+ string_value: Optional[str] = None
223
+
224
+ def as_dict(self) -> dict:
225
+ """Serializes the AlertOperandValue into a dictionary suitable for use as a JSON request body."""
226
+ body = {}
227
+ if self.bool_value is not None: body['bool_value'] = self.bool_value
228
+ if self.double_value is not None: body['double_value'] = self.double_value
229
+ if self.string_value is not None: body['string_value'] = self.string_value
230
+ return body
231
+
232
+ @classmethod
233
+ def from_dict(cls, d: Dict[str, any]) -> AlertOperandValue:
234
+ """Deserializes the AlertOperandValue from a dictionary."""
235
+ return cls(bool_value=d.get('bool_value', None),
236
+ double_value=d.get('double_value', None),
237
+ string_value=d.get('string_value', None))
238
+
239
+
240
+ class AlertOperator(Enum):
241
+
242
+ EQUAL = 'EQUAL'
243
+ GREATER_THAN = 'GREATER_THAN'
244
+ GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL'
245
+ IS_NULL = 'IS_NULL'
246
+ LESS_THAN = 'LESS_THAN'
247
+ LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL'
248
+ NOT_EQUAL = 'NOT_EQUAL'
112
249
 
113
250
 
114
251
  @dataclass
@@ -259,12 +396,10 @@ class AlertQuery:
259
396
 
260
397
 
261
398
  class AlertState(Enum):
262
- """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated
263
- and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions)."""
264
399
 
265
- OK = 'ok'
266
- TRIGGERED = 'triggered'
267
- UNKNOWN = 'unknown'
400
+ OK = 'OK'
401
+ TRIGGERED = 'TRIGGERED'
402
+ UNKNOWN = 'UNKNOWN'
268
403
 
269
404
 
270
405
  @dataclass
@@ -338,10 +473,10 @@ class Channel:
338
473
 
339
474
  @dataclass
340
475
  class ChannelInfo:
341
- """Channel information for the SQL warehouse at the time of query execution"""
476
+ """Details about a Channel."""
342
477
 
343
478
  dbsql_version: Optional[str] = None
344
- """DBSQL Version the channel is mapped to"""
479
+ """DB SQL Version the Channel is mapped to."""
345
480
 
346
481
  name: Optional[ChannelName] = None
347
482
  """Name of the channel"""
@@ -368,6 +503,29 @@ class ChannelName(Enum):
368
503
  CHANNEL_NAME_UNSPECIFIED = 'CHANNEL_NAME_UNSPECIFIED'
369
504
 
370
505
 
506
+ @dataclass
507
+ class ClientCallContext:
508
+ """Client code that triggered the request"""
509
+
510
+ file_name: Optional[EncodedText] = None
511
+ """File name that contains the last line that triggered the request."""
512
+
513
+ line_number: Optional[int] = None
514
+ """Last line number within a file or notebook cell that triggered the request."""
515
+
516
+ def as_dict(self) -> dict:
517
+ """Serializes the ClientCallContext into a dictionary suitable for use as a JSON request body."""
518
+ body = {}
519
+ if self.file_name: body['file_name'] = self.file_name.as_dict()
520
+ if self.line_number is not None: body['line_number'] = self.line_number
521
+ return body
522
+
523
+ @classmethod
524
+ def from_dict(cls, d: Dict[str, any]) -> ClientCallContext:
525
+ """Deserializes the ClientCallContext from a dictionary."""
526
+ return cls(file_name=_from_dict(d, 'file_name', EncodedText), line_number=d.get('line_number', None))
527
+
528
+
371
529
  @dataclass
372
530
  class ColumnInfo:
373
531
  name: Optional[str] = None
@@ -480,6 +638,212 @@ class CreateAlert:
480
638
  rearm=d.get('rearm', None))
481
639
 
482
640
 
641
+ @dataclass
642
+ class CreateAlertRequest:
643
+ alert: Optional[CreateAlertRequestAlert] = None
644
+
645
+ def as_dict(self) -> dict:
646
+ """Serializes the CreateAlertRequest into a dictionary suitable for use as a JSON request body."""
647
+ body = {}
648
+ if self.alert: body['alert'] = self.alert.as_dict()
649
+ return body
650
+
651
+ @classmethod
652
+ def from_dict(cls, d: Dict[str, any]) -> CreateAlertRequest:
653
+ """Deserializes the CreateAlertRequest from a dictionary."""
654
+ return cls(alert=_from_dict(d, 'alert', CreateAlertRequestAlert))
655
+
656
+
657
+ @dataclass
658
+ class CreateAlertRequestAlert:
659
+ condition: Optional[AlertCondition] = None
660
+ """Trigger conditions of the alert."""
661
+
662
+ custom_body: Optional[str] = None
663
+ """Custom body of alert notification, if it exists. See [here] for custom templating instructions.
664
+
665
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
666
+
667
+ custom_subject: Optional[str] = None
668
+ """Custom subject of alert notification, if it exists. This can include email subject entries and
669
+ Slack notification headers, for example. See [here] for custom templating instructions.
670
+
671
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
672
+
673
+ display_name: Optional[str] = None
674
+ """The display name of the alert."""
675
+
676
+ parent_path: Optional[str] = None
677
+ """The workspace path of the folder containing the alert."""
678
+
679
+ query_id: Optional[str] = None
680
+ """UUID of the query attached to the alert."""
681
+
682
+ seconds_to_retrigger: Optional[int] = None
683
+ """Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it
684
+ can be triggered again. If 0 or not specified, the alert will not be triggered again."""
685
+
686
+ def as_dict(self) -> dict:
687
+ """Serializes the CreateAlertRequestAlert into a dictionary suitable for use as a JSON request body."""
688
+ body = {}
689
+ if self.condition: body['condition'] = self.condition.as_dict()
690
+ if self.custom_body is not None: body['custom_body'] = self.custom_body
691
+ if self.custom_subject is not None: body['custom_subject'] = self.custom_subject
692
+ if self.display_name is not None: body['display_name'] = self.display_name
693
+ if self.parent_path is not None: body['parent_path'] = self.parent_path
694
+ if self.query_id is not None: body['query_id'] = self.query_id
695
+ if self.seconds_to_retrigger is not None: body['seconds_to_retrigger'] = self.seconds_to_retrigger
696
+ return body
697
+
698
+ @classmethod
699
+ def from_dict(cls, d: Dict[str, any]) -> CreateAlertRequestAlert:
700
+ """Deserializes the CreateAlertRequestAlert from a dictionary."""
701
+ return cls(condition=_from_dict(d, 'condition', AlertCondition),
702
+ custom_body=d.get('custom_body', None),
703
+ custom_subject=d.get('custom_subject', None),
704
+ display_name=d.get('display_name', None),
705
+ parent_path=d.get('parent_path', None),
706
+ query_id=d.get('query_id', None),
707
+ seconds_to_retrigger=d.get('seconds_to_retrigger', None))
708
+
709
+
710
+ @dataclass
711
+ class CreateQueryRequest:
712
+ query: Optional[CreateQueryRequestQuery] = None
713
+
714
+ def as_dict(self) -> dict:
715
+ """Serializes the CreateQueryRequest into a dictionary suitable for use as a JSON request body."""
716
+ body = {}
717
+ if self.query: body['query'] = self.query.as_dict()
718
+ return body
719
+
720
+ @classmethod
721
+ def from_dict(cls, d: Dict[str, any]) -> CreateQueryRequest:
722
+ """Deserializes the CreateQueryRequest from a dictionary."""
723
+ return cls(query=_from_dict(d, 'query', CreateQueryRequestQuery))
724
+
725
+
726
+ @dataclass
727
+ class CreateQueryRequestQuery:
728
+ apply_auto_limit: Optional[bool] = None
729
+ """Whether to apply a 1000 row limit to the query result."""
730
+
731
+ catalog: Optional[str] = None
732
+ """Name of the catalog where this query will be executed."""
733
+
734
+ description: Optional[str] = None
735
+ """General description that conveys additional information about this query such as usage notes."""
736
+
737
+ display_name: Optional[str] = None
738
+ """Display name of the query that appears in list views, widget headings, and on the query page."""
739
+
740
+ parameters: Optional[List[QueryParameter]] = None
741
+ """List of query parameter definitions."""
742
+
743
+ parent_path: Optional[str] = None
744
+ """Workspace path of the workspace folder containing the object."""
745
+
746
+ query_text: Optional[str] = None
747
+ """Text of the query to be run."""
748
+
749
+ run_as_mode: Optional[RunAsMode] = None
750
+ """Sets the "Run as" role for the object."""
751
+
752
+ schema: Optional[str] = None
753
+ """Name of the schema where this query will be executed."""
754
+
755
+ tags: Optional[List[str]] = None
756
+
757
+ warehouse_id: Optional[str] = None
758
+ """ID of the SQL warehouse attached to the query."""
759
+
760
+ def as_dict(self) -> dict:
761
+ """Serializes the CreateQueryRequestQuery into a dictionary suitable for use as a JSON request body."""
762
+ body = {}
763
+ if self.apply_auto_limit is not None: body['apply_auto_limit'] = self.apply_auto_limit
764
+ if self.catalog is not None: body['catalog'] = self.catalog
765
+ if self.description is not None: body['description'] = self.description
766
+ if self.display_name is not None: body['display_name'] = self.display_name
767
+ if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters]
768
+ if self.parent_path is not None: body['parent_path'] = self.parent_path
769
+ if self.query_text is not None: body['query_text'] = self.query_text
770
+ if self.run_as_mode is not None: body['run_as_mode'] = self.run_as_mode.value
771
+ if self.schema is not None: body['schema'] = self.schema
772
+ if self.tags: body['tags'] = [v for v in self.tags]
773
+ if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
774
+ return body
775
+
776
+ @classmethod
777
+ def from_dict(cls, d: Dict[str, any]) -> CreateQueryRequestQuery:
778
+ """Deserializes the CreateQueryRequestQuery from a dictionary."""
779
+ return cls(apply_auto_limit=d.get('apply_auto_limit', None),
780
+ catalog=d.get('catalog', None),
781
+ description=d.get('description', None),
782
+ display_name=d.get('display_name', None),
783
+ parameters=_repeated_dict(d, 'parameters', QueryParameter),
784
+ parent_path=d.get('parent_path', None),
785
+ query_text=d.get('query_text', None),
786
+ run_as_mode=_enum(d, 'run_as_mode', RunAsMode),
787
+ schema=d.get('schema', None),
788
+ tags=d.get('tags', None),
789
+ warehouse_id=d.get('warehouse_id', None))
790
+
791
+
792
+ @dataclass
793
+ class CreateVisualizationRequest:
794
+ visualization: Optional[CreateVisualizationRequestVisualization] = None
795
+
796
+ def as_dict(self) -> dict:
797
+ """Serializes the CreateVisualizationRequest into a dictionary suitable for use as a JSON request body."""
798
+ body = {}
799
+ if self.visualization: body['visualization'] = self.visualization.as_dict()
800
+ return body
801
+
802
+ @classmethod
803
+ def from_dict(cls, d: Dict[str, any]) -> CreateVisualizationRequest:
804
+ """Deserializes the CreateVisualizationRequest from a dictionary."""
805
+ return cls(visualization=_from_dict(d, 'visualization', CreateVisualizationRequestVisualization))
806
+
807
+
808
+ @dataclass
809
+ class CreateVisualizationRequestVisualization:
810
+ display_name: Optional[str] = None
811
+ """The display name of the visualization."""
812
+
813
+ query_id: Optional[str] = None
814
+ """UUID of the query that the visualization is attached to."""
815
+
816
+ serialized_options: Optional[str] = None
817
+ """The visualization options varies widely from one visualization type to the next and is
818
+ unsupported. Databricks does not recommend modifying visualization options directly."""
819
+
820
+ serialized_query_plan: Optional[str] = None
821
+ """The visualization query plan varies widely from one visualization type to the next and is
822
+ unsupported. Databricks does not recommend modifying the visualization query plan directly."""
823
+
824
+ type: Optional[str] = None
825
+ """The type of visualization: counter, table, funnel, and so on."""
826
+
827
+ def as_dict(self) -> dict:
828
+ """Serializes the CreateVisualizationRequestVisualization into a dictionary suitable for use as a JSON request body."""
829
+ body = {}
830
+ if self.display_name is not None: body['display_name'] = self.display_name
831
+ if self.query_id is not None: body['query_id'] = self.query_id
832
+ if self.serialized_options is not None: body['serialized_options'] = self.serialized_options
833
+ if self.serialized_query_plan is not None: body['serialized_query_plan'] = self.serialized_query_plan
834
+ if self.type is not None: body['type'] = self.type
835
+ return body
836
+
837
+ @classmethod
838
+ def from_dict(cls, d: Dict[str, any]) -> CreateVisualizationRequestVisualization:
839
+ """Deserializes the CreateVisualizationRequestVisualization from a dictionary."""
840
+ return cls(display_name=d.get('display_name', None),
841
+ query_id=d.get('query_id', None),
842
+ serialized_options=d.get('serialized_options', None),
843
+ serialized_query_plan=d.get('serialized_query_plan', None),
844
+ type=d.get('type', None))
845
+
846
+
483
847
  @dataclass
484
848
  class CreateWarehouseRequest:
485
849
  auto_stop_mins: Optional[int] = None
@@ -913,6 +1277,121 @@ class DataSource:
913
1277
  warehouse_id=d.get('warehouse_id', None))
914
1278
 
915
1279
 
1280
+ class DatePrecision(Enum):
1281
+
1282
+ DAY_PRECISION = 'DAY_PRECISION'
1283
+ MINUTE_PRECISION = 'MINUTE_PRECISION'
1284
+ SECOND_PRECISION = 'SECOND_PRECISION'
1285
+
1286
+
1287
+ @dataclass
1288
+ class DateRange:
1289
+ start: str
1290
+
1291
+ end: str
1292
+
1293
+ def as_dict(self) -> dict:
1294
+ """Serializes the DateRange into a dictionary suitable for use as a JSON request body."""
1295
+ body = {}
1296
+ if self.end is not None: body['end'] = self.end
1297
+ if self.start is not None: body['start'] = self.start
1298
+ return body
1299
+
1300
+ @classmethod
1301
+ def from_dict(cls, d: Dict[str, any]) -> DateRange:
1302
+ """Deserializes the DateRange from a dictionary."""
1303
+ return cls(end=d.get('end', None), start=d.get('start', None))
1304
+
1305
+
1306
+ @dataclass
1307
+ class DateRangeValue:
1308
+ date_range_value: Optional[DateRange] = None
1309
+ """Manually specified date-time range value."""
1310
+
1311
+ dynamic_date_range_value: Optional[DateRangeValueDynamicDateRange] = None
1312
+ """Dynamic date-time range value based on current date-time."""
1313
+
1314
+ precision: Optional[DatePrecision] = None
1315
+ """Date-time precision to format the value into when the query is run. Defaults to DAY_PRECISION
1316
+ (YYYY-MM-DD)."""
1317
+
1318
+ start_day_of_week: Optional[int] = None
1319
+
1320
+ def as_dict(self) -> dict:
1321
+ """Serializes the DateRangeValue into a dictionary suitable for use as a JSON request body."""
1322
+ body = {}
1323
+ if self.date_range_value: body['date_range_value'] = self.date_range_value.as_dict()
1324
+ if self.dynamic_date_range_value is not None:
1325
+ body['dynamic_date_range_value'] = self.dynamic_date_range_value.value
1326
+ if self.precision is not None: body['precision'] = self.precision.value
1327
+ if self.start_day_of_week is not None: body['start_day_of_week'] = self.start_day_of_week
1328
+ return body
1329
+
1330
+ @classmethod
1331
+ def from_dict(cls, d: Dict[str, any]) -> DateRangeValue:
1332
+ """Deserializes the DateRangeValue from a dictionary."""
1333
+ return cls(date_range_value=_from_dict(d, 'date_range_value', DateRange),
1334
+ dynamic_date_range_value=_enum(d, 'dynamic_date_range_value',
1335
+ DateRangeValueDynamicDateRange),
1336
+ precision=_enum(d, 'precision', DatePrecision),
1337
+ start_day_of_week=d.get('start_day_of_week', None))
1338
+
1339
+
1340
+ class DateRangeValueDynamicDateRange(Enum):
1341
+
1342
+ LAST_12_MONTHS = 'LAST_12_MONTHS'
1343
+ LAST_14_DAYS = 'LAST_14_DAYS'
1344
+ LAST_24_HOURS = 'LAST_24_HOURS'
1345
+ LAST_30_DAYS = 'LAST_30_DAYS'
1346
+ LAST_60_DAYS = 'LAST_60_DAYS'
1347
+ LAST_7_DAYS = 'LAST_7_DAYS'
1348
+ LAST_8_HOURS = 'LAST_8_HOURS'
1349
+ LAST_90_DAYS = 'LAST_90_DAYS'
1350
+ LAST_HOUR = 'LAST_HOUR'
1351
+ LAST_MONTH = 'LAST_MONTH'
1352
+ LAST_WEEK = 'LAST_WEEK'
1353
+ LAST_YEAR = 'LAST_YEAR'
1354
+ THIS_MONTH = 'THIS_MONTH'
1355
+ THIS_WEEK = 'THIS_WEEK'
1356
+ THIS_YEAR = 'THIS_YEAR'
1357
+ TODAY = 'TODAY'
1358
+ YESTERDAY = 'YESTERDAY'
1359
+
1360
+
1361
+ @dataclass
1362
+ class DateValue:
1363
+ date_value: Optional[str] = None
1364
+ """Manually specified date-time value."""
1365
+
1366
+ dynamic_date_value: Optional[DateValueDynamicDate] = None
1367
+ """Dynamic date-time value based on current date-time."""
1368
+
1369
+ precision: Optional[DatePrecision] = None
1370
+ """Date-time precision to format the value into when the query is run. Defaults to DAY_PRECISION
1371
+ (YYYY-MM-DD)."""
1372
+
1373
+ def as_dict(self) -> dict:
1374
+ """Serializes the DateValue into a dictionary suitable for use as a JSON request body."""
1375
+ body = {}
1376
+ if self.date_value is not None: body['date_value'] = self.date_value
1377
+ if self.dynamic_date_value is not None: body['dynamic_date_value'] = self.dynamic_date_value.value
1378
+ if self.precision is not None: body['precision'] = self.precision.value
1379
+ return body
1380
+
1381
+ @classmethod
1382
+ def from_dict(cls, d: Dict[str, any]) -> DateValue:
1383
+ """Deserializes the DateValue from a dictionary."""
1384
+ return cls(date_value=d.get('date_value', None),
1385
+ dynamic_date_value=_enum(d, 'dynamic_date_value', DateValueDynamicDate),
1386
+ precision=_enum(d, 'precision', DatePrecision))
1387
+
1388
+
1389
+ class DateValueDynamicDate(Enum):
1390
+
1391
+ NOW = 'NOW'
1392
+ YESTERDAY = 'YESTERDAY'
1393
+
1394
+
916
1395
  @dataclass
917
1396
  class DeleteResponse:
918
1397
 
@@ -942,26 +1421,6 @@ class DeleteWarehouseResponse:
942
1421
 
943
1422
 
944
1423
  class Disposition(Enum):
945
- """The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`.
946
-
947
- Statements executed with `INLINE` disposition will return result data inline, in `JSON_ARRAY`
948
- format, in a series of chunks. If a given statement produces a result set with a size larger
949
- than 25 MiB, that statement execution is aborted, and no result set will be available.
950
-
951
- **NOTE** Byte limits are computed based upon internal representations of the result set data,
952
- and might not match the sizes visible in JSON responses.
953
-
954
- Statements executed with `EXTERNAL_LINKS` disposition will return result data as external links:
955
- URLs that point to cloud storage internal to the workspace. Using `EXTERNAL_LINKS` disposition
956
- allows statements to generate arbitrarily sized result sets for fetching up to 100 GiB. The
957
- resulting links have two important properties:
958
-
959
- 1. They point to resources _external_ to the Databricks compute; therefore any associated
960
- authentication information (typically a personal access token, OAuth token, or similar) _must be
961
- removed_ when fetching from these links.
962
-
963
- 2. These are presigned URLs with a specific expiration, indicated in the response. The behavior
964
- when attempting to use an expired link is cloud specific."""
965
1424
 
966
1425
  EXTERNAL_LINKS = 'EXTERNAL_LINKS'
967
1426
  INLINE = 'INLINE'
@@ -1140,6 +1599,50 @@ class EditWarehouseResponse:
1140
1599
  return cls()
1141
1600
 
1142
1601
 
1602
+ @dataclass
1603
+ class Empty:
1604
+ """Represents an empty message, similar to google.protobuf.Empty, which is not available in the
1605
+ firm right now."""
1606
+
1607
+ def as_dict(self) -> dict:
1608
+ """Serializes the Empty into a dictionary suitable for use as a JSON request body."""
1609
+ body = {}
1610
+ return body
1611
+
1612
+ @classmethod
1613
+ def from_dict(cls, d: Dict[str, any]) -> Empty:
1614
+ """Deserializes the Empty from a dictionary."""
1615
+ return cls()
1616
+
1617
+
1618
+ @dataclass
1619
+ class EncodedText:
1620
+ encoding: Optional[EncodedTextEncoding] = None
1621
+ """Carry text data in different form."""
1622
+
1623
+ text: Optional[str] = None
1624
+ """text data"""
1625
+
1626
+ def as_dict(self) -> dict:
1627
+ """Serializes the EncodedText into a dictionary suitable for use as a JSON request body."""
1628
+ body = {}
1629
+ if self.encoding is not None: body['encoding'] = self.encoding.value
1630
+ if self.text is not None: body['text'] = self.text
1631
+ return body
1632
+
1633
+ @classmethod
1634
+ def from_dict(cls, d: Dict[str, any]) -> EncodedText:
1635
+ """Deserializes the EncodedText from a dictionary."""
1636
+ return cls(encoding=_enum(d, 'encoding', EncodedTextEncoding), text=d.get('text', None))
1637
+
1638
+
1639
+ class EncodedTextEncoding(Enum):
1640
+ """Carry text data in different form."""
1641
+
1642
+ BASE64 = 'BASE64'
1643
+ PLAIN = 'PLAIN'
1644
+
1645
+
1143
1646
  @dataclass
1144
1647
  class EndpointConfPair:
1145
1648
  key: Optional[str] = None
@@ -1384,6 +1887,33 @@ class EndpointTags:
1384
1887
  return cls(custom_tags=_repeated_dict(d, 'custom_tags', EndpointTagPair))
1385
1888
 
1386
1889
 
1890
+ @dataclass
1891
+ class EnumValue:
1892
+ enum_options: Optional[str] = None
1893
+ """List of valid query parameter values, newline delimited."""
1894
+
1895
+ multi_values_options: Optional[MultiValuesOptions] = None
1896
+ """If specified, allows multiple values to be selected for this parameter."""
1897
+
1898
+ values: Optional[List[str]] = None
1899
+ """List of selected query parameter values."""
1900
+
1901
+ def as_dict(self) -> dict:
1902
+ """Serializes the EnumValue into a dictionary suitable for use as a JSON request body."""
1903
+ body = {}
1904
+ if self.enum_options is not None: body['enum_options'] = self.enum_options
1905
+ if self.multi_values_options: body['multi_values_options'] = self.multi_values_options.as_dict()
1906
+ if self.values: body['values'] = [v for v in self.values]
1907
+ return body
1908
+
1909
+ @classmethod
1910
+ def from_dict(cls, d: Dict[str, any]) -> EnumValue:
1911
+ """Deserializes the EnumValue from a dictionary."""
1912
+ return cls(enum_options=d.get('enum_options', None),
1913
+ multi_values_options=_from_dict(d, 'multi_values_options', MultiValuesOptions),
1914
+ values=d.get('values', None))
1915
+
1916
+
1387
1917
  @dataclass
1388
1918
  class ExecuteStatementRequest:
1389
1919
  statement: str
@@ -1407,26 +1937,6 @@ class ExecuteStatementRequest:
1407
1937
  [`USE CATALOG`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-catalog.html"""
1408
1938
 
1409
1939
  disposition: Optional[Disposition] = None
1410
- """The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`.
1411
-
1412
- Statements executed with `INLINE` disposition will return result data inline, in `JSON_ARRAY`
1413
- format, in a series of chunks. If a given statement produces a result set with a size larger
1414
- than 25 MiB, that statement execution is aborted, and no result set will be available.
1415
-
1416
- **NOTE** Byte limits are computed based upon internal representations of the result set data,
1417
- and might not match the sizes visible in JSON responses.
1418
-
1419
- Statements executed with `EXTERNAL_LINKS` disposition will return result data as external links:
1420
- URLs that point to cloud storage internal to the workspace. Using `EXTERNAL_LINKS` disposition
1421
- allows statements to generate arbitrarily sized result sets for fetching up to 100 GiB. The
1422
- resulting links have two important properties:
1423
-
1424
- 1. They point to resources _external_ to the Databricks compute; therefore any associated
1425
- authentication information (typically a personal access token, OAuth token, or similar) _must be
1426
- removed_ when fetching from these links.
1427
-
1428
- 2. These are presigned URLs with a specific expiration, indicated in the response. The behavior
1429
- when attempting to use an expired link is cloud specific."""
1430
1940
 
1431
1941
  format: Optional[Format] = None
1432
1942
  """Statement execution supports three result formats: `JSON_ARRAY` (default), `ARROW_STREAM`, and
@@ -1565,43 +2075,6 @@ class ExecuteStatementRequestOnWaitTimeout(Enum):
1565
2075
  CONTINUE = 'CONTINUE'
1566
2076
 
1567
2077
 
1568
- @dataclass
1569
- class ExecuteStatementResponse:
1570
- manifest: Optional[ResultManifest] = None
1571
- """The result manifest provides schema and metadata for the result set."""
1572
-
1573
- result: Optional[ResultData] = None
1574
- """Contains the result data of a single chunk when using `INLINE` disposition. When using
1575
- `EXTERNAL_LINKS` disposition, the array `external_links` is used instead to provide presigned
1576
- URLs to the result data in cloud storage. Exactly one of these alternatives is used. (While the
1577
- `external_links` array prepares the API to return multiple links in a single response. Currently
1578
- only a single link is returned.)"""
1579
-
1580
- statement_id: Optional[str] = None
1581
- """The statement ID is returned upon successfully submitting a SQL statement, and is a required
1582
- reference for all subsequent calls."""
1583
-
1584
- status: Optional[StatementStatus] = None
1585
- """The status response includes execution state and if relevant, error information."""
1586
-
1587
- def as_dict(self) -> dict:
1588
- """Serializes the ExecuteStatementResponse into a dictionary suitable for use as a JSON request body."""
1589
- body = {}
1590
- if self.manifest: body['manifest'] = self.manifest.as_dict()
1591
- if self.result: body['result'] = self.result.as_dict()
1592
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1593
- if self.status: body['status'] = self.status.as_dict()
1594
- return body
1595
-
1596
- @classmethod
1597
- def from_dict(cls, d: Dict[str, any]) -> ExecuteStatementResponse:
1598
- """Deserializes the ExecuteStatementResponse from a dictionary."""
1599
- return cls(manifest=_from_dict(d, 'manifest', ResultManifest),
1600
- result=_from_dict(d, 'result', ResultData),
1601
- statement_id=d.get('statement_id', None),
1602
- status=_from_dict(d, 'status', StatementStatus))
1603
-
1604
-
1605
2078
  @dataclass
1606
2079
  class ExternalLink:
1607
2080
  byte_count: Optional[int] = None
@@ -1616,9 +2089,6 @@ class ExternalLink:
1616
2089
  which point a new `external_link` must be requested."""
1617
2090
 
1618
2091
  external_link: Optional[str] = None
1619
- """A presigned URL pointing to a chunk of result data, hosted by an external service, with a short
1620
- expiration time (<= 15 minutes). As this URL contains a temporary credential, it should be
1621
- considered sensitive and the client should not expose this URL in a log."""
1622
2092
 
1623
2093
  http_headers: Optional[Dict[str, str]] = None
1624
2094
  """HTTP headers that must be included with a GET request to the `external_link`. Each header is
@@ -1705,43 +2175,6 @@ class GetResponse:
1705
2175
  object_type=_enum(d, 'object_type', ObjectType))
1706
2176
 
1707
2177
 
1708
- @dataclass
1709
- class GetStatementResponse:
1710
- manifest: Optional[ResultManifest] = None
1711
- """The result manifest provides schema and metadata for the result set."""
1712
-
1713
- result: Optional[ResultData] = None
1714
- """Contains the result data of a single chunk when using `INLINE` disposition. When using
1715
- `EXTERNAL_LINKS` disposition, the array `external_links` is used instead to provide presigned
1716
- URLs to the result data in cloud storage. Exactly one of these alternatives is used. (While the
1717
- `external_links` array prepares the API to return multiple links in a single response. Currently
1718
- only a single link is returned.)"""
1719
-
1720
- statement_id: Optional[str] = None
1721
- """The statement ID is returned upon successfully submitting a SQL statement, and is a required
1722
- reference for all subsequent calls."""
1723
-
1724
- status: Optional[StatementStatus] = None
1725
- """The status response includes execution state and if relevant, error information."""
1726
-
1727
- def as_dict(self) -> dict:
1728
- """Serializes the GetStatementResponse into a dictionary suitable for use as a JSON request body."""
1729
- body = {}
1730
- if self.manifest: body['manifest'] = self.manifest.as_dict()
1731
- if self.result: body['result'] = self.result.as_dict()
1732
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1733
- if self.status: body['status'] = self.status.as_dict()
1734
- return body
1735
-
1736
- @classmethod
1737
- def from_dict(cls, d: Dict[str, any]) -> GetStatementResponse:
1738
- """Deserializes the GetStatementResponse from a dictionary."""
1739
- return cls(manifest=_from_dict(d, 'manifest', ResultManifest),
1740
- result=_from_dict(d, 'result', ResultData),
1741
- statement_id=d.get('statement_id', None),
1742
- status=_from_dict(d, 'status', StatementStatus))
1743
-
1744
-
1745
2178
  @dataclass
1746
2179
  class GetWarehousePermissionLevelsResponse:
1747
2180
  permission_levels: Optional[List[WarehousePermissionsDescription]] = None
@@ -1987,92 +2420,601 @@ class GetWorkspaceWarehouseConfigResponseSecurityPolicy(Enum):
1987
2420
  PASSTHROUGH = 'PASSTHROUGH'
1988
2421
 
1989
2422
 
1990
- class ListOrder(Enum):
1991
-
1992
- CREATED_AT = 'created_at'
1993
- NAME = 'name'
1994
-
1995
-
1996
2423
  @dataclass
1997
- class ListQueriesResponse:
1998
- has_next_page: Optional[bool] = None
1999
- """Whether there is another page of results."""
2424
+ class LegacyAlert:
2425
+ created_at: Optional[str] = None
2426
+ """Timestamp when the alert was created."""
2000
2427
 
2001
- next_page_token: Optional[str] = None
2002
- """A token that can be used to get the next page of results."""
2428
+ id: Optional[str] = None
2429
+ """Alert ID."""
2003
2430
 
2004
- res: Optional[List[QueryInfo]] = None
2431
+ last_triggered_at: Optional[str] = None
2432
+ """Timestamp when the alert was last triggered."""
2005
2433
 
2006
- def as_dict(self) -> dict:
2007
- """Serializes the ListQueriesResponse into a dictionary suitable for use as a JSON request body."""
2008
- body = {}
2009
- if self.has_next_page is not None: body['has_next_page'] = self.has_next_page
2010
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2011
- if self.res: body['res'] = [v.as_dict() for v in self.res]
2012
- return body
2434
+ name: Optional[str] = None
2435
+ """Name of the alert."""
2013
2436
 
2014
- @classmethod
2015
- def from_dict(cls, d: Dict[str, any]) -> ListQueriesResponse:
2016
- """Deserializes the ListQueriesResponse from a dictionary."""
2017
- return cls(has_next_page=d.get('has_next_page', None),
2018
- next_page_token=d.get('next_page_token', None),
2019
- res=_repeated_dict(d, 'res', QueryInfo))
2437
+ options: Optional[AlertOptions] = None
2438
+ """Alert configuration options."""
2020
2439
 
2440
+ parent: Optional[str] = None
2441
+ """The identifier of the workspace folder containing the object."""
2021
2442
 
2022
- @dataclass
2023
- class ListResponse:
2024
- count: Optional[int] = None
2025
- """The total number of dashboards."""
2443
+ query: Optional[AlertQuery] = None
2026
2444
 
2027
- page: Optional[int] = None
2028
- """The current page being displayed."""
2445
+ rearm: Optional[int] = None
2446
+ """Number of seconds after being triggered before the alert rearms itself and can be triggered
2447
+ again. If `null`, alert will never be triggered again."""
2029
2448
 
2030
- page_size: Optional[int] = None
2031
- """The number of dashboards per page."""
2449
+ state: Optional[LegacyAlertState] = None
2450
+ """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated
2451
+ and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions)."""
2032
2452
 
2033
- results: Optional[List[Dashboard]] = None
2034
- """List of dashboards returned."""
2453
+ updated_at: Optional[str] = None
2454
+ """Timestamp when the alert was last updated."""
2455
+
2456
+ user: Optional[User] = None
2035
2457
 
2036
2458
  def as_dict(self) -> dict:
2037
- """Serializes the ListResponse into a dictionary suitable for use as a JSON request body."""
2459
+ """Serializes the LegacyAlert into a dictionary suitable for use as a JSON request body."""
2038
2460
  body = {}
2039
- if self.count is not None: body['count'] = self.count
2040
- if self.page is not None: body['page'] = self.page
2041
- if self.page_size is not None: body['page_size'] = self.page_size
2042
- if self.results: body['results'] = [v.as_dict() for v in self.results]
2461
+ if self.created_at is not None: body['created_at'] = self.created_at
2462
+ if self.id is not None: body['id'] = self.id
2463
+ if self.last_triggered_at is not None: body['last_triggered_at'] = self.last_triggered_at
2464
+ if self.name is not None: body['name'] = self.name
2465
+ if self.options: body['options'] = self.options.as_dict()
2466
+ if self.parent is not None: body['parent'] = self.parent
2467
+ if self.query: body['query'] = self.query.as_dict()
2468
+ if self.rearm is not None: body['rearm'] = self.rearm
2469
+ if self.state is not None: body['state'] = self.state.value
2470
+ if self.updated_at is not None: body['updated_at'] = self.updated_at
2471
+ if self.user: body['user'] = self.user.as_dict()
2043
2472
  return body
2044
2473
 
2045
2474
  @classmethod
2046
- def from_dict(cls, d: Dict[str, any]) -> ListResponse:
2047
- """Deserializes the ListResponse from a dictionary."""
2048
- return cls(count=d.get('count', None),
2049
- page=d.get('page', None),
2050
- page_size=d.get('page_size', None),
2051
- results=_repeated_dict(d, 'results', Dashboard))
2052
-
2475
+ def from_dict(cls, d: Dict[str, any]) -> LegacyAlert:
2476
+ """Deserializes the LegacyAlert from a dictionary."""
2477
+ return cls(created_at=d.get('created_at', None),
2478
+ id=d.get('id', None),
2479
+ last_triggered_at=d.get('last_triggered_at', None),
2480
+ name=d.get('name', None),
2481
+ options=_from_dict(d, 'options', AlertOptions),
2482
+ parent=d.get('parent', None),
2483
+ query=_from_dict(d, 'query', AlertQuery),
2484
+ rearm=d.get('rearm', None),
2485
+ state=_enum(d, 'state', LegacyAlertState),
2486
+ updated_at=d.get('updated_at', None),
2487
+ user=_from_dict(d, 'user', User))
2053
2488
 
2054
- @dataclass
2055
- class ListWarehousesResponse:
2056
- warehouses: Optional[List[EndpointInfo]] = None
2057
- """A list of warehouses and their configurations."""
2058
2489
 
2059
- def as_dict(self) -> dict:
2060
- """Serializes the ListWarehousesResponse into a dictionary suitable for use as a JSON request body."""
2061
- body = {}
2062
- if self.warehouses: body['warehouses'] = [v.as_dict() for v in self.warehouses]
2063
- return body
2490
+ class LegacyAlertState(Enum):
2491
+ """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated
2492
+ and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions)."""
2064
2493
 
2065
- @classmethod
2066
- def from_dict(cls, d: Dict[str, any]) -> ListWarehousesResponse:
2067
- """Deserializes the ListWarehousesResponse from a dictionary."""
2068
- return cls(warehouses=_repeated_dict(d, 'warehouses', EndpointInfo))
2494
+ OK = 'ok'
2495
+ TRIGGERED = 'triggered'
2496
+ UNKNOWN = 'unknown'
2069
2497
 
2070
2498
 
2071
2499
  @dataclass
2072
- class MultiValuesOptions:
2073
- """If specified, allows multiple values to be selected for this parameter. Only applies to dropdown
2074
- list and query-based dropdown list parameters."""
2500
+ class LegacyQuery:
2501
+ can_edit: Optional[bool] = None
2502
+ """Describes whether the authenticated user is allowed to edit the definition of this query."""
2075
2503
 
2504
+ created_at: Optional[str] = None
2505
+ """The timestamp when this query was created."""
2506
+
2507
+ data_source_id: Optional[str] = None
2508
+ """Data source ID maps to the ID of the data source used by the resource and is distinct from the
2509
+ warehouse ID. [Learn more]
2510
+
2511
+ [Learn more]: https://docs.databricks.com/api/workspace/datasources/list"""
2512
+
2513
+ description: Optional[str] = None
2514
+ """General description that conveys additional information about this query such as usage notes."""
2515
+
2516
+ id: Optional[str] = None
2517
+ """Query ID."""
2518
+
2519
+ is_archived: Optional[bool] = None
2520
+ """Indicates whether the query is trashed. Trashed queries can't be used in dashboards, or appear
2521
+ in search results. If this boolean is `true`, the `options` property for this query includes a
2522
+ `moved_to_trash_at` timestamp. Trashed queries are permanently deleted after 30 days."""
2523
+
2524
+ is_draft: Optional[bool] = None
2525
+ """Whether the query is a draft. Draft queries only appear in list views for their owners.
2526
+ Visualizations from draft queries cannot appear on dashboards."""
2527
+
2528
+ is_favorite: Optional[bool] = None
2529
+ """Whether this query object appears in the current user's favorites list. This flag determines
2530
+ whether the star icon for favorites is selected."""
2531
+
2532
+ is_safe: Optional[bool] = None
2533
+ """Text parameter types are not safe from SQL injection for all types of data source. Set this
2534
+ Boolean parameter to `true` if a query either does not use any text type parameters or uses a
2535
+ data source type where text type parameters are handled safely."""
2536
+
2537
+ last_modified_by: Optional[User] = None
2538
+
2539
+ last_modified_by_id: Optional[int] = None
2540
+ """The ID of the user who last saved changes to this query."""
2541
+
2542
+ latest_query_data_id: Optional[str] = None
2543
+ """If there is a cached result for this query and user, this field includes the query result ID. If
2544
+ this query uses parameters, this field is always null."""
2545
+
2546
+ name: Optional[str] = None
2547
+ """The title of this query that appears in list views, widget headings, and on the query page."""
2548
+
2549
+ options: Optional[QueryOptions] = None
2550
+
2551
+ parent: Optional[str] = None
2552
+ """The identifier of the workspace folder containing the object."""
2553
+
2554
+ permission_tier: Optional[PermissionLevel] = None
2555
+ """* `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * `CAN_EDIT`: Can edit the query
2556
+ * `CAN_MANAGE`: Can manage the query"""
2557
+
2558
+ query: Optional[str] = None
2559
+ """The text of the query to be run."""
2560
+
2561
+ query_hash: Optional[str] = None
2562
+ """A SHA-256 hash of the query text along with the authenticated user ID."""
2563
+
2564
+ run_as_role: Optional[RunAsRole] = None
2565
+ """Sets the **Run as** role for the object. Must be set to one of `"viewer"` (signifying "run as
2566
+ viewer" behavior) or `"owner"` (signifying "run as owner" behavior)"""
2567
+
2568
+ tags: Optional[List[str]] = None
2569
+
2570
+ updated_at: Optional[str] = None
2571
+ """The timestamp at which this query was last updated."""
2572
+
2573
+ user: Optional[User] = None
2574
+
2575
+ user_id: Optional[int] = None
2576
+ """The ID of the user who owns the query."""
2577
+
2578
+ visualizations: Optional[List[LegacyVisualization]] = None
2579
+
2580
+ def as_dict(self) -> dict:
2581
+ """Serializes the LegacyQuery into a dictionary suitable for use as a JSON request body."""
2582
+ body = {}
2583
+ if self.can_edit is not None: body['can_edit'] = self.can_edit
2584
+ if self.created_at is not None: body['created_at'] = self.created_at
2585
+ if self.data_source_id is not None: body['data_source_id'] = self.data_source_id
2586
+ if self.description is not None: body['description'] = self.description
2587
+ if self.id is not None: body['id'] = self.id
2588
+ if self.is_archived is not None: body['is_archived'] = self.is_archived
2589
+ if self.is_draft is not None: body['is_draft'] = self.is_draft
2590
+ if self.is_favorite is not None: body['is_favorite'] = self.is_favorite
2591
+ if self.is_safe is not None: body['is_safe'] = self.is_safe
2592
+ if self.last_modified_by: body['last_modified_by'] = self.last_modified_by.as_dict()
2593
+ if self.last_modified_by_id is not None: body['last_modified_by_id'] = self.last_modified_by_id
2594
+ if self.latest_query_data_id is not None: body['latest_query_data_id'] = self.latest_query_data_id
2595
+ if self.name is not None: body['name'] = self.name
2596
+ if self.options: body['options'] = self.options.as_dict()
2597
+ if self.parent is not None: body['parent'] = self.parent
2598
+ if self.permission_tier is not None: body['permission_tier'] = self.permission_tier.value
2599
+ if self.query is not None: body['query'] = self.query
2600
+ if self.query_hash is not None: body['query_hash'] = self.query_hash
2601
+ if self.run_as_role is not None: body['run_as_role'] = self.run_as_role.value
2602
+ if self.tags: body['tags'] = [v for v in self.tags]
2603
+ if self.updated_at is not None: body['updated_at'] = self.updated_at
2604
+ if self.user: body['user'] = self.user.as_dict()
2605
+ if self.user_id is not None: body['user_id'] = self.user_id
2606
+ if self.visualizations: body['visualizations'] = [v.as_dict() for v in self.visualizations]
2607
+ return body
2608
+
2609
+ @classmethod
2610
+ def from_dict(cls, d: Dict[str, any]) -> LegacyQuery:
2611
+ """Deserializes the LegacyQuery from a dictionary."""
2612
+ return cls(can_edit=d.get('can_edit', None),
2613
+ created_at=d.get('created_at', None),
2614
+ data_source_id=d.get('data_source_id', None),
2615
+ description=d.get('description', None),
2616
+ id=d.get('id', None),
2617
+ is_archived=d.get('is_archived', None),
2618
+ is_draft=d.get('is_draft', None),
2619
+ is_favorite=d.get('is_favorite', None),
2620
+ is_safe=d.get('is_safe', None),
2621
+ last_modified_by=_from_dict(d, 'last_modified_by', User),
2622
+ last_modified_by_id=d.get('last_modified_by_id', None),
2623
+ latest_query_data_id=d.get('latest_query_data_id', None),
2624
+ name=d.get('name', None),
2625
+ options=_from_dict(d, 'options', QueryOptions),
2626
+ parent=d.get('parent', None),
2627
+ permission_tier=_enum(d, 'permission_tier', PermissionLevel),
2628
+ query=d.get('query', None),
2629
+ query_hash=d.get('query_hash', None),
2630
+ run_as_role=_enum(d, 'run_as_role', RunAsRole),
2631
+ tags=d.get('tags', None),
2632
+ updated_at=d.get('updated_at', None),
2633
+ user=_from_dict(d, 'user', User),
2634
+ user_id=d.get('user_id', None),
2635
+ visualizations=_repeated_dict(d, 'visualizations', LegacyVisualization))
2636
+
2637
+
2638
+ @dataclass
2639
+ class LegacyVisualization:
2640
+ """The visualization description API changes frequently and is unsupported. You can duplicate a
2641
+ visualization by copying description objects received _from the API_ and then using them to
2642
+ create a new one with a POST request to the same endpoint. Databricks does not recommend
2643
+ constructing ad-hoc visualizations entirely in JSON."""
2644
+
2645
+ created_at: Optional[str] = None
2646
+
2647
+ description: Optional[str] = None
2648
+ """A short description of this visualization. This is not displayed in the UI."""
2649
+
2650
+ id: Optional[str] = None
2651
+ """The UUID for this visualization."""
2652
+
2653
+ name: Optional[str] = None
2654
+ """The name of the visualization that appears on dashboards and the query screen."""
2655
+
2656
+ options: Optional[Any] = None
2657
+ """The options object varies widely from one visualization type to the next and is unsupported.
2658
+ Databricks does not recommend modifying visualization settings in JSON."""
2659
+
2660
+ query: Optional[LegacyQuery] = None
2661
+
2662
+ type: Optional[str] = None
2663
+ """The type of visualization: chart, table, pivot table, and so on."""
2664
+
2665
+ updated_at: Optional[str] = None
2666
+
2667
+ def as_dict(self) -> dict:
2668
+ """Serializes the LegacyVisualization into a dictionary suitable for use as a JSON request body."""
2669
+ body = {}
2670
+ if self.created_at is not None: body['created_at'] = self.created_at
2671
+ if self.description is not None: body['description'] = self.description
2672
+ if self.id is not None: body['id'] = self.id
2673
+ if self.name is not None: body['name'] = self.name
2674
+ if self.options: body['options'] = self.options
2675
+ if self.query: body['query'] = self.query.as_dict()
2676
+ if self.type is not None: body['type'] = self.type
2677
+ if self.updated_at is not None: body['updated_at'] = self.updated_at
2678
+ return body
2679
+
2680
+ @classmethod
2681
+ def from_dict(cls, d: Dict[str, any]) -> LegacyVisualization:
2682
+ """Deserializes the LegacyVisualization from a dictionary."""
2683
+ return cls(created_at=d.get('created_at', None),
2684
+ description=d.get('description', None),
2685
+ id=d.get('id', None),
2686
+ name=d.get('name', None),
2687
+ options=d.get('options', None),
2688
+ query=_from_dict(d, 'query', LegacyQuery),
2689
+ type=d.get('type', None),
2690
+ updated_at=d.get('updated_at', None))
2691
+
2692
+
2693
+ class LifecycleState(Enum):
2694
+
2695
+ ACTIVE = 'ACTIVE'
2696
+ TRASHED = 'TRASHED'
2697
+
2698
+
2699
+ @dataclass
2700
+ class ListAlertsResponse:
2701
+ next_page_token: Optional[str] = None
2702
+
2703
+ results: Optional[List[ListAlertsResponseAlert]] = None
2704
+
2705
+ def as_dict(self) -> dict:
2706
+ """Serializes the ListAlertsResponse into a dictionary suitable for use as a JSON request body."""
2707
+ body = {}
2708
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2709
+ if self.results: body['results'] = [v.as_dict() for v in self.results]
2710
+ return body
2711
+
2712
+ @classmethod
2713
+ def from_dict(cls, d: Dict[str, any]) -> ListAlertsResponse:
2714
+ """Deserializes the ListAlertsResponse from a dictionary."""
2715
+ return cls(next_page_token=d.get('next_page_token', None),
2716
+ results=_repeated_dict(d, 'results', ListAlertsResponseAlert))
2717
+
2718
+
2719
+ @dataclass
2720
+ class ListAlertsResponseAlert:
2721
+ condition: Optional[AlertCondition] = None
2722
+ """Trigger conditions of the alert."""
2723
+
2724
+ create_time: Optional[str] = None
2725
+ """The timestamp indicating when the alert was created."""
2726
+
2727
+ custom_body: Optional[str] = None
2728
+ """Custom body of alert notification, if it exists. See [here] for custom templating instructions.
2729
+
2730
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
2731
+
2732
+ custom_subject: Optional[str] = None
2733
+ """Custom subject of alert notification, if it exists. This can include email subject entries and
2734
+ Slack notification headers, for example. See [here] for custom templating instructions.
2735
+
2736
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
2737
+
2738
+ display_name: Optional[str] = None
2739
+ """The display name of the alert."""
2740
+
2741
+ id: Optional[str] = None
2742
+ """UUID identifying the alert."""
2743
+
2744
+ lifecycle_state: Optional[LifecycleState] = None
2745
+ """The workspace state of the alert. Used for tracking trashed status."""
2746
+
2747
+ owner_user_name: Optional[str] = None
2748
+ """The owner's username. This field is set to "Unavailable" if the user has been deleted."""
2749
+
2750
+ query_id: Optional[str] = None
2751
+ """UUID of the query attached to the alert."""
2752
+
2753
+ seconds_to_retrigger: Optional[int] = None
2754
+ """Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it
2755
+ can be triggered again. If 0 or not specified, the alert will not be triggered again."""
2756
+
2757
+ state: Optional[AlertState] = None
2758
+ """Current state of the alert's trigger status. This field is set to UNKNOWN if the alert has not
2759
+ yet been evaluated or ran into an error during the last evaluation."""
2760
+
2761
+ trigger_time: Optional[str] = None
2762
+ """Timestamp when the alert was last triggered, if the alert has been triggered before."""
2763
+
2764
+ update_time: Optional[str] = None
2765
+ """The timestamp indicating when the alert was updated."""
2766
+
2767
+ def as_dict(self) -> dict:
2768
+ """Serializes the ListAlertsResponseAlert into a dictionary suitable for use as a JSON request body."""
2769
+ body = {}
2770
+ if self.condition: body['condition'] = self.condition.as_dict()
2771
+ if self.create_time is not None: body['create_time'] = self.create_time
2772
+ if self.custom_body is not None: body['custom_body'] = self.custom_body
2773
+ if self.custom_subject is not None: body['custom_subject'] = self.custom_subject
2774
+ if self.display_name is not None: body['display_name'] = self.display_name
2775
+ if self.id is not None: body['id'] = self.id
2776
+ if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state.value
2777
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
2778
+ if self.query_id is not None: body['query_id'] = self.query_id
2779
+ if self.seconds_to_retrigger is not None: body['seconds_to_retrigger'] = self.seconds_to_retrigger
2780
+ if self.state is not None: body['state'] = self.state.value
2781
+ if self.trigger_time is not None: body['trigger_time'] = self.trigger_time
2782
+ if self.update_time is not None: body['update_time'] = self.update_time
2783
+ return body
2784
+
2785
+ @classmethod
2786
+ def from_dict(cls, d: Dict[str, any]) -> ListAlertsResponseAlert:
2787
+ """Deserializes the ListAlertsResponseAlert from a dictionary."""
2788
+ return cls(condition=_from_dict(d, 'condition', AlertCondition),
2789
+ create_time=d.get('create_time', None),
2790
+ custom_body=d.get('custom_body', None),
2791
+ custom_subject=d.get('custom_subject', None),
2792
+ display_name=d.get('display_name', None),
2793
+ id=d.get('id', None),
2794
+ lifecycle_state=_enum(d, 'lifecycle_state', LifecycleState),
2795
+ owner_user_name=d.get('owner_user_name', None),
2796
+ query_id=d.get('query_id', None),
2797
+ seconds_to_retrigger=d.get('seconds_to_retrigger', None),
2798
+ state=_enum(d, 'state', AlertState),
2799
+ trigger_time=d.get('trigger_time', None),
2800
+ update_time=d.get('update_time', None))
2801
+
2802
+
2803
+ class ListOrder(Enum):
2804
+
2805
+ CREATED_AT = 'created_at'
2806
+ NAME = 'name'
2807
+
2808
+
2809
+ @dataclass
2810
+ class ListQueriesResponse:
2811
+ has_next_page: Optional[bool] = None
2812
+ """Whether there is another page of results."""
2813
+
2814
+ next_page_token: Optional[str] = None
2815
+ """A token that can be used to get the next page of results."""
2816
+
2817
+ res: Optional[List[QueryInfo]] = None
2818
+
2819
+ def as_dict(self) -> dict:
2820
+ """Serializes the ListQueriesResponse into a dictionary suitable for use as a JSON request body."""
2821
+ body = {}
2822
+ if self.has_next_page is not None: body['has_next_page'] = self.has_next_page
2823
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2824
+ if self.res: body['res'] = [v.as_dict() for v in self.res]
2825
+ return body
2826
+
2827
+ @classmethod
2828
+ def from_dict(cls, d: Dict[str, any]) -> ListQueriesResponse:
2829
+ """Deserializes the ListQueriesResponse from a dictionary."""
2830
+ return cls(has_next_page=d.get('has_next_page', None),
2831
+ next_page_token=d.get('next_page_token', None),
2832
+ res=_repeated_dict(d, 'res', QueryInfo))
2833
+
2834
+
2835
+ @dataclass
2836
+ class ListQueryObjectsResponse:
2837
+ next_page_token: Optional[str] = None
2838
+
2839
+ results: Optional[List[ListQueryObjectsResponseQuery]] = None
2840
+
2841
+ def as_dict(self) -> dict:
2842
+ """Serializes the ListQueryObjectsResponse into a dictionary suitable for use as a JSON request body."""
2843
+ body = {}
2844
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2845
+ if self.results: body['results'] = [v.as_dict() for v in self.results]
2846
+ return body
2847
+
2848
+ @classmethod
2849
+ def from_dict(cls, d: Dict[str, any]) -> ListQueryObjectsResponse:
2850
+ """Deserializes the ListQueryObjectsResponse from a dictionary."""
2851
+ return cls(next_page_token=d.get('next_page_token', None),
2852
+ results=_repeated_dict(d, 'results', ListQueryObjectsResponseQuery))
2853
+
2854
+
2855
+ @dataclass
2856
+ class ListQueryObjectsResponseQuery:
2857
+ apply_auto_limit: Optional[bool] = None
2858
+ """Whether to apply a 1000 row limit to the query result."""
2859
+
2860
+ catalog: Optional[str] = None
2861
+ """Name of the catalog where this query will be executed."""
2862
+
2863
+ create_time: Optional[str] = None
2864
+ """Timestamp when this query was created."""
2865
+
2866
+ description: Optional[str] = None
2867
+ """General description that conveys additional information about this query such as usage notes."""
2868
+
2869
+ display_name: Optional[str] = None
2870
+ """Display name of the query that appears in list views, widget headings, and on the query page."""
2871
+
2872
+ id: Optional[str] = None
2873
+ """UUID identifying the query."""
2874
+
2875
+ last_modifier_user_name: Optional[str] = None
2876
+ """Username of the user who last saved changes to this query."""
2877
+
2878
+ lifecycle_state: Optional[LifecycleState] = None
2879
+ """Indicates whether the query is trashed."""
2880
+
2881
+ owner_user_name: Optional[str] = None
2882
+ """Username of the user that owns the query."""
2883
+
2884
+ parameters: Optional[List[QueryParameter]] = None
2885
+ """List of query parameter definitions."""
2886
+
2887
+ query_text: Optional[str] = None
2888
+ """Text of the query to be run."""
2889
+
2890
+ run_as_mode: Optional[RunAsMode] = None
2891
+ """Sets the "Run as" role for the object."""
2892
+
2893
+ schema: Optional[str] = None
2894
+ """Name of the schema where this query will be executed."""
2895
+
2896
+ tags: Optional[List[str]] = None
2897
+
2898
+ update_time: Optional[str] = None
2899
+ """Timestamp when this query was last updated."""
2900
+
2901
+ warehouse_id: Optional[str] = None
2902
+ """ID of the SQL warehouse attached to the query."""
2903
+
2904
+ def as_dict(self) -> dict:
2905
+ """Serializes the ListQueryObjectsResponseQuery into a dictionary suitable for use as a JSON request body."""
2906
+ body = {}
2907
+ if self.apply_auto_limit is not None: body['apply_auto_limit'] = self.apply_auto_limit
2908
+ if self.catalog is not None: body['catalog'] = self.catalog
2909
+ if self.create_time is not None: body['create_time'] = self.create_time
2910
+ if self.description is not None: body['description'] = self.description
2911
+ if self.display_name is not None: body['display_name'] = self.display_name
2912
+ if self.id is not None: body['id'] = self.id
2913
+ if self.last_modifier_user_name is not None:
2914
+ body['last_modifier_user_name'] = self.last_modifier_user_name
2915
+ if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state.value
2916
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
2917
+ if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters]
2918
+ if self.query_text is not None: body['query_text'] = self.query_text
2919
+ if self.run_as_mode is not None: body['run_as_mode'] = self.run_as_mode.value
2920
+ if self.schema is not None: body['schema'] = self.schema
2921
+ if self.tags: body['tags'] = [v for v in self.tags]
2922
+ if self.update_time is not None: body['update_time'] = self.update_time
2923
+ if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
2924
+ return body
2925
+
2926
+ @classmethod
2927
+ def from_dict(cls, d: Dict[str, any]) -> ListQueryObjectsResponseQuery:
2928
+ """Deserializes the ListQueryObjectsResponseQuery from a dictionary."""
2929
+ return cls(apply_auto_limit=d.get('apply_auto_limit', None),
2930
+ catalog=d.get('catalog', None),
2931
+ create_time=d.get('create_time', None),
2932
+ description=d.get('description', None),
2933
+ display_name=d.get('display_name', None),
2934
+ id=d.get('id', None),
2935
+ last_modifier_user_name=d.get('last_modifier_user_name', None),
2936
+ lifecycle_state=_enum(d, 'lifecycle_state', LifecycleState),
2937
+ owner_user_name=d.get('owner_user_name', None),
2938
+ parameters=_repeated_dict(d, 'parameters', QueryParameter),
2939
+ query_text=d.get('query_text', None),
2940
+ run_as_mode=_enum(d, 'run_as_mode', RunAsMode),
2941
+ schema=d.get('schema', None),
2942
+ tags=d.get('tags', None),
2943
+ update_time=d.get('update_time', None),
2944
+ warehouse_id=d.get('warehouse_id', None))
2945
+
2946
+
2947
+ @dataclass
2948
+ class ListResponse:
2949
+ count: Optional[int] = None
2950
+ """The total number of dashboards."""
2951
+
2952
+ page: Optional[int] = None
2953
+ """The current page being displayed."""
2954
+
2955
+ page_size: Optional[int] = None
2956
+ """The number of dashboards per page."""
2957
+
2958
+ results: Optional[List[Dashboard]] = None
2959
+ """List of dashboards returned."""
2960
+
2961
+ def as_dict(self) -> dict:
2962
+ """Serializes the ListResponse into a dictionary suitable for use as a JSON request body."""
2963
+ body = {}
2964
+ if self.count is not None: body['count'] = self.count
2965
+ if self.page is not None: body['page'] = self.page
2966
+ if self.page_size is not None: body['page_size'] = self.page_size
2967
+ if self.results: body['results'] = [v.as_dict() for v in self.results]
2968
+ return body
2969
+
2970
+ @classmethod
2971
+ def from_dict(cls, d: Dict[str, any]) -> ListResponse:
2972
+ """Deserializes the ListResponse from a dictionary."""
2973
+ return cls(count=d.get('count', None),
2974
+ page=d.get('page', None),
2975
+ page_size=d.get('page_size', None),
2976
+ results=_repeated_dict(d, 'results', Dashboard))
2977
+
2978
+
2979
+ @dataclass
2980
+ class ListVisualizationsForQueryResponse:
2981
+ next_page_token: Optional[str] = None
2982
+
2983
+ results: Optional[List[Visualization]] = None
2984
+
2985
+ def as_dict(self) -> dict:
2986
+ """Serializes the ListVisualizationsForQueryResponse into a dictionary suitable for use as a JSON request body."""
2987
+ body = {}
2988
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2989
+ if self.results: body['results'] = [v.as_dict() for v in self.results]
2990
+ return body
2991
+
2992
+ @classmethod
2993
+ def from_dict(cls, d: Dict[str, any]) -> ListVisualizationsForQueryResponse:
2994
+ """Deserializes the ListVisualizationsForQueryResponse from a dictionary."""
2995
+ return cls(next_page_token=d.get('next_page_token', None),
2996
+ results=_repeated_dict(d, 'results', Visualization))
2997
+
2998
+
2999
+ @dataclass
3000
+ class ListWarehousesResponse:
3001
+ warehouses: Optional[List[EndpointInfo]] = None
3002
+ """A list of warehouses and their configurations."""
3003
+
3004
+ def as_dict(self) -> dict:
3005
+ """Serializes the ListWarehousesResponse into a dictionary suitable for use as a JSON request body."""
3006
+ body = {}
3007
+ if self.warehouses: body['warehouses'] = [v.as_dict() for v in self.warehouses]
3008
+ return body
3009
+
3010
+ @classmethod
3011
+ def from_dict(cls, d: Dict[str, any]) -> ListWarehousesResponse:
3012
+ """Deserializes the ListWarehousesResponse from a dictionary."""
3013
+ return cls(warehouses=_repeated_dict(d, 'warehouses', EndpointInfo))
3014
+
3015
+
3016
+ @dataclass
3017
+ class MultiValuesOptions:
2076
3018
  prefix: Optional[str] = None
2077
3019
  """Character that prefixes each selected parameter value."""
2078
3020
 
@@ -2098,6 +3040,22 @@ class MultiValuesOptions:
2098
3040
  suffix=d.get('suffix', None))
2099
3041
 
2100
3042
 
3043
+ @dataclass
3044
+ class NumericValue:
3045
+ value: Optional[float] = None
3046
+
3047
+ def as_dict(self) -> dict:
3048
+ """Serializes the NumericValue into a dictionary suitable for use as a JSON request body."""
3049
+ body = {}
3050
+ if self.value is not None: body['value'] = self.value
3051
+ return body
3052
+
3053
+ @classmethod
3054
+ def from_dict(cls, d: Dict[str, any]) -> NumericValue:
3055
+ """Deserializes the NumericValue from a dictionary."""
3056
+ return cls(value=d.get('value', None))
3057
+
3058
+
2101
3059
  class ObjectType(Enum):
2102
3060
  """A singular noun object type."""
2103
3061
 
@@ -2222,7 +3180,7 @@ class PermissionLevel(Enum):
2222
3180
 
2223
3181
 
2224
3182
  class PlansState(Enum):
2225
- """Whether plans exist for the execution, or the reason why they are missing"""
3183
+ """Possible Reasons for which we have not saved plans in the database"""
2226
3184
 
2227
3185
  EMPTY = 'EMPTY'
2228
3186
  EXISTS = 'EXISTS'
@@ -2234,141 +3192,126 @@ class PlansState(Enum):
2234
3192
 
2235
3193
  @dataclass
2236
3194
  class Query:
2237
- can_edit: Optional[bool] = None
2238
- """Describes whether the authenticated user is allowed to edit the definition of this query."""
3195
+ apply_auto_limit: Optional[bool] = None
3196
+ """Whether to apply a 1000 row limit to the query result."""
2239
3197
 
2240
- created_at: Optional[str] = None
2241
- """The timestamp when this query was created."""
3198
+ catalog: Optional[str] = None
3199
+ """Name of the catalog where this query will be executed."""
2242
3200
 
2243
- data_source_id: Optional[str] = None
2244
- """Data source ID maps to the ID of the data source used by the resource and is distinct from the
2245
- warehouse ID. [Learn more]
2246
-
2247
- [Learn more]: https://docs.databricks.com/api/workspace/datasources/list"""
3201
+ create_time: Optional[str] = None
3202
+ """Timestamp when this query was created."""
2248
3203
 
2249
3204
  description: Optional[str] = None
2250
3205
  """General description that conveys additional information about this query such as usage notes."""
2251
3206
 
2252
- id: Optional[str] = None
2253
- """Query ID."""
2254
-
2255
- is_archived: Optional[bool] = None
2256
- """Indicates whether the query is trashed. Trashed queries can't be used in dashboards, or appear
2257
- in search results. If this boolean is `true`, the `options` property for this query includes a
2258
- `moved_to_trash_at` timestamp. Trashed queries are permanently deleted after 30 days."""
2259
-
2260
- is_draft: Optional[bool] = None
2261
- """Whether the query is a draft. Draft queries only appear in list views for their owners.
2262
- Visualizations from draft queries cannot appear on dashboards."""
2263
-
2264
- is_favorite: Optional[bool] = None
2265
- """Whether this query object appears in the current user's favorites list. This flag determines
2266
- whether the star icon for favorites is selected."""
2267
-
2268
- is_safe: Optional[bool] = None
2269
- """Text parameter types are not safe from SQL injection for all types of data source. Set this
2270
- Boolean parameter to `true` if a query either does not use any text type parameters or uses a
2271
- data source type where text type parameters are handled safely."""
2272
-
2273
- last_modified_by: Optional[User] = None
3207
+ display_name: Optional[str] = None
3208
+ """Display name of the query that appears in list views, widget headings, and on the query page."""
2274
3209
 
2275
- last_modified_by_id: Optional[int] = None
2276
- """The ID of the user who last saved changes to this query."""
3210
+ id: Optional[str] = None
3211
+ """UUID identifying the query."""
2277
3212
 
2278
- latest_query_data_id: Optional[str] = None
2279
- """If there is a cached result for this query and user, this field includes the query result ID. If
2280
- this query uses parameters, this field is always null."""
3213
+ last_modifier_user_name: Optional[str] = None
3214
+ """Username of the user who last saved changes to this query."""
2281
3215
 
2282
- name: Optional[str] = None
2283
- """The title of this query that appears in list views, widget headings, and on the query page."""
3216
+ lifecycle_state: Optional[LifecycleState] = None
3217
+ """Indicates whether the query is trashed."""
2284
3218
 
2285
- options: Optional[QueryOptions] = None
3219
+ owner_user_name: Optional[str] = None
3220
+ """Username of the user that owns the query."""
2286
3221
 
2287
- parent: Optional[str] = None
2288
- """The identifier of the workspace folder containing the object."""
3222
+ parameters: Optional[List[QueryParameter]] = None
3223
+ """List of query parameter definitions."""
2289
3224
 
2290
- permission_tier: Optional[PermissionLevel] = None
2291
- """* `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * `CAN_EDIT`: Can edit the query
2292
- * `CAN_MANAGE`: Can manage the query"""
3225
+ parent_path: Optional[str] = None
3226
+ """Workspace path of the workspace folder containing the object."""
2293
3227
 
2294
- query: Optional[str] = None
2295
- """The text of the query to be run."""
3228
+ query_text: Optional[str] = None
3229
+ """Text of the query to be run."""
2296
3230
 
2297
- query_hash: Optional[str] = None
2298
- """A SHA-256 hash of the query text along with the authenticated user ID."""
3231
+ run_as_mode: Optional[RunAsMode] = None
3232
+ """Sets the "Run as" role for the object."""
2299
3233
 
2300
- run_as_role: Optional[RunAsRole] = None
2301
- """Sets the **Run as** role for the object. Must be set to one of `"viewer"` (signifying "run as
2302
- viewer" behavior) or `"owner"` (signifying "run as owner" behavior)"""
3234
+ schema: Optional[str] = None
3235
+ """Name of the schema where this query will be executed."""
2303
3236
 
2304
3237
  tags: Optional[List[str]] = None
2305
3238
 
2306
- updated_at: Optional[str] = None
2307
- """The timestamp at which this query was last updated."""
2308
-
2309
- user: Optional[User] = None
2310
-
2311
- user_id: Optional[int] = None
2312
- """The ID of the user who owns the query."""
3239
+ update_time: Optional[str] = None
3240
+ """Timestamp when this query was last updated."""
2313
3241
 
2314
- visualizations: Optional[List[Visualization]] = None
3242
+ warehouse_id: Optional[str] = None
3243
+ """ID of the SQL warehouse attached to the query."""
2315
3244
 
2316
3245
  def as_dict(self) -> dict:
2317
3246
  """Serializes the Query into a dictionary suitable for use as a JSON request body."""
2318
3247
  body = {}
2319
- if self.can_edit is not None: body['can_edit'] = self.can_edit
2320
- if self.created_at is not None: body['created_at'] = self.created_at
2321
- if self.data_source_id is not None: body['data_source_id'] = self.data_source_id
3248
+ if self.apply_auto_limit is not None: body['apply_auto_limit'] = self.apply_auto_limit
3249
+ if self.catalog is not None: body['catalog'] = self.catalog
3250
+ if self.create_time is not None: body['create_time'] = self.create_time
2322
3251
  if self.description is not None: body['description'] = self.description
3252
+ if self.display_name is not None: body['display_name'] = self.display_name
2323
3253
  if self.id is not None: body['id'] = self.id
2324
- if self.is_archived is not None: body['is_archived'] = self.is_archived
2325
- if self.is_draft is not None: body['is_draft'] = self.is_draft
2326
- if self.is_favorite is not None: body['is_favorite'] = self.is_favorite
2327
- if self.is_safe is not None: body['is_safe'] = self.is_safe
2328
- if self.last_modified_by: body['last_modified_by'] = self.last_modified_by.as_dict()
2329
- if self.last_modified_by_id is not None: body['last_modified_by_id'] = self.last_modified_by_id
2330
- if self.latest_query_data_id is not None: body['latest_query_data_id'] = self.latest_query_data_id
2331
- if self.name is not None: body['name'] = self.name
2332
- if self.options: body['options'] = self.options.as_dict()
2333
- if self.parent is not None: body['parent'] = self.parent
2334
- if self.permission_tier is not None: body['permission_tier'] = self.permission_tier.value
2335
- if self.query is not None: body['query'] = self.query
2336
- if self.query_hash is not None: body['query_hash'] = self.query_hash
2337
- if self.run_as_role is not None: body['run_as_role'] = self.run_as_role.value
3254
+ if self.last_modifier_user_name is not None:
3255
+ body['last_modifier_user_name'] = self.last_modifier_user_name
3256
+ if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state.value
3257
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
3258
+ if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters]
3259
+ if self.parent_path is not None: body['parent_path'] = self.parent_path
3260
+ if self.query_text is not None: body['query_text'] = self.query_text
3261
+ if self.run_as_mode is not None: body['run_as_mode'] = self.run_as_mode.value
3262
+ if self.schema is not None: body['schema'] = self.schema
2338
3263
  if self.tags: body['tags'] = [v for v in self.tags]
2339
- if self.updated_at is not None: body['updated_at'] = self.updated_at
2340
- if self.user: body['user'] = self.user.as_dict()
2341
- if self.user_id is not None: body['user_id'] = self.user_id
2342
- if self.visualizations: body['visualizations'] = [v.as_dict() for v in self.visualizations]
3264
+ if self.update_time is not None: body['update_time'] = self.update_time
3265
+ if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
2343
3266
  return body
2344
3267
 
2345
3268
  @classmethod
2346
3269
  def from_dict(cls, d: Dict[str, any]) -> Query:
2347
3270
  """Deserializes the Query from a dictionary."""
2348
- return cls(can_edit=d.get('can_edit', None),
2349
- created_at=d.get('created_at', None),
2350
- data_source_id=d.get('data_source_id', None),
3271
+ return cls(apply_auto_limit=d.get('apply_auto_limit', None),
3272
+ catalog=d.get('catalog', None),
3273
+ create_time=d.get('create_time', None),
2351
3274
  description=d.get('description', None),
3275
+ display_name=d.get('display_name', None),
2352
3276
  id=d.get('id', None),
2353
- is_archived=d.get('is_archived', None),
2354
- is_draft=d.get('is_draft', None),
2355
- is_favorite=d.get('is_favorite', None),
2356
- is_safe=d.get('is_safe', None),
2357
- last_modified_by=_from_dict(d, 'last_modified_by', User),
2358
- last_modified_by_id=d.get('last_modified_by_id', None),
2359
- latest_query_data_id=d.get('latest_query_data_id', None),
2360
- name=d.get('name', None),
2361
- options=_from_dict(d, 'options', QueryOptions),
2362
- parent=d.get('parent', None),
2363
- permission_tier=_enum(d, 'permission_tier', PermissionLevel),
2364
- query=d.get('query', None),
2365
- query_hash=d.get('query_hash', None),
2366
- run_as_role=_enum(d, 'run_as_role', RunAsRole),
3277
+ last_modifier_user_name=d.get('last_modifier_user_name', None),
3278
+ lifecycle_state=_enum(d, 'lifecycle_state', LifecycleState),
3279
+ owner_user_name=d.get('owner_user_name', None),
3280
+ parameters=_repeated_dict(d, 'parameters', QueryParameter),
3281
+ parent_path=d.get('parent_path', None),
3282
+ query_text=d.get('query_text', None),
3283
+ run_as_mode=_enum(d, 'run_as_mode', RunAsMode),
3284
+ schema=d.get('schema', None),
2367
3285
  tags=d.get('tags', None),
2368
- updated_at=d.get('updated_at', None),
2369
- user=_from_dict(d, 'user', User),
2370
- user_id=d.get('user_id', None),
2371
- visualizations=_repeated_dict(d, 'visualizations', Visualization))
3286
+ update_time=d.get('update_time', None),
3287
+ warehouse_id=d.get('warehouse_id', None))
3288
+
3289
+
3290
+ @dataclass
3291
+ class QueryBackedValue:
3292
+ multi_values_options: Optional[MultiValuesOptions] = None
3293
+ """If specified, allows multiple values to be selected for this parameter."""
3294
+
3295
+ query_id: Optional[str] = None
3296
+ """UUID of the query that provides the parameter values."""
3297
+
3298
+ values: Optional[List[str]] = None
3299
+ """List of selected query parameter values."""
3300
+
3301
+ def as_dict(self) -> dict:
3302
+ """Serializes the QueryBackedValue into a dictionary suitable for use as a JSON request body."""
3303
+ body = {}
3304
+ if self.multi_values_options: body['multi_values_options'] = self.multi_values_options.as_dict()
3305
+ if self.query_id is not None: body['query_id'] = self.query_id
3306
+ if self.values: body['values'] = [v for v in self.values]
3307
+ return body
3308
+
3309
+ @classmethod
3310
+ def from_dict(cls, d: Dict[str, any]) -> QueryBackedValue:
3311
+ """Deserializes the QueryBackedValue from a dictionary."""
3312
+ return cls(multi_values_options=_from_dict(d, 'multi_values_options', MultiValuesOptions),
3313
+ query_id=d.get('query_id', None),
3314
+ values=d.get('values', None))
2372
3315
 
2373
3316
 
2374
3317
  @dataclass
@@ -2429,9 +3372,8 @@ class QueryEditContent:
2429
3372
 
2430
3373
  @dataclass
2431
3374
  class QueryFilter:
2432
- """A filter to limit query history results. This field is optional."""
2433
-
2434
3375
  query_start_time_range: Optional[TimeRange] = None
3376
+ """A range filter for query submitted time. The time range must be <= 30 days."""
2435
3377
 
2436
3378
  statement_ids: Optional[List[str]] = None
2437
3379
  """A list of statement IDs."""
@@ -2466,11 +3408,8 @@ class QueryFilter:
2466
3408
 
2467
3409
  @dataclass
2468
3410
  class QueryInfo:
2469
- can_subscribe_to_live_query: Optional[bool] = None
2470
- """Reserved for internal use."""
2471
-
2472
3411
  channel_used: Optional[ChannelInfo] = None
2473
- """Channel information for the SQL warehouse at the time of query execution"""
3412
+ """SQL Warehouse channel information at the time of query execution"""
2474
3413
 
2475
3414
  duration: Optional[int] = None
2476
3415
  """Total execution time of the statement ( excluding result fetch time )."""
@@ -2508,6 +3447,8 @@ class QueryInfo:
2508
3447
  query_id: Optional[str] = None
2509
3448
  """The query ID."""
2510
3449
 
3450
+ query_source: Optional[QuerySource] = None
3451
+
2511
3452
  query_start_time_ms: Optional[int] = None
2512
3453
  """The time the query started."""
2513
3454
 
@@ -2518,15 +3459,17 @@ class QueryInfo:
2518
3459
  """The number of results returned by the query."""
2519
3460
 
2520
3461
  spark_ui_url: Optional[str] = None
2521
- """URL to the query plan."""
3462
+ """URL to the Spark UI query plan."""
2522
3463
 
2523
3464
  statement_type: Optional[QueryStatementType] = None
2524
3465
  """Type of statement for this query"""
2525
3466
 
2526
3467
  status: Optional[QueryStatus] = None
2527
- """Query status with one the following values: * `QUEUED`: Query has been received and queued. *
2528
- `RUNNING`: Query has started. * `CANCELED`: Query has been cancelled by the user. * `FAILED`:
2529
- Query has failed. * `FINISHED`: Query has completed."""
3468
+ """Query status with one the following values:
3469
+
3470
+ - `QUEUED`: Query has been received and queued. - `RUNNING`: Query has started. - `CANCELED`:
3471
+ Query has been cancelled by the user. - `FAILED`: Query has failed. - `FINISHED`: Query has
3472
+ completed."""
2530
3473
 
2531
3474
  user_id: Optional[int] = None
2532
3475
  """The ID of the user who ran the query."""
@@ -2540,8 +3483,6 @@ class QueryInfo:
2540
3483
  def as_dict(self) -> dict:
2541
3484
  """Serializes the QueryInfo into a dictionary suitable for use as a JSON request body."""
2542
3485
  body = {}
2543
- if self.can_subscribe_to_live_query is not None:
2544
- body['canSubscribeToLiveQuery'] = self.can_subscribe_to_live_query
2545
3486
  if self.channel_used: body['channel_used'] = self.channel_used.as_dict()
2546
3487
  if self.duration is not None: body['duration'] = self.duration
2547
3488
  if self.endpoint_id is not None: body['endpoint_id'] = self.endpoint_id
@@ -2555,6 +3496,7 @@ class QueryInfo:
2555
3496
  if self.plans_state is not None: body['plans_state'] = self.plans_state.value
2556
3497
  if self.query_end_time_ms is not None: body['query_end_time_ms'] = self.query_end_time_ms
2557
3498
  if self.query_id is not None: body['query_id'] = self.query_id
3499
+ if self.query_source: body['query_source'] = self.query_source.as_dict()
2558
3500
  if self.query_start_time_ms is not None: body['query_start_time_ms'] = self.query_start_time_ms
2559
3501
  if self.query_text is not None: body['query_text'] = self.query_text
2560
3502
  if self.rows_produced is not None: body['rows_produced'] = self.rows_produced
@@ -2569,8 +3511,7 @@ class QueryInfo:
2569
3511
  @classmethod
2570
3512
  def from_dict(cls, d: Dict[str, any]) -> QueryInfo:
2571
3513
  """Deserializes the QueryInfo from a dictionary."""
2572
- return cls(can_subscribe_to_live_query=d.get('canSubscribeToLiveQuery', None),
2573
- channel_used=_from_dict(d, 'channel_used', ChannelInfo),
3514
+ return cls(channel_used=_from_dict(d, 'channel_used', ChannelInfo),
2574
3515
  duration=d.get('duration', None),
2575
3516
  endpoint_id=d.get('endpoint_id', None),
2576
3517
  error_message=d.get('error_message', None),
@@ -2583,6 +3524,7 @@ class QueryInfo:
2583
3524
  plans_state=_enum(d, 'plans_state', PlansState),
2584
3525
  query_end_time_ms=d.get('query_end_time_ms', None),
2585
3526
  query_id=d.get('query_id', None),
3527
+ query_source=_from_dict(d, 'query_source', QuerySource),
2586
3528
  query_start_time_ms=d.get('query_start_time_ms', None),
2587
3529
  query_text=d.get('query_text', None),
2588
3530
  rows_produced=d.get('rows_produced', None),
@@ -2605,7 +3547,7 @@ class QueryList:
2605
3547
  page_size: Optional[int] = None
2606
3548
  """The number of queries per page."""
2607
3549
 
2608
- results: Optional[List[Query]] = None
3550
+ results: Optional[List[LegacyQuery]] = None
2609
3551
  """List of queries returned."""
2610
3552
 
2611
3553
  def as_dict(self) -> dict:
@@ -2623,12 +3565,13 @@ class QueryList:
2623
3565
  return cls(count=d.get('count', None),
2624
3566
  page=d.get('page', None),
2625
3567
  page_size=d.get('page_size', None),
2626
- results=_repeated_dict(d, 'results', Query))
3568
+ results=_repeated_dict(d, 'results', LegacyQuery))
2627
3569
 
2628
3570
 
2629
3571
  @dataclass
2630
3572
  class QueryMetrics:
2631
- """Metrics about query execution."""
3573
+ """A query metric that encapsulates a set of measurements for a single query. Metrics come from the
3574
+ driver and are stored in the history service database."""
2632
3575
 
2633
3576
  compilation_time_ms: Optional[int] = None
2634
3577
  """Time spent loading metadata and optimizing the query, in milliseconds."""
@@ -2636,9 +3579,6 @@ class QueryMetrics:
2636
3579
  execution_time_ms: Optional[int] = None
2637
3580
  """Time spent executing the query, in milliseconds."""
2638
3581
 
2639
- metadata_time_ms: Optional[int] = None
2640
- """Reserved for internal use."""
2641
-
2642
3582
  network_sent_bytes: Optional[int] = None
2643
3583
  """Total amount of data sent over the network between executor nodes during shuffle, in bytes."""
2644
3584
 
@@ -2649,9 +3589,6 @@ class QueryMetrics:
2649
3589
  photon_total_time_ms: Optional[int] = None
2650
3590
  """Total execution time for all individual Photon query engine tasks in the query, in milliseconds."""
2651
3591
 
2652
- planning_time_ms: Optional[int] = None
2653
- """Reserved for internal use."""
2654
-
2655
3592
  provisioning_queue_start_timestamp: Optional[int] = None
2656
3593
  """Timestamp of when the query was enqueued waiting for a cluster to be provisioned for the
2657
3594
  warehouse. This field is optional and will not appear if the query skipped the provisioning
@@ -2666,9 +3603,6 @@ class QueryMetrics:
2666
3603
  query_compilation_start_timestamp: Optional[int] = None
2667
3604
  """Timestamp of when the underlying compute started compilation of the query."""
2668
3605
 
2669
- query_execution_time_ms: Optional[int] = None
2670
- """Reserved for internal use."""
2671
-
2672
3606
  read_bytes: Optional[int] = None
2673
3607
  """Total size of data read by the query, in bytes."""
2674
3608
 
@@ -2676,7 +3610,7 @@ class QueryMetrics:
2676
3610
  """Size of persistent data read from the cache, in bytes."""
2677
3611
 
2678
3612
  read_files_count: Optional[int] = None
2679
- """Number of files read after pruning."""
3613
+ """Number of files read after pruning"""
2680
3614
 
2681
3615
  read_partitions_count: Optional[int] = None
2682
3616
  """Number of partitions read after pruning."""
@@ -2688,7 +3622,7 @@ class QueryMetrics:
2688
3622
  """Time spent fetching the query results after the execution finished, in milliseconds."""
2689
3623
 
2690
3624
  result_from_cache: Optional[bool] = None
2691
- """true if the query result was fetched from cache, false otherwise."""
3625
+ """`true` if the query result was fetched from cache, `false` otherwise."""
2692
3626
 
2693
3627
  rows_produced_count: Optional[int] = None
2694
3628
  """Total number of rows returned by the query."""
@@ -2713,20 +3647,16 @@ class QueryMetrics:
2713
3647
  body = {}
2714
3648
  if self.compilation_time_ms is not None: body['compilation_time_ms'] = self.compilation_time_ms
2715
3649
  if self.execution_time_ms is not None: body['execution_time_ms'] = self.execution_time_ms
2716
- if self.metadata_time_ms is not None: body['metadata_time_ms'] = self.metadata_time_ms
2717
3650
  if self.network_sent_bytes is not None: body['network_sent_bytes'] = self.network_sent_bytes
2718
3651
  if self.overloading_queue_start_timestamp is not None:
2719
3652
  body['overloading_queue_start_timestamp'] = self.overloading_queue_start_timestamp
2720
3653
  if self.photon_total_time_ms is not None: body['photon_total_time_ms'] = self.photon_total_time_ms
2721
- if self.planning_time_ms is not None: body['planning_time_ms'] = self.planning_time_ms
2722
3654
  if self.provisioning_queue_start_timestamp is not None:
2723
3655
  body['provisioning_queue_start_timestamp'] = self.provisioning_queue_start_timestamp
2724
3656
  if self.pruned_bytes is not None: body['pruned_bytes'] = self.pruned_bytes
2725
3657
  if self.pruned_files_count is not None: body['pruned_files_count'] = self.pruned_files_count
2726
3658
  if self.query_compilation_start_timestamp is not None:
2727
3659
  body['query_compilation_start_timestamp'] = self.query_compilation_start_timestamp
2728
- if self.query_execution_time_ms is not None:
2729
- body['query_execution_time_ms'] = self.query_execution_time_ms
2730
3660
  if self.read_bytes is not None: body['read_bytes'] = self.read_bytes
2731
3661
  if self.read_cache_bytes is not None: body['read_cache_bytes'] = self.read_cache_bytes
2732
3662
  if self.read_files_count is not None: body['read_files_count'] = self.read_files_count
@@ -2747,16 +3677,13 @@ class QueryMetrics:
2747
3677
  """Deserializes the QueryMetrics from a dictionary."""
2748
3678
  return cls(compilation_time_ms=d.get('compilation_time_ms', None),
2749
3679
  execution_time_ms=d.get('execution_time_ms', None),
2750
- metadata_time_ms=d.get('metadata_time_ms', None),
2751
3680
  network_sent_bytes=d.get('network_sent_bytes', None),
2752
3681
  overloading_queue_start_timestamp=d.get('overloading_queue_start_timestamp', None),
2753
3682
  photon_total_time_ms=d.get('photon_total_time_ms', None),
2754
- planning_time_ms=d.get('planning_time_ms', None),
2755
3683
  provisioning_queue_start_timestamp=d.get('provisioning_queue_start_timestamp', None),
2756
3684
  pruned_bytes=d.get('pruned_bytes', None),
2757
3685
  pruned_files_count=d.get('pruned_files_count', None),
2758
3686
  query_compilation_start_timestamp=d.get('query_compilation_start_timestamp', None),
2759
- query_execution_time_ms=d.get('query_execution_time_ms', None),
2760
3687
  read_bytes=d.get('read_bytes', None),
2761
3688
  read_cache_bytes=d.get('read_cache_bytes', None),
2762
3689
  read_files_count=d.get('read_files_count', None),
@@ -2804,6 +3731,59 @@ class QueryOptions:
2804
3731
  schema=d.get('schema', None))
2805
3732
 
2806
3733
 
3734
+ @dataclass
3735
+ class QueryParameter:
3736
+ date_range_value: Optional[DateRangeValue] = None
3737
+ """Date-range query parameter value. Can only specify one of `dynamic_date_range_value` or
3738
+ `date_range_value`."""
3739
+
3740
+ date_value: Optional[DateValue] = None
3741
+ """Date query parameter value. Can only specify one of `dynamic_date_value` or `date_value`."""
3742
+
3743
+ enum_value: Optional[EnumValue] = None
3744
+ """Dropdown query parameter value."""
3745
+
3746
+ name: Optional[str] = None
3747
+ """Literal parameter marker that appears between double curly braces in the query text."""
3748
+
3749
+ numeric_value: Optional[NumericValue] = None
3750
+ """Numeric query parameter value."""
3751
+
3752
+ query_backed_value: Optional[QueryBackedValue] = None
3753
+ """Query-based dropdown query parameter value."""
3754
+
3755
+ text_value: Optional[TextValue] = None
3756
+ """Text query parameter value."""
3757
+
3758
+ title: Optional[str] = None
3759
+ """Text displayed in the user-facing parameter widget in the UI."""
3760
+
3761
+ def as_dict(self) -> dict:
3762
+ """Serializes the QueryParameter into a dictionary suitable for use as a JSON request body."""
3763
+ body = {}
3764
+ if self.date_range_value: body['date_range_value'] = self.date_range_value.as_dict()
3765
+ if self.date_value: body['date_value'] = self.date_value.as_dict()
3766
+ if self.enum_value: body['enum_value'] = self.enum_value.as_dict()
3767
+ if self.name is not None: body['name'] = self.name
3768
+ if self.numeric_value: body['numeric_value'] = self.numeric_value.as_dict()
3769
+ if self.query_backed_value: body['query_backed_value'] = self.query_backed_value.as_dict()
3770
+ if self.text_value: body['text_value'] = self.text_value.as_dict()
3771
+ if self.title is not None: body['title'] = self.title
3772
+ return body
3773
+
3774
+ @classmethod
3775
+ def from_dict(cls, d: Dict[str, any]) -> QueryParameter:
3776
+ """Deserializes the QueryParameter from a dictionary."""
3777
+ return cls(date_range_value=_from_dict(d, 'date_range_value', DateRangeValue),
3778
+ date_value=_from_dict(d, 'date_value', DateValue),
3779
+ enum_value=_from_dict(d, 'enum_value', EnumValue),
3780
+ name=d.get('name', None),
3781
+ numeric_value=_from_dict(d, 'numeric_value', NumericValue),
3782
+ query_backed_value=_from_dict(d, 'query_backed_value', QueryBackedValue),
3783
+ text_value=_from_dict(d, 'text_value', TextValue),
3784
+ title=d.get('title', None))
3785
+
3786
+
2807
3787
  @dataclass
2808
3788
  class QueryPostContent:
2809
3789
  data_source_id: Optional[str] = None
@@ -2823,46 +3803,215 @@ class QueryPostContent:
2823
3803
  `title`, `name`, `type`, and `value` properties. The `value` field here is the default value. It
2824
3804
  can be overridden at runtime."""
2825
3805
 
2826
- parent: Optional[str] = None
2827
- """The identifier of the workspace folder containing the object."""
3806
+ parent: Optional[str] = None
3807
+ """The identifier of the workspace folder containing the object."""
3808
+
3809
+ query: Optional[str] = None
3810
+ """The text of the query to be run."""
3811
+
3812
+ run_as_role: Optional[RunAsRole] = None
3813
+ """Sets the **Run as** role for the object. Must be set to one of `"viewer"` (signifying "run as
3814
+ viewer" behavior) or `"owner"` (signifying "run as owner" behavior)"""
3815
+
3816
+ tags: Optional[List[str]] = None
3817
+
3818
+ def as_dict(self) -> dict:
3819
+ """Serializes the QueryPostContent into a dictionary suitable for use as a JSON request body."""
3820
+ body = {}
3821
+ if self.data_source_id is not None: body['data_source_id'] = self.data_source_id
3822
+ if self.description is not None: body['description'] = self.description
3823
+ if self.name is not None: body['name'] = self.name
3824
+ if self.options: body['options'] = self.options
3825
+ if self.parent is not None: body['parent'] = self.parent
3826
+ if self.query is not None: body['query'] = self.query
3827
+ if self.run_as_role is not None: body['run_as_role'] = self.run_as_role.value
3828
+ if self.tags: body['tags'] = [v for v in self.tags]
3829
+ return body
3830
+
3831
+ @classmethod
3832
+ def from_dict(cls, d: Dict[str, any]) -> QueryPostContent:
3833
+ """Deserializes the QueryPostContent from a dictionary."""
3834
+ return cls(data_source_id=d.get('data_source_id', None),
3835
+ description=d.get('description', None),
3836
+ name=d.get('name', None),
3837
+ options=d.get('options', None),
3838
+ parent=d.get('parent', None),
3839
+ query=d.get('query', None),
3840
+ run_as_role=_enum(d, 'run_as_role', RunAsRole),
3841
+ tags=d.get('tags', None))
3842
+
3843
+
3844
+ @dataclass
3845
+ class QuerySource:
3846
+ alert_id: Optional[str] = None
3847
+ """UUID"""
3848
+
3849
+ client_call_context: Optional[ClientCallContext] = None
3850
+ """Client code that triggered the request"""
3851
+
3852
+ command_id: Optional[str] = None
3853
+ """Id associated with a notebook cell"""
3854
+
3855
+ command_run_id: Optional[str] = None
3856
+ """Id associated with a notebook run or execution"""
3857
+
3858
+ dashboard_id: Optional[str] = None
3859
+ """UUID"""
3860
+
3861
+ dashboard_v3_id: Optional[str] = None
3862
+ """UUID for Lakeview Dashboards, separate from DBSQL Dashboards (dashboard_id)"""
3863
+
3864
+ driver_info: Optional[QuerySourceDriverInfo] = None
3865
+
3866
+ entry_point: Optional[QuerySourceEntryPoint] = None
3867
+ """Spark service that received and processed the query"""
3868
+
3869
+ genie_space_id: Optional[str] = None
3870
+ """UUID for Genie space"""
3871
+
3872
+ is_cloud_fetch: Optional[bool] = None
3873
+
3874
+ is_databricks_sql_exec_api: Optional[bool] = None
3875
+
3876
+ job_id: Optional[str] = None
3877
+
3878
+ job_managed_by: Optional[QuerySourceJobManager] = None
3879
+ """With background compute, jobs can be managed by different internal teams. When not specified,
3880
+ not a background compute job When specified and the value is not JOBS, it is a background
3881
+ compute job"""
3882
+
3883
+ notebook_id: Optional[str] = None
3884
+
3885
+ query_tags: Optional[str] = None
3886
+ """String provided by a customer that'll help them identify the query"""
3887
+
3888
+ run_id: Optional[str] = None
3889
+ """Id associated with a job run or execution"""
3890
+
3891
+ runnable_command_id: Optional[str] = None
3892
+ """Id associated with a notebook cell run or execution"""
3893
+
3894
+ scheduled_by: Optional[QuerySourceTrigger] = None
3895
+
3896
+ serverless_channel_info: Optional[ServerlessChannelInfo] = None
3897
+
3898
+ source_query_id: Optional[str] = None
3899
+ """UUID"""
3900
+
3901
+ def as_dict(self) -> dict:
3902
+ """Serializes the QuerySource into a dictionary suitable for use as a JSON request body."""
3903
+ body = {}
3904
+ if self.alert_id is not None: body['alert_id'] = self.alert_id
3905
+ if self.client_call_context: body['client_call_context'] = self.client_call_context.as_dict()
3906
+ if self.command_id is not None: body['command_id'] = self.command_id
3907
+ if self.command_run_id is not None: body['command_run_id'] = self.command_run_id
3908
+ if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
3909
+ if self.dashboard_v3_id is not None: body['dashboard_v3_id'] = self.dashboard_v3_id
3910
+ if self.driver_info: body['driver_info'] = self.driver_info.as_dict()
3911
+ if self.entry_point is not None: body['entry_point'] = self.entry_point.value
3912
+ if self.genie_space_id is not None: body['genie_space_id'] = self.genie_space_id
3913
+ if self.is_cloud_fetch is not None: body['is_cloud_fetch'] = self.is_cloud_fetch
3914
+ if self.is_databricks_sql_exec_api is not None:
3915
+ body['is_databricks_sql_exec_api'] = self.is_databricks_sql_exec_api
3916
+ if self.job_id is not None: body['job_id'] = self.job_id
3917
+ if self.job_managed_by is not None: body['job_managed_by'] = self.job_managed_by.value
3918
+ if self.notebook_id is not None: body['notebook_id'] = self.notebook_id
3919
+ if self.query_tags is not None: body['query_tags'] = self.query_tags
3920
+ if self.run_id is not None: body['run_id'] = self.run_id
3921
+ if self.runnable_command_id is not None: body['runnable_command_id'] = self.runnable_command_id
3922
+ if self.scheduled_by is not None: body['scheduled_by'] = self.scheduled_by.value
3923
+ if self.serverless_channel_info:
3924
+ body['serverless_channel_info'] = self.serverless_channel_info.as_dict()
3925
+ if self.source_query_id is not None: body['source_query_id'] = self.source_query_id
3926
+ return body
3927
+
3928
+ @classmethod
3929
+ def from_dict(cls, d: Dict[str, any]) -> QuerySource:
3930
+ """Deserializes the QuerySource from a dictionary."""
3931
+ return cls(alert_id=d.get('alert_id', None),
3932
+ client_call_context=_from_dict(d, 'client_call_context', ClientCallContext),
3933
+ command_id=d.get('command_id', None),
3934
+ command_run_id=d.get('command_run_id', None),
3935
+ dashboard_id=d.get('dashboard_id', None),
3936
+ dashboard_v3_id=d.get('dashboard_v3_id', None),
3937
+ driver_info=_from_dict(d, 'driver_info', QuerySourceDriverInfo),
3938
+ entry_point=_enum(d, 'entry_point', QuerySourceEntryPoint),
3939
+ genie_space_id=d.get('genie_space_id', None),
3940
+ is_cloud_fetch=d.get('is_cloud_fetch', None),
3941
+ is_databricks_sql_exec_api=d.get('is_databricks_sql_exec_api', None),
3942
+ job_id=d.get('job_id', None),
3943
+ job_managed_by=_enum(d, 'job_managed_by', QuerySourceJobManager),
3944
+ notebook_id=d.get('notebook_id', None),
3945
+ query_tags=d.get('query_tags', None),
3946
+ run_id=d.get('run_id', None),
3947
+ runnable_command_id=d.get('runnable_command_id', None),
3948
+ scheduled_by=_enum(d, 'scheduled_by', QuerySourceTrigger),
3949
+ serverless_channel_info=_from_dict(d, 'serverless_channel_info', ServerlessChannelInfo),
3950
+ source_query_id=d.get('source_query_id', None))
3951
+
2828
3952
 
2829
- query: Optional[str] = None
2830
- """The text of the query to be run."""
3953
+ @dataclass
3954
+ class QuerySourceDriverInfo:
3955
+ bi_tool_entry: Optional[str] = None
2831
3956
 
2832
- run_as_role: Optional[RunAsRole] = None
2833
- """Sets the **Run as** role for the object. Must be set to one of `"viewer"` (signifying "run as
2834
- viewer" behavior) or `"owner"` (signifying "run as owner" behavior)"""
3957
+ driver_name: Optional[str] = None
2835
3958
 
2836
- tags: Optional[List[str]] = None
3959
+ simba_branding_vendor: Optional[str] = None
3960
+
3961
+ version_number: Optional[str] = None
2837
3962
 
2838
3963
  def as_dict(self) -> dict:
2839
- """Serializes the QueryPostContent into a dictionary suitable for use as a JSON request body."""
3964
+ """Serializes the QuerySourceDriverInfo into a dictionary suitable for use as a JSON request body."""
2840
3965
  body = {}
2841
- if self.data_source_id is not None: body['data_source_id'] = self.data_source_id
2842
- if self.description is not None: body['description'] = self.description
2843
- if self.name is not None: body['name'] = self.name
2844
- if self.options: body['options'] = self.options
2845
- if self.parent is not None: body['parent'] = self.parent
2846
- if self.query is not None: body['query'] = self.query
2847
- if self.run_as_role is not None: body['run_as_role'] = self.run_as_role.value
2848
- if self.tags: body['tags'] = [v for v in self.tags]
3966
+ if self.bi_tool_entry is not None: body['bi_tool_entry'] = self.bi_tool_entry
3967
+ if self.driver_name is not None: body['driver_name'] = self.driver_name
3968
+ if self.simba_branding_vendor is not None: body['simba_branding_vendor'] = self.simba_branding_vendor
3969
+ if self.version_number is not None: body['version_number'] = self.version_number
2849
3970
  return body
2850
3971
 
2851
3972
  @classmethod
2852
- def from_dict(cls, d: Dict[str, any]) -> QueryPostContent:
2853
- """Deserializes the QueryPostContent from a dictionary."""
2854
- return cls(data_source_id=d.get('data_source_id', None),
2855
- description=d.get('description', None),
2856
- name=d.get('name', None),
2857
- options=d.get('options', None),
2858
- parent=d.get('parent', None),
2859
- query=d.get('query', None),
2860
- run_as_role=_enum(d, 'run_as_role', RunAsRole),
2861
- tags=d.get('tags', None))
3973
+ def from_dict(cls, d: Dict[str, any]) -> QuerySourceDriverInfo:
3974
+ """Deserializes the QuerySourceDriverInfo from a dictionary."""
3975
+ return cls(bi_tool_entry=d.get('bi_tool_entry', None),
3976
+ driver_name=d.get('driver_name', None),
3977
+ simba_branding_vendor=d.get('simba_branding_vendor', None),
3978
+ version_number=d.get('version_number', None))
3979
+
3980
+
3981
+ class QuerySourceEntryPoint(Enum):
3982
+ """Spark service that received and processed the query"""
3983
+
3984
+ DLT = 'DLT'
3985
+ SPARK_CONNECT = 'SPARK_CONNECT'
3986
+ THRIFT_SERVER = 'THRIFT_SERVER'
3987
+
3988
+
3989
+ class QuerySourceJobManager(Enum):
3990
+ """Copied from elastic-spark-common/api/messages/manager.proto with enum values changed by 1 to
3991
+ accommodate JOB_MANAGER_UNSPECIFIED"""
3992
+
3993
+ APP_SYSTEM_TABLE = 'APP_SYSTEM_TABLE'
3994
+ AUTOML = 'AUTOML'
3995
+ AUTO_MAINTENANCE = 'AUTO_MAINTENANCE'
3996
+ CLEAN_ROOMS = 'CLEAN_ROOMS'
3997
+ DATA_MONITORING = 'DATA_MONITORING'
3998
+ DATA_SHARING = 'DATA_SHARING'
3999
+ ENCRYPTION = 'ENCRYPTION'
4000
+ FABRIC_CRAWLER = 'FABRIC_CRAWLER'
4001
+ JOBS = 'JOBS'
4002
+ LAKEVIEW = 'LAKEVIEW'
4003
+ MANAGED_RAG = 'MANAGED_RAG'
4004
+ SCHEDULED_MV_REFRESH = 'SCHEDULED_MV_REFRESH'
4005
+ TESTING = 'TESTING'
4006
+
4007
+
4008
+ class QuerySourceTrigger(Enum):
4009
+
4010
+ MANUAL = 'MANUAL'
4011
+ SCHEDULED = 'SCHEDULED'
2862
4012
 
2863
4013
 
2864
4014
  class QueryStatementType(Enum):
2865
- """Type of statement for this query"""
2866
4015
 
2867
4016
  ALTER = 'ALTER'
2868
4017
  ANALYZE = 'ANALYZE'
@@ -2889,15 +4038,16 @@ class QueryStatementType(Enum):
2889
4038
 
2890
4039
 
2891
4040
  class QueryStatus(Enum):
2892
- """Query status with one the following values: * `QUEUED`: Query has been received and queued. *
2893
- `RUNNING`: Query has started. * `CANCELED`: Query has been cancelled by the user. * `FAILED`:
2894
- Query has failed. * `FINISHED`: Query has completed."""
4041
+ """Statuses which are also used by OperationStatus in runtime"""
2895
4042
 
2896
4043
  CANCELED = 'CANCELED'
4044
+ COMPILED = 'COMPILED'
4045
+ COMPILING = 'COMPILING'
2897
4046
  FAILED = 'FAILED'
2898
4047
  FINISHED = 'FINISHED'
2899
4048
  QUEUED = 'QUEUED'
2900
4049
  RUNNING = 'RUNNING'
4050
+ STARTED = 'STARTED'
2901
4051
 
2902
4052
 
2903
4053
  @dataclass
@@ -2938,12 +4088,6 @@ class RestoreResponse:
2938
4088
 
2939
4089
  @dataclass
2940
4090
  class ResultData:
2941
- """Contains the result data of a single chunk when using `INLINE` disposition. When using
2942
- `EXTERNAL_LINKS` disposition, the array `external_links` is used instead to provide presigned
2943
- URLs to the result data in cloud storage. Exactly one of these alternatives is used. (While the
2944
- `external_links` array prepares the API to return multiple links in a single response. Currently
2945
- only a single link is returned.)"""
2946
-
2947
4091
  byte_count: Optional[int] = None
2948
4092
  """The number of bytes in the result chunk. This field is not available when using `INLINE`
2949
4093
  disposition."""
@@ -3070,6 +4214,12 @@ class ResultSchema:
3070
4214
  return cls(column_count=d.get('column_count', None), columns=_repeated_dict(d, 'columns', ColumnInfo))
3071
4215
 
3072
4216
 
4217
+ class RunAsMode(Enum):
4218
+
4219
+ OWNER = 'OWNER'
4220
+ VIEWER = 'VIEWER'
4221
+
4222
+
3073
4223
  class RunAsRole(Enum):
3074
4224
  """Sets the **Run as** role for the object. Must be set to one of `"viewer"` (signifying "run as
3075
4225
  viewer" behavior) or `"owner"` (signifying "run as owner" behavior)"""
@@ -3078,6 +4228,23 @@ class RunAsRole(Enum):
3078
4228
  VIEWER = 'viewer'
3079
4229
 
3080
4230
 
4231
+ @dataclass
4232
+ class ServerlessChannelInfo:
4233
+ name: Optional[ChannelName] = None
4234
+ """Name of the Channel"""
4235
+
4236
+ def as_dict(self) -> dict:
4237
+ """Serializes the ServerlessChannelInfo into a dictionary suitable for use as a JSON request body."""
4238
+ body = {}
4239
+ if self.name is not None: body['name'] = self.name.value
4240
+ return body
4241
+
4242
+ @classmethod
4243
+ def from_dict(cls, d: Dict[str, any]) -> ServerlessChannelInfo:
4244
+ """Deserializes the ServerlessChannelInfo from a dictionary."""
4245
+ return cls(name=_enum(d, 'name', ChannelName))
4246
+
4247
+
3081
4248
  @dataclass
3082
4249
  class ServiceError:
3083
4250
  error_code: Optional[ServiceErrorCode] = None
@@ -3296,6 +4463,38 @@ class StatementParameterListItem:
3296
4463
  return cls(name=d.get('name', None), type=d.get('type', None), value=d.get('value', None))
3297
4464
 
3298
4465
 
4466
+ @dataclass
4467
+ class StatementResponse:
4468
+ manifest: Optional[ResultManifest] = None
4469
+ """The result manifest provides schema and metadata for the result set."""
4470
+
4471
+ result: Optional[ResultData] = None
4472
+
4473
+ statement_id: Optional[str] = None
4474
+ """The statement ID is returned upon successfully submitting a SQL statement, and is a required
4475
+ reference for all subsequent calls."""
4476
+
4477
+ status: Optional[StatementStatus] = None
4478
+ """The status response includes execution state and if relevant, error information."""
4479
+
4480
+ def as_dict(self) -> dict:
4481
+ """Serializes the StatementResponse into a dictionary suitable for use as a JSON request body."""
4482
+ body = {}
4483
+ if self.manifest: body['manifest'] = self.manifest.as_dict()
4484
+ if self.result: body['result'] = self.result.as_dict()
4485
+ if self.statement_id is not None: body['statement_id'] = self.statement_id
4486
+ if self.status: body['status'] = self.status.as_dict()
4487
+ return body
4488
+
4489
+ @classmethod
4490
+ def from_dict(cls, d: Dict[str, any]) -> StatementResponse:
4491
+ """Deserializes the StatementResponse from a dictionary."""
4492
+ return cls(manifest=_from_dict(d, 'manifest', ResultManifest),
4493
+ result=_from_dict(d, 'result', ResultData),
4494
+ statement_id=d.get('statement_id', None),
4495
+ status=_from_dict(d, 'status', StatementStatus))
4496
+
4497
+
3299
4498
  class StatementState(Enum):
3300
4499
  """Statement execution state: - `PENDING`: waiting for warehouse - `RUNNING`: running -
3301
4500
  `SUCCEEDED`: execution was successful, result data available for fetch - `FAILED`: execution
@@ -3501,13 +4700,29 @@ class TerminationReasonType(Enum):
3501
4700
  SUCCESS = 'SUCCESS'
3502
4701
 
3503
4702
 
4703
+ @dataclass
4704
+ class TextValue:
4705
+ value: Optional[str] = None
4706
+
4707
+ def as_dict(self) -> dict:
4708
+ """Serializes the TextValue into a dictionary suitable for use as a JSON request body."""
4709
+ body = {}
4710
+ if self.value is not None: body['value'] = self.value
4711
+ return body
4712
+
4713
+ @classmethod
4714
+ def from_dict(cls, d: Dict[str, any]) -> TextValue:
4715
+ """Deserializes the TextValue from a dictionary."""
4716
+ return cls(value=d.get('value', None))
4717
+
4718
+
3504
4719
  @dataclass
3505
4720
  class TimeRange:
3506
4721
  end_time_ms: Optional[int] = None
3507
- """Limit results to queries that started before this time."""
4722
+ """The end time in milliseconds."""
3508
4723
 
3509
4724
  start_time_ms: Optional[int] = None
3510
- """Limit results to queries that started after this time."""
4725
+ """The start time in milliseconds."""
3511
4726
 
3512
4727
  def as_dict(self) -> dict:
3513
4728
  """Serializes the TimeRange into a dictionary suitable for use as a JSON request body."""
@@ -3539,6 +4754,179 @@ class TransferOwnershipObjectId:
3539
4754
  return cls(new_owner=d.get('new_owner', None))
3540
4755
 
3541
4756
 
4757
+ @dataclass
4758
+ class UpdateAlertRequest:
4759
+ update_mask: str
4760
+ """Field mask is required to be passed into the PATCH request. Field mask specifies which fields of
4761
+ the setting payload will be updated. The field mask needs to be supplied as single string. To
4762
+ specify multiple fields in the field mask, use comma as the separator (no space)."""
4763
+
4764
+ alert: Optional[UpdateAlertRequestAlert] = None
4765
+
4766
+ id: Optional[str] = None
4767
+
4768
+ def as_dict(self) -> dict:
4769
+ """Serializes the UpdateAlertRequest into a dictionary suitable for use as a JSON request body."""
4770
+ body = {}
4771
+ if self.alert: body['alert'] = self.alert.as_dict()
4772
+ if self.id is not None: body['id'] = self.id
4773
+ if self.update_mask is not None: body['update_mask'] = self.update_mask
4774
+ return body
4775
+
4776
+ @classmethod
4777
+ def from_dict(cls, d: Dict[str, any]) -> UpdateAlertRequest:
4778
+ """Deserializes the UpdateAlertRequest from a dictionary."""
4779
+ return cls(alert=_from_dict(d, 'alert', UpdateAlertRequestAlert),
4780
+ id=d.get('id', None),
4781
+ update_mask=d.get('update_mask', None))
4782
+
4783
+
4784
+ @dataclass
4785
+ class UpdateAlertRequestAlert:
4786
+ condition: Optional[AlertCondition] = None
4787
+ """Trigger conditions of the alert."""
4788
+
4789
+ custom_body: Optional[str] = None
4790
+ """Custom body of alert notification, if it exists. See [here] for custom templating instructions.
4791
+
4792
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
4793
+
4794
+ custom_subject: Optional[str] = None
4795
+ """Custom subject of alert notification, if it exists. This can include email subject entries and
4796
+ Slack notification headers, for example. See [here] for custom templating instructions.
4797
+
4798
+ [here]: https://docs.databricks.com/sql/user/alerts/index.html"""
4799
+
4800
+ display_name: Optional[str] = None
4801
+ """The display name of the alert."""
4802
+
4803
+ owner_user_name: Optional[str] = None
4804
+ """The owner's username. This field is set to "Unavailable" if the user has been deleted."""
4805
+
4806
+ query_id: Optional[str] = None
4807
+ """UUID of the query attached to the alert."""
4808
+
4809
+ seconds_to_retrigger: Optional[int] = None
4810
+ """Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it
4811
+ can be triggered again. If 0 or not specified, the alert will not be triggered again."""
4812
+
4813
+ def as_dict(self) -> dict:
4814
+ """Serializes the UpdateAlertRequestAlert into a dictionary suitable for use as a JSON request body."""
4815
+ body = {}
4816
+ if self.condition: body['condition'] = self.condition.as_dict()
4817
+ if self.custom_body is not None: body['custom_body'] = self.custom_body
4818
+ if self.custom_subject is not None: body['custom_subject'] = self.custom_subject
4819
+ if self.display_name is not None: body['display_name'] = self.display_name
4820
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
4821
+ if self.query_id is not None: body['query_id'] = self.query_id
4822
+ if self.seconds_to_retrigger is not None: body['seconds_to_retrigger'] = self.seconds_to_retrigger
4823
+ return body
4824
+
4825
+ @classmethod
4826
+ def from_dict(cls, d: Dict[str, any]) -> UpdateAlertRequestAlert:
4827
+ """Deserializes the UpdateAlertRequestAlert from a dictionary."""
4828
+ return cls(condition=_from_dict(d, 'condition', AlertCondition),
4829
+ custom_body=d.get('custom_body', None),
4830
+ custom_subject=d.get('custom_subject', None),
4831
+ display_name=d.get('display_name', None),
4832
+ owner_user_name=d.get('owner_user_name', None),
4833
+ query_id=d.get('query_id', None),
4834
+ seconds_to_retrigger=d.get('seconds_to_retrigger', None))
4835
+
4836
+
4837
+ @dataclass
4838
+ class UpdateQueryRequest:
4839
+ update_mask: str
4840
+ """Field mask is required to be passed into the PATCH request. Field mask specifies which fields of
4841
+ the setting payload will be updated. The field mask needs to be supplied as single string. To
4842
+ specify multiple fields in the field mask, use comma as the separator (no space)."""
4843
+
4844
+ id: Optional[str] = None
4845
+
4846
+ query: Optional[UpdateQueryRequestQuery] = None
4847
+
4848
+ def as_dict(self) -> dict:
4849
+ """Serializes the UpdateQueryRequest into a dictionary suitable for use as a JSON request body."""
4850
+ body = {}
4851
+ if self.id is not None: body['id'] = self.id
4852
+ if self.query: body['query'] = self.query.as_dict()
4853
+ if self.update_mask is not None: body['update_mask'] = self.update_mask
4854
+ return body
4855
+
4856
+ @classmethod
4857
+ def from_dict(cls, d: Dict[str, any]) -> UpdateQueryRequest:
4858
+ """Deserializes the UpdateQueryRequest from a dictionary."""
4859
+ return cls(id=d.get('id', None),
4860
+ query=_from_dict(d, 'query', UpdateQueryRequestQuery),
4861
+ update_mask=d.get('update_mask', None))
4862
+
4863
+
4864
+ @dataclass
4865
+ class UpdateQueryRequestQuery:
4866
+ apply_auto_limit: Optional[bool] = None
4867
+ """Whether to apply a 1000 row limit to the query result."""
4868
+
4869
+ catalog: Optional[str] = None
4870
+ """Name of the catalog where this query will be executed."""
4871
+
4872
+ description: Optional[str] = None
4873
+ """General description that conveys additional information about this query such as usage notes."""
4874
+
4875
+ display_name: Optional[str] = None
4876
+ """Display name of the query that appears in list views, widget headings, and on the query page."""
4877
+
4878
+ owner_user_name: Optional[str] = None
4879
+ """Username of the user that owns the query."""
4880
+
4881
+ parameters: Optional[List[QueryParameter]] = None
4882
+ """List of query parameter definitions."""
4883
+
4884
+ query_text: Optional[str] = None
4885
+ """Text of the query to be run."""
4886
+
4887
+ run_as_mode: Optional[RunAsMode] = None
4888
+ """Sets the "Run as" role for the object."""
4889
+
4890
+ schema: Optional[str] = None
4891
+ """Name of the schema where this query will be executed."""
4892
+
4893
+ tags: Optional[List[str]] = None
4894
+
4895
+ warehouse_id: Optional[str] = None
4896
+ """ID of the SQL warehouse attached to the query."""
4897
+
4898
+ def as_dict(self) -> dict:
4899
+ """Serializes the UpdateQueryRequestQuery into a dictionary suitable for use as a JSON request body."""
4900
+ body = {}
4901
+ if self.apply_auto_limit is not None: body['apply_auto_limit'] = self.apply_auto_limit
4902
+ if self.catalog is not None: body['catalog'] = self.catalog
4903
+ if self.description is not None: body['description'] = self.description
4904
+ if self.display_name is not None: body['display_name'] = self.display_name
4905
+ if self.owner_user_name is not None: body['owner_user_name'] = self.owner_user_name
4906
+ if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters]
4907
+ if self.query_text is not None: body['query_text'] = self.query_text
4908
+ if self.run_as_mode is not None: body['run_as_mode'] = self.run_as_mode.value
4909
+ if self.schema is not None: body['schema'] = self.schema
4910
+ if self.tags: body['tags'] = [v for v in self.tags]
4911
+ if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
4912
+ return body
4913
+
4914
+ @classmethod
4915
+ def from_dict(cls, d: Dict[str, any]) -> UpdateQueryRequestQuery:
4916
+ """Deserializes the UpdateQueryRequestQuery from a dictionary."""
4917
+ return cls(apply_auto_limit=d.get('apply_auto_limit', None),
4918
+ catalog=d.get('catalog', None),
4919
+ description=d.get('description', None),
4920
+ display_name=d.get('display_name', None),
4921
+ owner_user_name=d.get('owner_user_name', None),
4922
+ parameters=_repeated_dict(d, 'parameters', QueryParameter),
4923
+ query_text=d.get('query_text', None),
4924
+ run_as_mode=_enum(d, 'run_as_mode', RunAsMode),
4925
+ schema=d.get('schema', None),
4926
+ tags=d.get('tags', None),
4927
+ warehouse_id=d.get('warehouse_id', None))
4928
+
4929
+
3542
4930
  @dataclass
3543
4931
  class UpdateResponse:
3544
4932
 
@@ -3553,6 +4941,67 @@ class UpdateResponse:
3553
4941
  return cls()
3554
4942
 
3555
4943
 
4944
+ @dataclass
4945
+ class UpdateVisualizationRequest:
4946
+ update_mask: str
4947
+ """Field mask is required to be passed into the PATCH request. Field mask specifies which fields of
4948
+ the setting payload will be updated. The field mask needs to be supplied as single string. To
4949
+ specify multiple fields in the field mask, use comma as the separator (no space)."""
4950
+
4951
+ id: Optional[str] = None
4952
+
4953
+ visualization: Optional[UpdateVisualizationRequestVisualization] = None
4954
+
4955
+ def as_dict(self) -> dict:
4956
+ """Serializes the UpdateVisualizationRequest into a dictionary suitable for use as a JSON request body."""
4957
+ body = {}
4958
+ if self.id is not None: body['id'] = self.id
4959
+ if self.update_mask is not None: body['update_mask'] = self.update_mask
4960
+ if self.visualization: body['visualization'] = self.visualization.as_dict()
4961
+ return body
4962
+
4963
+ @classmethod
4964
+ def from_dict(cls, d: Dict[str, any]) -> UpdateVisualizationRequest:
4965
+ """Deserializes the UpdateVisualizationRequest from a dictionary."""
4966
+ return cls(id=d.get('id', None),
4967
+ update_mask=d.get('update_mask', None),
4968
+ visualization=_from_dict(d, 'visualization', UpdateVisualizationRequestVisualization))
4969
+
4970
+
4971
+ @dataclass
4972
+ class UpdateVisualizationRequestVisualization:
4973
+ display_name: Optional[str] = None
4974
+ """The display name of the visualization."""
4975
+
4976
+ serialized_options: Optional[str] = None
4977
+ """The visualization options varies widely from one visualization type to the next and is
4978
+ unsupported. Databricks does not recommend modifying visualization options directly."""
4979
+
4980
+ serialized_query_plan: Optional[str] = None
4981
+ """The visualization query plan varies widely from one visualization type to the next and is
4982
+ unsupported. Databricks does not recommend modifying the visualization query plan directly."""
4983
+
4984
+ type: Optional[str] = None
4985
+ """The type of visualization: counter, table, funnel, and so on."""
4986
+
4987
+ def as_dict(self) -> dict:
4988
+ """Serializes the UpdateVisualizationRequestVisualization into a dictionary suitable for use as a JSON request body."""
4989
+ body = {}
4990
+ if self.display_name is not None: body['display_name'] = self.display_name
4991
+ if self.serialized_options is not None: body['serialized_options'] = self.serialized_options
4992
+ if self.serialized_query_plan is not None: body['serialized_query_plan'] = self.serialized_query_plan
4993
+ if self.type is not None: body['type'] = self.type
4994
+ return body
4995
+
4996
+ @classmethod
4997
+ def from_dict(cls, d: Dict[str, any]) -> UpdateVisualizationRequestVisualization:
4998
+ """Deserializes the UpdateVisualizationRequestVisualization from a dictionary."""
4999
+ return cls(display_name=d.get('display_name', None),
5000
+ serialized_options=d.get('serialized_options', None),
5001
+ serialized_query_plan=d.get('serialized_query_plan', None),
5002
+ type=d.get('type', None))
5003
+
5004
+
3556
5005
  @dataclass
3557
5006
  class User:
3558
5007
  email: Optional[str] = None
@@ -3577,57 +5026,56 @@ class User:
3577
5026
 
3578
5027
  @dataclass
3579
5028
  class Visualization:
3580
- """The visualization description API changes frequently and is unsupported. You can duplicate a
3581
- visualization by copying description objects received _from the API_ and then using them to
3582
- create a new one with a POST request to the same endpoint. Databricks does not recommend
3583
- constructing ad-hoc visualizations entirely in JSON."""
3584
-
3585
- created_at: Optional[str] = None
5029
+ create_time: Optional[str] = None
5030
+ """The timestamp indicating when the visualization was created."""
3586
5031
 
3587
- description: Optional[str] = None
3588
- """A short description of this visualization. This is not displayed in the UI."""
5032
+ display_name: Optional[str] = None
5033
+ """The display name of the visualization."""
3589
5034
 
3590
5035
  id: Optional[str] = None
3591
- """The UUID for this visualization."""
5036
+ """UUID identifying the visualization."""
3592
5037
 
3593
- name: Optional[str] = None
3594
- """The name of the visualization that appears on dashboards and the query screen."""
5038
+ query_id: Optional[str] = None
5039
+ """UUID of the query that the visualization is attached to."""
3595
5040
 
3596
- options: Optional[Any] = None
3597
- """The options object varies widely from one visualization type to the next and is unsupported.
3598
- Databricks does not recommend modifying visualization settings in JSON."""
5041
+ serialized_options: Optional[str] = None
5042
+ """The visualization options varies widely from one visualization type to the next and is
5043
+ unsupported. Databricks does not recommend modifying visualization options directly."""
3599
5044
 
3600
- query: Optional[Query] = None
5045
+ serialized_query_plan: Optional[str] = None
5046
+ """The visualization query plan varies widely from one visualization type to the next and is
5047
+ unsupported. Databricks does not recommend modifying the visualization query plan directly."""
3601
5048
 
3602
5049
  type: Optional[str] = None
3603
- """The type of visualization: chart, table, pivot table, and so on."""
5050
+ """The type of visualization: counter, table, funnel, and so on."""
3604
5051
 
3605
- updated_at: Optional[str] = None
5052
+ update_time: Optional[str] = None
5053
+ """The timestamp indicating when the visualization was updated."""
3606
5054
 
3607
5055
  def as_dict(self) -> dict:
3608
5056
  """Serializes the Visualization into a dictionary suitable for use as a JSON request body."""
3609
5057
  body = {}
3610
- if self.created_at is not None: body['created_at'] = self.created_at
3611
- if self.description is not None: body['description'] = self.description
5058
+ if self.create_time is not None: body['create_time'] = self.create_time
5059
+ if self.display_name is not None: body['display_name'] = self.display_name
3612
5060
  if self.id is not None: body['id'] = self.id
3613
- if self.name is not None: body['name'] = self.name
3614
- if self.options: body['options'] = self.options
3615
- if self.query: body['query'] = self.query.as_dict()
5061
+ if self.query_id is not None: body['query_id'] = self.query_id
5062
+ if self.serialized_options is not None: body['serialized_options'] = self.serialized_options
5063
+ if self.serialized_query_plan is not None: body['serialized_query_plan'] = self.serialized_query_plan
3616
5064
  if self.type is not None: body['type'] = self.type
3617
- if self.updated_at is not None: body['updated_at'] = self.updated_at
5065
+ if self.update_time is not None: body['update_time'] = self.update_time
3618
5066
  return body
3619
5067
 
3620
5068
  @classmethod
3621
5069
  def from_dict(cls, d: Dict[str, any]) -> Visualization:
3622
- """Deserializes the Visualization from a dictionary."""
3623
- return cls(created_at=d.get('created_at', None),
3624
- description=d.get('description', None),
5070
+ """Deserializes the Visualization from a dictionary."""
5071
+ return cls(create_time=d.get('create_time', None),
5072
+ display_name=d.get('display_name', None),
3625
5073
  id=d.get('id', None),
3626
- name=d.get('name', None),
3627
- options=d.get('options', None),
3628
- query=_from_dict(d, 'query', Query),
5074
+ query_id=d.get('query_id', None),
5075
+ serialized_options=d.get('serialized_options', None),
5076
+ serialized_query_plan=d.get('serialized_query_plan', None),
3629
5077
  type=d.get('type', None),
3630
- updated_at=d.get('updated_at', None))
5078
+ update_time=d.get('update_time', None))
3631
5079
 
3632
5080
 
3633
5081
  @dataclass
@@ -3730,6 +5178,7 @@ class WarehousePermissionLevel(Enum):
3730
5178
  """Permission level"""
3731
5179
 
3732
5180
  CAN_MANAGE = 'CAN_MANAGE'
5181
+ CAN_MONITOR = 'CAN_MONITOR'
3733
5182
  CAN_USE = 'CAN_USE'
3734
5183
  IS_OWNER = 'IS_OWNER'
3735
5184
 
@@ -3842,7 +5291,7 @@ class Widget:
3842
5291
 
3843
5292
  options: Optional[WidgetOptions] = None
3844
5293
 
3845
- visualization: Optional[Visualization] = None
5294
+ visualization: Optional[LegacyVisualization] = None
3846
5295
  """The visualization description API changes frequently and is unsupported. You can duplicate a
3847
5296
  visualization by copying description objects received _from the API_ and then using them to
3848
5297
  create a new one with a POST request to the same endpoint. Databricks does not recommend
@@ -3865,7 +5314,7 @@ class Widget:
3865
5314
  """Deserializes the Widget from a dictionary."""
3866
5315
  return cls(id=d.get('id', None),
3867
5316
  options=_from_dict(d, 'options', WidgetOptions),
3868
- visualization=_from_dict(d, 'visualization', Visualization),
5317
+ visualization=_from_dict(d, 'visualization', LegacyVisualization),
3869
5318
  width=d.get('width', None))
3870
5319
 
3871
5320
 
@@ -3959,14 +5408,123 @@ class WidgetPosition:
3959
5408
 
3960
5409
 
3961
5410
  class AlertsAPI:
5411
+ """The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks SQL object that
5412
+ periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or
5413
+ notification destinations if the condition was met. Alerts can be scheduled using the `sql_task` type of
5414
+ the Jobs API, e.g. :method:jobs/create."""
5415
+
5416
+ def __init__(self, api_client):
5417
+ self._api = api_client
5418
+
5419
+ def create(self, *, alert: Optional[CreateAlertRequestAlert] = None) -> Alert:
5420
+ """Create an alert.
5421
+
5422
+ Creates an alert.
5423
+
5424
+ :param alert: :class:`CreateAlertRequestAlert` (optional)
5425
+
5426
+ :returns: :class:`Alert`
5427
+ """
5428
+ body = {}
5429
+ if alert is not None: body['alert'] = alert.as_dict()
5430
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
5431
+
5432
+ res = self._api.do('POST', '/api/2.0/sql/alerts', body=body, headers=headers)
5433
+ return Alert.from_dict(res)
5434
+
5435
+ def delete(self, id: str):
5436
+ """Delete an alert.
5437
+
5438
+ Moves an alert to the trash. Trashed alerts immediately disappear from searches and list views, and
5439
+ can no longer trigger. You can restore a trashed alert through the UI. A trashed alert is permanently
5440
+ deleted after 30 days.
5441
+
5442
+ :param id: str
5443
+
5444
+
5445
+ """
5446
+
5447
+ headers = {'Accept': 'application/json', }
5448
+
5449
+ self._api.do('DELETE', f'/api/2.0/sql/alerts/{id}', headers=headers)
5450
+
5451
+ def get(self, id: str) -> Alert:
5452
+ """Get an alert.
5453
+
5454
+ Gets an alert.
5455
+
5456
+ :param id: str
5457
+
5458
+ :returns: :class:`Alert`
5459
+ """
5460
+
5461
+ headers = {'Accept': 'application/json', }
5462
+
5463
+ res = self._api.do('GET', f'/api/2.0/sql/alerts/{id}', headers=headers)
5464
+ return Alert.from_dict(res)
5465
+
5466
+ def list(self,
5467
+ *,
5468
+ page_size: Optional[int] = None,
5469
+ page_token: Optional[str] = None) -> Iterator[ListAlertsResponseAlert]:
5470
+ """List alerts.
5471
+
5472
+ Gets a list of alerts accessible to the user, ordered by creation time. **Warning:** Calling this API
5473
+ concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.
5474
+
5475
+ :param page_size: int (optional)
5476
+ :param page_token: str (optional)
5477
+
5478
+ :returns: Iterator over :class:`ListAlertsResponseAlert`
5479
+ """
5480
+
5481
+ query = {}
5482
+ if page_size is not None: query['page_size'] = page_size
5483
+ if page_token is not None: query['page_token'] = page_token
5484
+ headers = {'Accept': 'application/json', }
5485
+
5486
+ while True:
5487
+ json = self._api.do('GET', '/api/2.0/sql/alerts', query=query, headers=headers)
5488
+ if 'results' in json:
5489
+ for v in json['results']:
5490
+ yield ListAlertsResponseAlert.from_dict(v)
5491
+ if 'next_page_token' not in json or not json['next_page_token']:
5492
+ return
5493
+ query['page_token'] = json['next_page_token']
5494
+
5495
+ def update(self, id: str, update_mask: str, *, alert: Optional[UpdateAlertRequestAlert] = None) -> Alert:
5496
+ """Update an alert.
5497
+
5498
+ Updates an alert.
5499
+
5500
+ :param id: str
5501
+ :param update_mask: str
5502
+ Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
5503
+ setting payload will be updated. The field mask needs to be supplied as single string. To specify
5504
+ multiple fields in the field mask, use comma as the separator (no space).
5505
+ :param alert: :class:`UpdateAlertRequestAlert` (optional)
5506
+
5507
+ :returns: :class:`Alert`
5508
+ """
5509
+ body = {}
5510
+ if alert is not None: body['alert'] = alert.as_dict()
5511
+ if update_mask is not None: body['update_mask'] = update_mask
5512
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
5513
+
5514
+ res = self._api.do('PATCH', f'/api/2.0/sql/alerts/{id}', body=body, headers=headers)
5515
+ return Alert.from_dict(res)
5516
+
5517
+
5518
+ class AlertsLegacyAPI:
3962
5519
  """The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks SQL object that
3963
5520
  periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or
3964
5521
  notification destinations if the condition was met. Alerts can be scheduled using the `sql_task` type of
3965
5522
  the Jobs API, e.g. :method:jobs/create.
3966
5523
 
3967
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5524
+ **Note**: A new version of the Databricks SQL API is now available. Please see the latest version. [Learn
5525
+ more]
3968
5526
 
3969
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources"""
5527
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html"""
3970
5528
 
3971
5529
  def __init__(self, api_client):
3972
5530
  self._api = api_client
@@ -3977,15 +5535,16 @@ class AlertsAPI:
3977
5535
  query_id: str,
3978
5536
  *,
3979
5537
  parent: Optional[str] = None,
3980
- rearm: Optional[int] = None) -> Alert:
5538
+ rearm: Optional[int] = None) -> LegacyAlert:
3981
5539
  """Create an alert.
3982
5540
 
3983
5541
  Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a
3984
5542
  condition of its result, and notifies users or notification destinations if the condition was met.
3985
5543
 
3986
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5544
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:alerts/create
5545
+ instead. [Learn more]
3987
5546
 
3988
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5547
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
3989
5548
 
3990
5549
  :param name: str
3991
5550
  Name of the alert.
@@ -3999,7 +5558,7 @@ class AlertsAPI:
3999
5558
  Number of seconds after being triggered before the alert rearms itself and can be triggered again.
4000
5559
  If `null`, alert will never be triggered again.
4001
5560
 
4002
- :returns: :class:`Alert`
5561
+ :returns: :class:`LegacyAlert`
4003
5562
  """
4004
5563
  body = {}
4005
5564
  if name is not None: body['name'] = name
@@ -4010,7 +5569,7 @@ class AlertsAPI:
4010
5569
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
4011
5570
 
4012
5571
  res = self._api.do('POST', '/api/2.0/preview/sql/alerts', body=body, headers=headers)
4013
- return Alert.from_dict(res)
5572
+ return LegacyAlert.from_dict(res)
4014
5573
 
4015
5574
  def delete(self, alert_id: str):
4016
5575
  """Delete an alert.
@@ -4018,9 +5577,10 @@ class AlertsAPI:
4018
5577
  Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. **Note**: Unlike
4019
5578
  queries and dashboards, alerts cannot be moved to the trash.
4020
5579
 
4021
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5580
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:alerts/delete
5581
+ instead. [Learn more]
4022
5582
 
4023
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5583
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4024
5584
 
4025
5585
  :param alert_id: str
4026
5586
 
@@ -4031,41 +5591,43 @@ class AlertsAPI:
4031
5591
 
4032
5592
  self._api.do('DELETE', f'/api/2.0/preview/sql/alerts/{alert_id}', headers=headers)
4033
5593
 
4034
- def get(self, alert_id: str) -> Alert:
5594
+ def get(self, alert_id: str) -> LegacyAlert:
4035
5595
  """Get an alert.
4036
5596
 
4037
5597
  Gets an alert.
4038
5598
 
4039
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5599
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:alerts/get
5600
+ instead. [Learn more]
4040
5601
 
4041
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5602
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4042
5603
 
4043
5604
  :param alert_id: str
4044
5605
 
4045
- :returns: :class:`Alert`
5606
+ :returns: :class:`LegacyAlert`
4046
5607
  """
4047
5608
 
4048
5609
  headers = {'Accept': 'application/json', }
4049
5610
 
4050
5611
  res = self._api.do('GET', f'/api/2.0/preview/sql/alerts/{alert_id}', headers=headers)
4051
- return Alert.from_dict(res)
5612
+ return LegacyAlert.from_dict(res)
4052
5613
 
4053
- def list(self) -> Iterator[Alert]:
5614
+ def list(self) -> Iterator[LegacyAlert]:
4054
5615
  """Get alerts.
4055
5616
 
4056
5617
  Gets a list of alerts.
4057
5618
 
4058
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5619
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:alerts/list
5620
+ instead. [Learn more]
4059
5621
 
4060
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5622
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4061
5623
 
4062
- :returns: Iterator over :class:`Alert`
5624
+ :returns: Iterator over :class:`LegacyAlert`
4063
5625
  """
4064
5626
 
4065
5627
  headers = {'Accept': 'application/json', }
4066
5628
 
4067
5629
  res = self._api.do('GET', '/api/2.0/preview/sql/alerts', headers=headers)
4068
- return [Alert.from_dict(v) for v in res]
5630
+ return [LegacyAlert.from_dict(v) for v in res]
4069
5631
 
4070
5632
  def update(self,
4071
5633
  alert_id: str,
@@ -4078,9 +5640,10 @@ class AlertsAPI:
4078
5640
 
4079
5641
  Updates an alert.
4080
5642
 
4081
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5643
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:alerts/update
5644
+ instead. [Learn more]
4082
5645
 
4083
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5646
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4084
5647
 
4085
5648
  :param alert_id: str
4086
5649
  :param name: str
@@ -4380,9 +5943,9 @@ class DataSourcesAPI:
4380
5943
  advise you to use any text editor, REST client, or `grep` to search the response from this API for the
4381
5944
  name of your SQL warehouse as it appears in Databricks SQL.
4382
5945
 
4383
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5946
+ **Note**: A new version of the Databricks SQL API is now available. [Learn more]
4384
5947
 
4385
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources"""
5948
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html"""
4386
5949
 
4387
5950
  def __init__(self, api_client):
4388
5951
  self._api = api_client
@@ -4394,9 +5957,10 @@ class DataSourcesAPI:
4394
5957
  API response are enumerated for clarity. However, you need only a SQL warehouse's `id` to create new
4395
5958
  queries against it.
4396
5959
 
4397
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5960
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:warehouses/list
5961
+ instead. [Learn more]
4398
5962
 
4399
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
5963
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4400
5964
 
4401
5965
  :returns: Iterator over :class:`DataSource`
4402
5966
  """
@@ -4420,9 +5984,9 @@ class DbsqlPermissionsAPI:
4420
5984
 
4421
5985
  - `CAN_MANAGE`: Allows all actions: read, run, edit, delete, modify permissions (superset of `CAN_RUN`)
4422
5986
 
4423
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5987
+ **Note**: A new version of the Databricks SQL API is now available. [Learn more]
4424
5988
 
4425
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources"""
5989
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html"""
4426
5990
 
4427
5991
  def __init__(self, api_client):
4428
5992
  self._api = api_client
@@ -4432,9 +5996,10 @@ class DbsqlPermissionsAPI:
4432
5996
 
4433
5997
  Gets a JSON representation of the access control list (ACL) for a specified object.
4434
5998
 
4435
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
5999
+ **Note**: A new version of the Databricks SQL API is now available. Please use
6000
+ :method:workspace/getpermissions instead. [Learn more]
4436
6001
 
4437
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6002
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4438
6003
 
4439
6004
  :param object_type: :class:`ObjectTypePlural`
4440
6005
  The type of object permissions to check.
@@ -4461,9 +6026,10 @@ class DbsqlPermissionsAPI:
4461
6026
  Sets the access control list (ACL) for a specified object. This operation will complete rewrite the
4462
6027
  ACL.
4463
6028
 
4464
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6029
+ **Note**: A new version of the Databricks SQL API is now available. Please use
6030
+ :method:workspace/setpermissions instead. [Learn more]
4465
6031
 
4466
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6032
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4467
6033
 
4468
6034
  :param object_type: :class:`ObjectTypePlural`
4469
6035
  The type of object permission to set.
@@ -4493,9 +6059,10 @@ class DbsqlPermissionsAPI:
4493
6059
 
4494
6060
  Transfers ownership of a dashboard, query, or alert to an active user. Requires an admin API key.
4495
6061
 
4496
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6062
+ **Note**: A new version of the Databricks SQL API is now available. For queries and alerts, please use
6063
+ :method:queries/update and :method:alerts/update respectively instead. [Learn more]
4497
6064
 
4498
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6065
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4499
6066
 
4500
6067
  :param object_type: :class:`OwnableObjectType`
4501
6068
  The type of object on which to change ownership.
@@ -4518,13 +6085,154 @@ class DbsqlPermissionsAPI:
4518
6085
 
4519
6086
 
4520
6087
  class QueriesAPI:
6088
+ """The queries API can be used to perform CRUD operations on queries. A query is a Databricks SQL object that
6089
+ includes the target SQL warehouse, query text, name, description, tags, and parameters. Queries can be
6090
+ scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create."""
6091
+
6092
+ def __init__(self, api_client):
6093
+ self._api = api_client
6094
+
6095
+ def create(self, *, query: Optional[CreateQueryRequestQuery] = None) -> Query:
6096
+ """Create a query.
6097
+
6098
+ Creates a query.
6099
+
6100
+ :param query: :class:`CreateQueryRequestQuery` (optional)
6101
+
6102
+ :returns: :class:`Query`
6103
+ """
6104
+ body = {}
6105
+ if query is not None: body['query'] = query.as_dict()
6106
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
6107
+
6108
+ res = self._api.do('POST', '/api/2.0/sql/queries', body=body, headers=headers)
6109
+ return Query.from_dict(res)
6110
+
6111
+ def delete(self, id: str):
6112
+ """Delete a query.
6113
+
6114
+ Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and
6115
+ cannot be used for alerts. You can restore a trashed query through the UI. A trashed query is
6116
+ permanently deleted after 30 days.
6117
+
6118
+ :param id: str
6119
+
6120
+
6121
+ """
6122
+
6123
+ headers = {'Accept': 'application/json', }
6124
+
6125
+ self._api.do('DELETE', f'/api/2.0/sql/queries/{id}', headers=headers)
6126
+
6127
+ def get(self, id: str) -> Query:
6128
+ """Get a query.
6129
+
6130
+ Gets a query.
6131
+
6132
+ :param id: str
6133
+
6134
+ :returns: :class:`Query`
6135
+ """
6136
+
6137
+ headers = {'Accept': 'application/json', }
6138
+
6139
+ res = self._api.do('GET', f'/api/2.0/sql/queries/{id}', headers=headers)
6140
+ return Query.from_dict(res)
6141
+
6142
+ def list(self,
6143
+ *,
6144
+ page_size: Optional[int] = None,
6145
+ page_token: Optional[str] = None) -> Iterator[ListQueryObjectsResponseQuery]:
6146
+ """List queries.
6147
+
6148
+ Gets a list of queries accessible to the user, ordered by creation time. **Warning:** Calling this API
6149
+ concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.
6150
+
6151
+ :param page_size: int (optional)
6152
+ :param page_token: str (optional)
6153
+
6154
+ :returns: Iterator over :class:`ListQueryObjectsResponseQuery`
6155
+ """
6156
+
6157
+ query = {}
6158
+ if page_size is not None: query['page_size'] = page_size
6159
+ if page_token is not None: query['page_token'] = page_token
6160
+ headers = {'Accept': 'application/json', }
6161
+
6162
+ while True:
6163
+ json = self._api.do('GET', '/api/2.0/sql/queries', query=query, headers=headers)
6164
+ if 'results' in json:
6165
+ for v in json['results']:
6166
+ yield ListQueryObjectsResponseQuery.from_dict(v)
6167
+ if 'next_page_token' not in json or not json['next_page_token']:
6168
+ return
6169
+ query['page_token'] = json['next_page_token']
6170
+
6171
+ def list_visualizations(self,
6172
+ id: str,
6173
+ *,
6174
+ page_size: Optional[int] = None,
6175
+ page_token: Optional[str] = None) -> Iterator[Visualization]:
6176
+ """List visualizations on a query.
6177
+
6178
+ Gets a list of visualizations on a query.
6179
+
6180
+ :param id: str
6181
+ :param page_size: int (optional)
6182
+ :param page_token: str (optional)
6183
+
6184
+ :returns: Iterator over :class:`Visualization`
6185
+ """
6186
+
6187
+ query = {}
6188
+ if page_size is not None: query['page_size'] = page_size
6189
+ if page_token is not None: query['page_token'] = page_token
6190
+ headers = {'Accept': 'application/json', }
6191
+
6192
+ while True:
6193
+ json = self._api.do('GET',
6194
+ f'/api/2.0/sql/queries/{id}/visualizations',
6195
+ query=query,
6196
+ headers=headers)
6197
+ if 'results' in json:
6198
+ for v in json['results']:
6199
+ yield Visualization.from_dict(v)
6200
+ if 'next_page_token' not in json or not json['next_page_token']:
6201
+ return
6202
+ query['page_token'] = json['next_page_token']
6203
+
6204
+ def update(self, id: str, update_mask: str, *, query: Optional[UpdateQueryRequestQuery] = None) -> Query:
6205
+ """Update a query.
6206
+
6207
+ Updates a query.
6208
+
6209
+ :param id: str
6210
+ :param update_mask: str
6211
+ Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
6212
+ setting payload will be updated. The field mask needs to be supplied as single string. To specify
6213
+ multiple fields in the field mask, use comma as the separator (no space).
6214
+ :param query: :class:`UpdateQueryRequestQuery` (optional)
6215
+
6216
+ :returns: :class:`Query`
6217
+ """
6218
+ body = {}
6219
+ if query is not None: body['query'] = query.as_dict()
6220
+ if update_mask is not None: body['update_mask'] = update_mask
6221
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
6222
+
6223
+ res = self._api.do('PATCH', f'/api/2.0/sql/queries/{id}', body=body, headers=headers)
6224
+ return Query.from_dict(res)
6225
+
6226
+
6227
+ class QueriesLegacyAPI:
4521
6228
  """These endpoints are used for CRUD operations on query definitions. Query definitions include the target
4522
6229
  SQL warehouse, query text, name, description, tags, parameters, and visualizations. Queries can be
4523
6230
  scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create.
4524
6231
 
4525
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6232
+ **Note**: A new version of the Databricks SQL API is now available. Please see the latest version. [Learn
6233
+ more]
4526
6234
 
4527
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources"""
6235
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html"""
4528
6236
 
4529
6237
  def __init__(self, api_client):
4530
6238
  self._api = api_client
@@ -4538,7 +6246,7 @@ class QueriesAPI:
4538
6246
  parent: Optional[str] = None,
4539
6247
  query: Optional[str] = None,
4540
6248
  run_as_role: Optional[RunAsRole] = None,
4541
- tags: Optional[List[str]] = None) -> Query:
6249
+ tags: Optional[List[str]] = None) -> LegacyQuery:
4542
6250
  """Create a new query definition.
4543
6251
 
4544
6252
  Creates a new query definition. Queries created with this endpoint belong to the authenticated user
@@ -4550,9 +6258,10 @@ class QueriesAPI:
4550
6258
 
4551
6259
  **Note**: You cannot add a visualization until you create the query.
4552
6260
 
4553
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6261
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:queries/create
6262
+ instead. [Learn more]
4554
6263
 
4555
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6264
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4556
6265
 
4557
6266
  :param data_source_id: str (optional)
4558
6267
  Data source ID maps to the ID of the data source used by the resource and is distinct from the
@@ -4576,7 +6285,7 @@ class QueriesAPI:
4576
6285
  viewer" behavior) or `"owner"` (signifying "run as owner" behavior)
4577
6286
  :param tags: List[str] (optional)
4578
6287
 
4579
- :returns: :class:`Query`
6288
+ :returns: :class:`LegacyQuery`
4580
6289
  """
4581
6290
  body = {}
4582
6291
  if data_source_id is not None: body['data_source_id'] = data_source_id
@@ -4590,7 +6299,7 @@ class QueriesAPI:
4590
6299
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
4591
6300
 
4592
6301
  res = self._api.do('POST', '/api/2.0/preview/sql/queries', body=body, headers=headers)
4593
- return Query.from_dict(res)
6302
+ return LegacyQuery.from_dict(res)
4594
6303
 
4595
6304
  def delete(self, query_id: str):
4596
6305
  """Delete a query.
@@ -4598,9 +6307,10 @@ class QueriesAPI:
4598
6307
  Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and
4599
6308
  they cannot be used for alerts. The trash is deleted after 30 days.
4600
6309
 
4601
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6310
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:queries/delete
6311
+ instead. [Learn more]
4602
6312
 
4603
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6313
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4604
6314
 
4605
6315
  :param query_id: str
4606
6316
 
@@ -4611,32 +6321,33 @@ class QueriesAPI:
4611
6321
 
4612
6322
  self._api.do('DELETE', f'/api/2.0/preview/sql/queries/{query_id}', headers=headers)
4613
6323
 
4614
- def get(self, query_id: str) -> Query:
6324
+ def get(self, query_id: str) -> LegacyQuery:
4615
6325
  """Get a query definition.
4616
6326
 
4617
6327
  Retrieve a query object definition along with contextual permissions information about the currently
4618
6328
  authenticated user.
4619
6329
 
4620
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6330
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:queries/get
6331
+ instead. [Learn more]
4621
6332
 
4622
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6333
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4623
6334
 
4624
6335
  :param query_id: str
4625
6336
 
4626
- :returns: :class:`Query`
6337
+ :returns: :class:`LegacyQuery`
4627
6338
  """
4628
6339
 
4629
6340
  headers = {'Accept': 'application/json', }
4630
6341
 
4631
6342
  res = self._api.do('GET', f'/api/2.0/preview/sql/queries/{query_id}', headers=headers)
4632
- return Query.from_dict(res)
6343
+ return LegacyQuery.from_dict(res)
4633
6344
 
4634
6345
  def list(self,
4635
6346
  *,
4636
6347
  order: Optional[str] = None,
4637
6348
  page: Optional[int] = None,
4638
6349
  page_size: Optional[int] = None,
4639
- q: Optional[str] = None) -> Iterator[Query]:
6350
+ q: Optional[str] = None) -> Iterator[LegacyQuery]:
4640
6351
  """Get a list of queries.
4641
6352
 
4642
6353
  Gets a list of queries. Optionally, this list can be filtered by a search term.
@@ -4644,9 +6355,10 @@ class QueriesAPI:
4644
6355
  **Warning**: Calling this API concurrently 10 or more times could result in throttling, service
4645
6356
  degradation, or a temporary ban.
4646
6357
 
4647
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6358
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:queries/list
6359
+ instead. [Learn more]
4648
6360
 
4649
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6361
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4650
6362
 
4651
6363
  :param order: str (optional)
4652
6364
  Name of query attribute to order by. Default sort order is ascending. Append a dash (`-`) to order
@@ -4669,7 +6381,7 @@ class QueriesAPI:
4669
6381
  :param q: str (optional)
4670
6382
  Full text search term
4671
6383
 
4672
- :returns: Iterator over :class:`Query`
6384
+ :returns: Iterator over :class:`LegacyQuery`
4673
6385
  """
4674
6386
 
4675
6387
  query = {}
@@ -4690,7 +6402,7 @@ class QueriesAPI:
4690
6402
  if i in seen:
4691
6403
  continue
4692
6404
  seen.add(i)
4693
- yield Query.from_dict(v)
6405
+ yield LegacyQuery.from_dict(v)
4694
6406
  if 'results' not in json or not json['results']:
4695
6407
  return
4696
6408
  query['page'] += 1
@@ -4701,9 +6413,10 @@ class QueriesAPI:
4701
6413
  Restore a query that has been moved to the trash. A restored query appears in list views and searches.
4702
6414
  You can use restored queries for alerts.
4703
6415
 
4704
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6416
+ **Note**: A new version of the Databricks SQL API is now available. Please see the latest version.
6417
+ [Learn more]
4705
6418
 
4706
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6419
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4707
6420
 
4708
6421
  :param query_id: str
4709
6422
 
@@ -4723,16 +6436,17 @@ class QueriesAPI:
4723
6436
  options: Optional[Any] = None,
4724
6437
  query: Optional[str] = None,
4725
6438
  run_as_role: Optional[RunAsRole] = None,
4726
- tags: Optional[List[str]] = None) -> Query:
6439
+ tags: Optional[List[str]] = None) -> LegacyQuery:
4727
6440
  """Change a query definition.
4728
6441
 
4729
6442
  Modify this query definition.
4730
6443
 
4731
6444
  **Note**: You cannot undo this operation.
4732
6445
 
4733
- **Note**: A new version of the Databricks SQL API will soon be available. [Learn more]
6446
+ **Note**: A new version of the Databricks SQL API is now available. Please use :method:queries/update
6447
+ instead. [Learn more]
4734
6448
 
4735
- [Learn more]: https://docs.databricks.com/en/whats-coming.html#updates-to-the-databricks-sql-api-for-managing-queries-alerts-and-data-sources
6449
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
4736
6450
 
4737
6451
  :param query_id: str
4738
6452
  :param data_source_id: str (optional)
@@ -4755,7 +6469,7 @@ class QueriesAPI:
4755
6469
  viewer" behavior) or `"owner"` (signifying "run as owner" behavior)
4756
6470
  :param tags: List[str] (optional)
4757
6471
 
4758
- :returns: :class:`Query`
6472
+ :returns: :class:`LegacyQuery`
4759
6473
  """
4760
6474
  body = {}
4761
6475
  if data_source_id is not None: body['data_source_id'] = data_source_id
@@ -4768,11 +6482,12 @@ class QueriesAPI:
4768
6482
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
4769
6483
 
4770
6484
  res = self._api.do('POST', f'/api/2.0/preview/sql/queries/{query_id}', body=body, headers=headers)
4771
- return Query.from_dict(res)
6485
+ return LegacyQuery.from_dict(res)
4772
6486
 
4773
6487
 
4774
6488
  class QueryHistoryAPI:
4775
- """Access the history of queries through SQL warehouses."""
6489
+ """A service responsible for storing and retrieving the list of queries run against SQL endpoints and
6490
+ serverless compute."""
4776
6491
 
4777
6492
  def __init__(self, api_client):
4778
6493
  self._api = api_client
@@ -4782,25 +6497,28 @@ class QueryHistoryAPI:
4782
6497
  filter_by: Optional[QueryFilter] = None,
4783
6498
  include_metrics: Optional[bool] = None,
4784
6499
  max_results: Optional[int] = None,
4785
- page_token: Optional[str] = None) -> Iterator[QueryInfo]:
6500
+ page_token: Optional[str] = None) -> ListQueriesResponse:
4786
6501
  """List Queries.
4787
6502
 
4788
- List the history of queries through SQL warehouses.
6503
+ List the history of queries through SQL warehouses, and serverless compute.
4789
6504
 
4790
- You can filter by user ID, warehouse ID, status, and time range.
6505
+ You can filter by user ID, warehouse ID, status, and time range. Most recently started queries are
6506
+ returned first (up to max_results in request). The pagination token returned in response can be used
6507
+ to list subsequent query statuses.
4791
6508
 
4792
6509
  :param filter_by: :class:`QueryFilter` (optional)
4793
6510
  A filter to limit query history results. This field is optional.
4794
6511
  :param include_metrics: bool (optional)
4795
- Whether to include metrics about query.
6512
+ Whether to include the query metrics with each query. Only use this for a small subset of queries
6513
+ (max_results). Defaults to false.
4796
6514
  :param max_results: int (optional)
4797
- Limit the number of results returned in one page. The default is 100.
6515
+ Limit the number of results returned in one page. Must be less than 1000 and the default is 100.
4798
6516
  :param page_token: str (optional)
4799
6517
  A token that can be used to get the next page of results. The token can contains characters that
4800
6518
  need to be encoded before using it in a URL. For example, the character '+' needs to be replaced by
4801
- %2B.
6519
+ %2B. This field is optional.
4802
6520
 
4803
- :returns: Iterator over :class:`QueryInfo`
6521
+ :returns: :class:`ListQueriesResponse`
4804
6522
  """
4805
6523
 
4806
6524
  query = {}
@@ -4810,19 +6528,84 @@ class QueryHistoryAPI:
4810
6528
  if page_token is not None: query['page_token'] = page_token
4811
6529
  headers = {'Accept': 'application/json', }
4812
6530
 
4813
- while True:
4814
- json = self._api.do('GET', '/api/2.0/sql/history/queries', query=query, headers=headers)
4815
- if 'res' in json:
4816
- for v in json['res']:
4817
- yield QueryInfo.from_dict(v)
4818
- if 'next_page_token' not in json or not json['next_page_token']:
4819
- return
4820
- query['page_token'] = json['next_page_token']
6531
+ res = self._api.do('GET', '/api/2.0/sql/history/queries', query=query, headers=headers)
6532
+ return ListQueriesResponse.from_dict(res)
4821
6533
 
4822
6534
 
4823
6535
  class QueryVisualizationsAPI:
6536
+ """This is an evolving API that facilitates the addition and removal of visualizations from existing queries
6537
+ in the Databricks Workspace. Data structures can change over time."""
6538
+
6539
+ def __init__(self, api_client):
6540
+ self._api = api_client
6541
+
6542
+ def create(self,
6543
+ *,
6544
+ visualization: Optional[CreateVisualizationRequestVisualization] = None) -> Visualization:
6545
+ """Add a visualization to a query.
6546
+
6547
+ Adds a visualization to a query.
6548
+
6549
+ :param visualization: :class:`CreateVisualizationRequestVisualization` (optional)
6550
+
6551
+ :returns: :class:`Visualization`
6552
+ """
6553
+ body = {}
6554
+ if visualization is not None: body['visualization'] = visualization.as_dict()
6555
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
6556
+
6557
+ res = self._api.do('POST', '/api/2.0/sql/visualizations', body=body, headers=headers)
6558
+ return Visualization.from_dict(res)
6559
+
6560
+ def delete(self, id: str):
6561
+ """Remove a visualization.
6562
+
6563
+ Removes a visualization.
6564
+
6565
+ :param id: str
6566
+
6567
+
6568
+ """
6569
+
6570
+ headers = {'Accept': 'application/json', }
6571
+
6572
+ self._api.do('DELETE', f'/api/2.0/sql/visualizations/{id}', headers=headers)
6573
+
6574
+ def update(self,
6575
+ id: str,
6576
+ update_mask: str,
6577
+ *,
6578
+ visualization: Optional[UpdateVisualizationRequestVisualization] = None) -> Visualization:
6579
+ """Update a visualization.
6580
+
6581
+ Updates a visualization.
6582
+
6583
+ :param id: str
6584
+ :param update_mask: str
6585
+ Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
6586
+ setting payload will be updated. The field mask needs to be supplied as single string. To specify
6587
+ multiple fields in the field mask, use comma as the separator (no space).
6588
+ :param visualization: :class:`UpdateVisualizationRequestVisualization` (optional)
6589
+
6590
+ :returns: :class:`Visualization`
6591
+ """
6592
+ body = {}
6593
+ if update_mask is not None: body['update_mask'] = update_mask
6594
+ if visualization is not None: body['visualization'] = visualization.as_dict()
6595
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
6596
+
6597
+ res = self._api.do('PATCH', f'/api/2.0/sql/visualizations/{id}', body=body, headers=headers)
6598
+ return Visualization.from_dict(res)
6599
+
6600
+
6601
+ class QueryVisualizationsLegacyAPI:
4824
6602
  """This is an evolving API that facilitates the addition and removal of vizualisations from existing queries
4825
- within the Databricks Workspace. Data structures may change over time."""
6603
+ within the Databricks Workspace. Data structures may change over time.
6604
+
6605
+ **Note**: A new version of the Databricks SQL API is now available. Please see the latest version. [Learn
6606
+ more]
6607
+
6608
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html"""
4826
6609
 
4827
6610
  def __init__(self, api_client):
4828
6611
  self._api = api_client
@@ -4833,9 +6616,16 @@ class QueryVisualizationsAPI:
4833
6616
  options: Any,
4834
6617
  *,
4835
6618
  description: Optional[str] = None,
4836
- name: Optional[str] = None) -> Visualization:
6619
+ name: Optional[str] = None) -> LegacyVisualization:
4837
6620
  """Add visualization to a query.
4838
6621
 
6622
+ Creates visualization in the query.
6623
+
6624
+ **Note**: A new version of the Databricks SQL API is now available. Please use
6625
+ :method:queryvisualizations/create instead. [Learn more]
6626
+
6627
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
6628
+
4839
6629
  :param query_id: str
4840
6630
  The identifier returned by :method:queries/create
4841
6631
  :param type: str
@@ -4848,7 +6638,7 @@ class QueryVisualizationsAPI:
4848
6638
  :param name: str (optional)
4849
6639
  The name of the visualization that appears on dashboards and the query screen.
4850
6640
 
4851
- :returns: :class:`Visualization`
6641
+ :returns: :class:`LegacyVisualization`
4852
6642
  """
4853
6643
  body = {}
4854
6644
  if description is not None: body['description'] = description
@@ -4859,11 +6649,18 @@ class QueryVisualizationsAPI:
4859
6649
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
4860
6650
 
4861
6651
  res = self._api.do('POST', '/api/2.0/preview/sql/visualizations', body=body, headers=headers)
4862
- return Visualization.from_dict(res)
6652
+ return LegacyVisualization.from_dict(res)
4863
6653
 
4864
6654
  def delete(self, id: str):
4865
6655
  """Remove visualization.
4866
6656
 
6657
+ Removes a visualization from the query.
6658
+
6659
+ **Note**: A new version of the Databricks SQL API is now available. Please use
6660
+ :method:queryvisualizations/delete instead. [Learn more]
6661
+
6662
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
6663
+
4867
6664
  :param id: str
4868
6665
  Widget ID returned by :method:queryvizualisations/create
4869
6666
 
@@ -4881,11 +6678,18 @@ class QueryVisualizationsAPI:
4881
6678
  description: Optional[str] = None,
4882
6679
  name: Optional[str] = None,
4883
6680
  options: Optional[Any] = None,
4884
- query: Optional[Query] = None,
6681
+ query: Optional[LegacyQuery] = None,
4885
6682
  type: Optional[str] = None,
4886
- updated_at: Optional[str] = None) -> Visualization:
6683
+ updated_at: Optional[str] = None) -> LegacyVisualization:
4887
6684
  """Edit existing visualization.
4888
6685
 
6686
+ Updates visualization in the query.
6687
+
6688
+ **Note**: A new version of the Databricks SQL API is now available. Please use
6689
+ :method:queryvisualizations/update instead. [Learn more]
6690
+
6691
+ [Learn more]: https://docs.databricks.com/en/sql/dbsql-api-latest.html
6692
+
4889
6693
  :param id: str
4890
6694
  The UUID for this visualization.
4891
6695
  :param created_at: str (optional)
@@ -4896,12 +6700,12 @@ class QueryVisualizationsAPI:
4896
6700
  :param options: Any (optional)
4897
6701
  The options object varies widely from one visualization type to the next and is unsupported.
4898
6702
  Databricks does not recommend modifying visualization settings in JSON.
4899
- :param query: :class:`Query` (optional)
6703
+ :param query: :class:`LegacyQuery` (optional)
4900
6704
  :param type: str (optional)
4901
6705
  The type of visualization: chart, table, pivot table, and so on.
4902
6706
  :param updated_at: str (optional)
4903
6707
 
4904
- :returns: :class:`Visualization`
6708
+ :returns: :class:`LegacyVisualization`
4905
6709
  """
4906
6710
  body = {}
4907
6711
  if created_at is not None: body['created_at'] = created_at
@@ -4914,7 +6718,7 @@ class QueryVisualizationsAPI:
4914
6718
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
4915
6719
 
4916
6720
  res = self._api.do('POST', f'/api/2.0/preview/sql/visualizations/{id}', body=body, headers=headers)
4917
- return Visualization.from_dict(res)
6721
+ return LegacyVisualization.from_dict(res)
4918
6722
 
4919
6723
 
4920
6724
  class StatementExecutionAPI:
@@ -5033,7 +6837,7 @@ class StatementExecutionAPI:
5033
6837
  parameters: Optional[List[StatementParameterListItem]] = None,
5034
6838
  row_limit: Optional[int] = None,
5035
6839
  schema: Optional[str] = None,
5036
- wait_timeout: Optional[str] = None) -> ExecuteStatementResponse:
6840
+ wait_timeout: Optional[str] = None) -> StatementResponse:
5037
6841
  """Execute a SQL statement.
5038
6842
 
5039
6843
  :param statement: str
@@ -5053,26 +6857,6 @@ class StatementExecutionAPI:
5053
6857
 
5054
6858
  [`USE CATALOG`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-catalog.html
5055
6859
  :param disposition: :class:`Disposition` (optional)
5056
- The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`.
5057
-
5058
- Statements executed with `INLINE` disposition will return result data inline, in `JSON_ARRAY`
5059
- format, in a series of chunks. If a given statement produces a result set with a size larger than 25
5060
- MiB, that statement execution is aborted, and no result set will be available.
5061
-
5062
- **NOTE** Byte limits are computed based upon internal representations of the result set data, and
5063
- might not match the sizes visible in JSON responses.
5064
-
5065
- Statements executed with `EXTERNAL_LINKS` disposition will return result data as external links:
5066
- URLs that point to cloud storage internal to the workspace. Using `EXTERNAL_LINKS` disposition
5067
- allows statements to generate arbitrarily sized result sets for fetching up to 100 GiB. The
5068
- resulting links have two important properties:
5069
-
5070
- 1. They point to resources _external_ to the Databricks compute; therefore any associated
5071
- authentication information (typically a personal access token, OAuth token, or similar) _must be
5072
- removed_ when fetching from these links.
5073
-
5074
- 2. These are presigned URLs with a specific expiration, indicated in the response. The behavior when
5075
- attempting to use an expired link is cloud specific.
5076
6860
  :param format: :class:`Format` (optional)
5077
6861
  Statement execution supports three result formats: `JSON_ARRAY` (default), `ARROW_STREAM`, and
5078
6862
  `CSV`.
@@ -5160,7 +6944,7 @@ class StatementExecutionAPI:
5160
6944
  the statement takes longer to execute, `on_wait_timeout` determines what should happen after the
5161
6945
  timeout is reached.
5162
6946
 
5163
- :returns: :class:`ExecuteStatementResponse`
6947
+ :returns: :class:`StatementResponse`
5164
6948
  """
5165
6949
  body = {}
5166
6950
  if byte_limit is not None: body['byte_limit'] = byte_limit
@@ -5177,9 +6961,9 @@ class StatementExecutionAPI:
5177
6961
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
5178
6962
 
5179
6963
  res = self._api.do('POST', '/api/2.0/sql/statements/', body=body, headers=headers)
5180
- return ExecuteStatementResponse.from_dict(res)
6964
+ return StatementResponse.from_dict(res)
5181
6965
 
5182
- def get_statement(self, statement_id: str) -> GetStatementResponse:
6966
+ def get_statement(self, statement_id: str) -> StatementResponse:
5183
6967
  """Get status, manifest, and result first chunk.
5184
6968
 
5185
6969
  This request can be used to poll for the statement's status. When the `status.state` field is
@@ -5194,13 +6978,13 @@ class StatementExecutionAPI:
5194
6978
  The statement ID is returned upon successfully submitting a SQL statement, and is a required
5195
6979
  reference for all subsequent calls.
5196
6980
 
5197
- :returns: :class:`GetStatementResponse`
6981
+ :returns: :class:`StatementResponse`
5198
6982
  """
5199
6983
 
5200
6984
  headers = {'Accept': 'application/json', }
5201
6985
 
5202
6986
  res = self._api.do('GET', f'/api/2.0/sql/statements/{statement_id}', headers=headers)
5203
- return GetStatementResponse.from_dict(res)
6987
+ return StatementResponse.from_dict(res)
5204
6988
 
5205
6989
  def get_statement_result_chunk_n(self, statement_id: str, chunk_index: int) -> ResultData:
5206
6990
  """Get result chunk by index.