databricks-sdk 0.44.1__py3-none-any.whl → 0.46.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 (63) hide show
  1. databricks/sdk/__init__.py +135 -116
  2. databricks/sdk/_base_client.py +112 -88
  3. databricks/sdk/_property.py +12 -7
  4. databricks/sdk/_widgets/__init__.py +13 -2
  5. databricks/sdk/_widgets/default_widgets_utils.py +21 -15
  6. databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
  7. databricks/sdk/azure.py +8 -6
  8. databricks/sdk/casing.py +5 -5
  9. databricks/sdk/config.py +156 -99
  10. databricks/sdk/core.py +57 -47
  11. databricks/sdk/credentials_provider.py +306 -206
  12. databricks/sdk/data_plane.py +75 -50
  13. databricks/sdk/dbutils.py +123 -87
  14. databricks/sdk/environments.py +52 -35
  15. databricks/sdk/errors/base.py +61 -35
  16. databricks/sdk/errors/customizer.py +3 -3
  17. databricks/sdk/errors/deserializer.py +38 -25
  18. databricks/sdk/errors/details.py +417 -0
  19. databricks/sdk/errors/mapper.py +1 -1
  20. databricks/sdk/errors/overrides.py +27 -24
  21. databricks/sdk/errors/parser.py +26 -14
  22. databricks/sdk/errors/platform.py +10 -10
  23. databricks/sdk/errors/private_link.py +24 -24
  24. databricks/sdk/logger/round_trip_logger.py +28 -20
  25. databricks/sdk/mixins/compute.py +90 -60
  26. databricks/sdk/mixins/files.py +815 -145
  27. databricks/sdk/mixins/jobs.py +191 -16
  28. databricks/sdk/mixins/open_ai_client.py +26 -20
  29. databricks/sdk/mixins/workspace.py +45 -34
  30. databricks/sdk/oauth.py +379 -198
  31. databricks/sdk/retries.py +14 -12
  32. databricks/sdk/runtime/__init__.py +34 -17
  33. databricks/sdk/runtime/dbutils_stub.py +52 -39
  34. databricks/sdk/service/_internal.py +12 -7
  35. databricks/sdk/service/apps.py +618 -418
  36. databricks/sdk/service/billing.py +827 -604
  37. databricks/sdk/service/catalog.py +6552 -4474
  38. databricks/sdk/service/cleanrooms.py +550 -388
  39. databricks/sdk/service/compute.py +5263 -3536
  40. databricks/sdk/service/dashboards.py +1331 -924
  41. databricks/sdk/service/files.py +446 -309
  42. databricks/sdk/service/iam.py +2115 -1483
  43. databricks/sdk/service/jobs.py +4151 -2588
  44. databricks/sdk/service/marketplace.py +2210 -1517
  45. databricks/sdk/service/ml.py +3839 -2256
  46. databricks/sdk/service/oauth2.py +910 -584
  47. databricks/sdk/service/pipelines.py +1865 -1203
  48. databricks/sdk/service/provisioning.py +1435 -1029
  49. databricks/sdk/service/serving.py +2060 -1290
  50. databricks/sdk/service/settings.py +2846 -1929
  51. databricks/sdk/service/sharing.py +2201 -877
  52. databricks/sdk/service/sql.py +4650 -3103
  53. databricks/sdk/service/vectorsearch.py +816 -550
  54. databricks/sdk/service/workspace.py +1330 -906
  55. databricks/sdk/useragent.py +36 -22
  56. databricks/sdk/version.py +1 -1
  57. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/METADATA +31 -31
  58. databricks_sdk-0.46.0.dist-info/RECORD +70 -0
  59. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/WHEEL +1 -1
  60. databricks_sdk-0.44.1.dist-info/RECORD +0 -69
  61. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/LICENSE +0 -0
  62. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/NOTICE +0 -0
  63. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/top_level.txt +0 -0
@@ -8,12 +8,13 @@ import time
8
8
  from dataclasses import dataclass
9
9
  from datetime import timedelta
10
10
  from enum import Enum
11
- from typing import Callable, Dict, Iterator, List, Optional
11
+ from typing import Any, Callable, Dict, Iterator, List, Optional
12
12
 
13
13
  from ..errors import OperationFailed
14
14
  from ._internal import Wait, _enum, _from_dict, _repeated_dict
15
15
 
16
- _LOG = logging.getLogger('databricks.sdk')
16
+ _LOG = logging.getLogger("databricks.sdk")
17
+
17
18
 
18
19
  from databricks.sdk.service import sql
19
20
 
@@ -27,19 +28,21 @@ class CancelQueryExecutionResponse:
27
28
  def as_dict(self) -> dict:
28
29
  """Serializes the CancelQueryExecutionResponse into a dictionary suitable for use as a JSON request body."""
29
30
  body = {}
30
- if self.status: body['status'] = [v.as_dict() for v in self.status]
31
+ if self.status:
32
+ body["status"] = [v.as_dict() for v in self.status]
31
33
  return body
32
34
 
33
35
  def as_shallow_dict(self) -> dict:
34
36
  """Serializes the CancelQueryExecutionResponse into a shallow dictionary of its immediate attributes."""
35
37
  body = {}
36
- if self.status: body['status'] = self.status
38
+ if self.status:
39
+ body["status"] = self.status
37
40
  return body
38
41
 
39
42
  @classmethod
40
- def from_dict(cls, d: Dict[str, any]) -> CancelQueryExecutionResponse:
43
+ def from_dict(cls, d: Dict[str, Any]) -> CancelQueryExecutionResponse:
41
44
  """Deserializes the CancelQueryExecutionResponse from a dictionary."""
42
- return cls(status=_repeated_dict(d, 'status', CancelQueryExecutionResponseStatus))
45
+ return cls(status=_repeated_dict(d, "status", CancelQueryExecutionResponseStatus))
43
46
 
44
47
 
45
48
  @dataclass
@@ -59,25 +62,33 @@ class CancelQueryExecutionResponseStatus:
59
62
  def as_dict(self) -> dict:
60
63
  """Serializes the CancelQueryExecutionResponseStatus into a dictionary suitable for use as a JSON request body."""
61
64
  body = {}
62
- if self.data_token is not None: body['data_token'] = self.data_token
63
- if self.pending: body['pending'] = self.pending.as_dict()
64
- if self.success: body['success'] = self.success.as_dict()
65
+ if self.data_token is not None:
66
+ body["data_token"] = self.data_token
67
+ if self.pending:
68
+ body["pending"] = self.pending.as_dict()
69
+ if self.success:
70
+ body["success"] = self.success.as_dict()
65
71
  return body
66
72
 
67
73
  def as_shallow_dict(self) -> dict:
68
74
  """Serializes the CancelQueryExecutionResponseStatus into a shallow dictionary of its immediate attributes."""
69
75
  body = {}
70
- if self.data_token is not None: body['data_token'] = self.data_token
71
- if self.pending: body['pending'] = self.pending
72
- if self.success: body['success'] = self.success
76
+ if self.data_token is not None:
77
+ body["data_token"] = self.data_token
78
+ if self.pending:
79
+ body["pending"] = self.pending
80
+ if self.success:
81
+ body["success"] = self.success
73
82
  return body
74
83
 
75
84
  @classmethod
76
- def from_dict(cls, d: Dict[str, any]) -> CancelQueryExecutionResponseStatus:
85
+ def from_dict(cls, d: Dict[str, Any]) -> CancelQueryExecutionResponseStatus:
77
86
  """Deserializes the CancelQueryExecutionResponseStatus from a dictionary."""
78
- return cls(data_token=d.get('data_token', None),
79
- pending=_from_dict(d, 'pending', Empty),
80
- success=_from_dict(d, 'success', Empty))
87
+ return cls(
88
+ data_token=d.get("data_token", None),
89
+ pending=_from_dict(d, "pending", Empty),
90
+ success=_from_dict(d, "success", Empty),
91
+ )
81
92
 
82
93
 
83
94
  @dataclass
@@ -98,23 +109,24 @@ class CronSchedule:
98
109
  """Serializes the CronSchedule into a dictionary suitable for use as a JSON request body."""
99
110
  body = {}
100
111
  if self.quartz_cron_expression is not None:
101
- body['quartz_cron_expression'] = self.quartz_cron_expression
102
- if self.timezone_id is not None: body['timezone_id'] = self.timezone_id
112
+ body["quartz_cron_expression"] = self.quartz_cron_expression
113
+ if self.timezone_id is not None:
114
+ body["timezone_id"] = self.timezone_id
103
115
  return body
104
116
 
105
117
  def as_shallow_dict(self) -> dict:
106
118
  """Serializes the CronSchedule into a shallow dictionary of its immediate attributes."""
107
119
  body = {}
108
120
  if self.quartz_cron_expression is not None:
109
- body['quartz_cron_expression'] = self.quartz_cron_expression
110
- if self.timezone_id is not None: body['timezone_id'] = self.timezone_id
121
+ body["quartz_cron_expression"] = self.quartz_cron_expression
122
+ if self.timezone_id is not None:
123
+ body["timezone_id"] = self.timezone_id
111
124
  return body
112
125
 
113
126
  @classmethod
114
- def from_dict(cls, d: Dict[str, any]) -> CronSchedule:
127
+ def from_dict(cls, d: Dict[str, Any]) -> CronSchedule:
115
128
  """Deserializes the CronSchedule from a dictionary."""
116
- return cls(quartz_cron_expression=d.get('quartz_cron_expression', None),
117
- timezone_id=d.get('timezone_id', None))
129
+ return cls(quartz_cron_expression=d.get("quartz_cron_expression", None), timezone_id=d.get("timezone_id", None))
118
130
 
119
131
 
120
132
  @dataclass
@@ -161,77 +173,77 @@ class Dashboard:
161
173
  def as_dict(self) -> dict:
162
174
  """Serializes the Dashboard into a dictionary suitable for use as a JSON request body."""
163
175
  body = {}
164
- if self.create_time is not None: body['create_time'] = self.create_time
165
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
166
- if self.display_name is not None: body['display_name'] = self.display_name
167
- if self.etag is not None: body['etag'] = self.etag
168
- if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state.value
169
- if self.parent_path is not None: body['parent_path'] = self.parent_path
170
- if self.path is not None: body['path'] = self.path
171
- if self.serialized_dashboard is not None: body['serialized_dashboard'] = self.serialized_dashboard
172
- if self.update_time is not None: body['update_time'] = self.update_time
173
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
176
+ if self.create_time is not None:
177
+ body["create_time"] = self.create_time
178
+ if self.dashboard_id is not None:
179
+ body["dashboard_id"] = self.dashboard_id
180
+ if self.display_name is not None:
181
+ body["display_name"] = self.display_name
182
+ if self.etag is not None:
183
+ body["etag"] = self.etag
184
+ if self.lifecycle_state is not None:
185
+ body["lifecycle_state"] = self.lifecycle_state.value
186
+ if self.parent_path is not None:
187
+ body["parent_path"] = self.parent_path
188
+ if self.path is not None:
189
+ body["path"] = self.path
190
+ if self.serialized_dashboard is not None:
191
+ body["serialized_dashboard"] = self.serialized_dashboard
192
+ if self.update_time is not None:
193
+ body["update_time"] = self.update_time
194
+ if self.warehouse_id is not None:
195
+ body["warehouse_id"] = self.warehouse_id
174
196
  return body
175
197
 
176
198
  def as_shallow_dict(self) -> dict:
177
199
  """Serializes the Dashboard into a shallow dictionary of its immediate attributes."""
178
200
  body = {}
179
- if self.create_time is not None: body['create_time'] = self.create_time
180
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
181
- if self.display_name is not None: body['display_name'] = self.display_name
182
- if self.etag is not None: body['etag'] = self.etag
183
- if self.lifecycle_state is not None: body['lifecycle_state'] = self.lifecycle_state
184
- if self.parent_path is not None: body['parent_path'] = self.parent_path
185
- if self.path is not None: body['path'] = self.path
186
- if self.serialized_dashboard is not None: body['serialized_dashboard'] = self.serialized_dashboard
187
- if self.update_time is not None: body['update_time'] = self.update_time
188
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
201
+ if self.create_time is not None:
202
+ body["create_time"] = self.create_time
203
+ if self.dashboard_id is not None:
204
+ body["dashboard_id"] = self.dashboard_id
205
+ if self.display_name is not None:
206
+ body["display_name"] = self.display_name
207
+ if self.etag is not None:
208
+ body["etag"] = self.etag
209
+ if self.lifecycle_state is not None:
210
+ body["lifecycle_state"] = self.lifecycle_state
211
+ if self.parent_path is not None:
212
+ body["parent_path"] = self.parent_path
213
+ if self.path is not None:
214
+ body["path"] = self.path
215
+ if self.serialized_dashboard is not None:
216
+ body["serialized_dashboard"] = self.serialized_dashboard
217
+ if self.update_time is not None:
218
+ body["update_time"] = self.update_time
219
+ if self.warehouse_id is not None:
220
+ body["warehouse_id"] = self.warehouse_id
189
221
  return body
190
222
 
191
223
  @classmethod
192
- def from_dict(cls, d: Dict[str, any]) -> Dashboard:
224
+ def from_dict(cls, d: Dict[str, Any]) -> Dashboard:
193
225
  """Deserializes the Dashboard from a dictionary."""
194
- return cls(create_time=d.get('create_time', None),
195
- dashboard_id=d.get('dashboard_id', None),
196
- display_name=d.get('display_name', None),
197
- etag=d.get('etag', None),
198
- lifecycle_state=_enum(d, 'lifecycle_state', LifecycleState),
199
- parent_path=d.get('parent_path', None),
200
- path=d.get('path', None),
201
- serialized_dashboard=d.get('serialized_dashboard', None),
202
- update_time=d.get('update_time', None),
203
- warehouse_id=d.get('warehouse_id', None))
226
+ return cls(
227
+ create_time=d.get("create_time", None),
228
+ dashboard_id=d.get("dashboard_id", None),
229
+ display_name=d.get("display_name", None),
230
+ etag=d.get("etag", None),
231
+ lifecycle_state=_enum(d, "lifecycle_state", LifecycleState),
232
+ parent_path=d.get("parent_path", None),
233
+ path=d.get("path", None),
234
+ serialized_dashboard=d.get("serialized_dashboard", None),
235
+ update_time=d.get("update_time", None),
236
+ warehouse_id=d.get("warehouse_id", None),
237
+ )
204
238
 
205
239
 
206
240
  class DashboardView(Enum):
207
241
 
208
- DASHBOARD_VIEW_BASIC = 'DASHBOARD_VIEW_BASIC'
209
-
210
-
211
- class DataType(Enum):
212
-
213
- DATA_TYPE_ARRAY = 'DATA_TYPE_ARRAY'
214
- DATA_TYPE_BIG_INT = 'DATA_TYPE_BIG_INT'
215
- DATA_TYPE_BINARY = 'DATA_TYPE_BINARY'
216
- DATA_TYPE_BOOLEAN = 'DATA_TYPE_BOOLEAN'
217
- DATA_TYPE_DATE = 'DATA_TYPE_DATE'
218
- DATA_TYPE_DECIMAL = 'DATA_TYPE_DECIMAL'
219
- DATA_TYPE_DOUBLE = 'DATA_TYPE_DOUBLE'
220
- DATA_TYPE_FLOAT = 'DATA_TYPE_FLOAT'
221
- DATA_TYPE_INT = 'DATA_TYPE_INT'
222
- DATA_TYPE_INTERVAL = 'DATA_TYPE_INTERVAL'
223
- DATA_TYPE_MAP = 'DATA_TYPE_MAP'
224
- DATA_TYPE_SMALL_INT = 'DATA_TYPE_SMALL_INT'
225
- DATA_TYPE_STRING = 'DATA_TYPE_STRING'
226
- DATA_TYPE_STRUCT = 'DATA_TYPE_STRUCT'
227
- DATA_TYPE_TIMESTAMP = 'DATA_TYPE_TIMESTAMP'
228
- DATA_TYPE_TINY_INT = 'DATA_TYPE_TINY_INT'
229
- DATA_TYPE_VOID = 'DATA_TYPE_VOID'
242
+ DASHBOARD_VIEW_BASIC = "DASHBOARD_VIEW_BASIC"
230
243
 
231
244
 
232
245
  @dataclass
233
246
  class DeleteScheduleResponse:
234
-
235
247
  def as_dict(self) -> dict:
236
248
  """Serializes the DeleteScheduleResponse into a dictionary suitable for use as a JSON request body."""
237
249
  body = {}
@@ -243,14 +255,13 @@ class DeleteScheduleResponse:
243
255
  return body
244
256
 
245
257
  @classmethod
246
- def from_dict(cls, d: Dict[str, any]) -> DeleteScheduleResponse:
258
+ def from_dict(cls, d: Dict[str, Any]) -> DeleteScheduleResponse:
247
259
  """Deserializes the DeleteScheduleResponse from a dictionary."""
248
260
  return cls()
249
261
 
250
262
 
251
263
  @dataclass
252
264
  class DeleteSubscriptionResponse:
253
-
254
265
  def as_dict(self) -> dict:
255
266
  """Serializes the DeleteSubscriptionResponse into a dictionary suitable for use as a JSON request body."""
256
267
  body = {}
@@ -262,7 +273,7 @@ class DeleteSubscriptionResponse:
262
273
  return body
263
274
 
264
275
  @classmethod
265
- def from_dict(cls, d: Dict[str, any]) -> DeleteSubscriptionResponse:
276
+ def from_dict(cls, d: Dict[str, Any]) -> DeleteSubscriptionResponse:
266
277
  """Deserializes the DeleteSubscriptionResponse from a dictionary."""
267
278
  return cls()
268
279
 
@@ -283,7 +294,7 @@ class Empty:
283
294
  return body
284
295
 
285
296
  @classmethod
286
- def from_dict(cls, d: Dict[str, any]) -> Empty:
297
+ def from_dict(cls, d: Dict[str, Any]) -> Empty:
287
298
  """Deserializes the Empty from a dictionary."""
288
299
  return cls()
289
300
 
@@ -308,30 +319,37 @@ class ExecutePublishedDashboardQueryRequest:
308
319
  def as_dict(self) -> dict:
309
320
  """Serializes the ExecutePublishedDashboardQueryRequest into a dictionary suitable for use as a JSON request body."""
310
321
  body = {}
311
- if self.dashboard_name is not None: body['dashboard_name'] = self.dashboard_name
312
- if self.dashboard_revision_id is not None: body['dashboard_revision_id'] = self.dashboard_revision_id
313
- if self.override_warehouse_id is not None: body['override_warehouse_id'] = self.override_warehouse_id
322
+ if self.dashboard_name is not None:
323
+ body["dashboard_name"] = self.dashboard_name
324
+ if self.dashboard_revision_id is not None:
325
+ body["dashboard_revision_id"] = self.dashboard_revision_id
326
+ if self.override_warehouse_id is not None:
327
+ body["override_warehouse_id"] = self.override_warehouse_id
314
328
  return body
315
329
 
316
330
  def as_shallow_dict(self) -> dict:
317
331
  """Serializes the ExecutePublishedDashboardQueryRequest into a shallow dictionary of its immediate attributes."""
318
332
  body = {}
319
- if self.dashboard_name is not None: body['dashboard_name'] = self.dashboard_name
320
- if self.dashboard_revision_id is not None: body['dashboard_revision_id'] = self.dashboard_revision_id
321
- if self.override_warehouse_id is not None: body['override_warehouse_id'] = self.override_warehouse_id
333
+ if self.dashboard_name is not None:
334
+ body["dashboard_name"] = self.dashboard_name
335
+ if self.dashboard_revision_id is not None:
336
+ body["dashboard_revision_id"] = self.dashboard_revision_id
337
+ if self.override_warehouse_id is not None:
338
+ body["override_warehouse_id"] = self.override_warehouse_id
322
339
  return body
323
340
 
324
341
  @classmethod
325
- def from_dict(cls, d: Dict[str, any]) -> ExecutePublishedDashboardQueryRequest:
342
+ def from_dict(cls, d: Dict[str, Any]) -> ExecutePublishedDashboardQueryRequest:
326
343
  """Deserializes the ExecutePublishedDashboardQueryRequest from a dictionary."""
327
- return cls(dashboard_name=d.get('dashboard_name', None),
328
- dashboard_revision_id=d.get('dashboard_revision_id', None),
329
- override_warehouse_id=d.get('override_warehouse_id', None))
344
+ return cls(
345
+ dashboard_name=d.get("dashboard_name", None),
346
+ dashboard_revision_id=d.get("dashboard_revision_id", None),
347
+ override_warehouse_id=d.get("override_warehouse_id", None),
348
+ )
330
349
 
331
350
 
332
351
  @dataclass
333
352
  class ExecuteQueryResponse:
334
-
335
353
  def as_dict(self) -> dict:
336
354
  """Serializes the ExecuteQueryResponse into a dictionary suitable for use as a JSON request body."""
337
355
  body = {}
@@ -343,7 +361,7 @@ class ExecuteQueryResponse:
343
361
  return body
344
362
 
345
363
  @classmethod
346
- def from_dict(cls, d: Dict[str, any]) -> ExecuteQueryResponse:
364
+ def from_dict(cls, d: Dict[str, Any]) -> ExecuteQueryResponse:
347
365
  """Deserializes the ExecuteQueryResponse from a dictionary."""
348
366
  return cls()
349
367
 
@@ -352,34 +370,51 @@ class ExecuteQueryResponse:
352
370
  class GenieAttachment:
353
371
  """Genie AI Response"""
354
372
 
355
- query: Optional[QueryAttachment] = None
373
+ attachment_id: Optional[str] = None
374
+ """Attachment ID"""
375
+
376
+ query: Optional[GenieQueryAttachment] = None
377
+ """Query Attachment if Genie responds with a SQL query"""
356
378
 
357
379
  text: Optional[TextAttachment] = None
380
+ """Text Attachment if Genie responds with text"""
358
381
 
359
382
  def as_dict(self) -> dict:
360
383
  """Serializes the GenieAttachment into a dictionary suitable for use as a JSON request body."""
361
384
  body = {}
362
- if self.query: body['query'] = self.query.as_dict()
363
- if self.text: body['text'] = self.text.as_dict()
385
+ if self.attachment_id is not None:
386
+ body["attachment_id"] = self.attachment_id
387
+ if self.query:
388
+ body["query"] = self.query.as_dict()
389
+ if self.text:
390
+ body["text"] = self.text.as_dict()
364
391
  return body
365
392
 
366
393
  def as_shallow_dict(self) -> dict:
367
394
  """Serializes the GenieAttachment into a shallow dictionary of its immediate attributes."""
368
395
  body = {}
369
- if self.query: body['query'] = self.query
370
- if self.text: body['text'] = self.text
396
+ if self.attachment_id is not None:
397
+ body["attachment_id"] = self.attachment_id
398
+ if self.query:
399
+ body["query"] = self.query
400
+ if self.text:
401
+ body["text"] = self.text
371
402
  return body
372
403
 
373
404
  @classmethod
374
- def from_dict(cls, d: Dict[str, any]) -> GenieAttachment:
405
+ def from_dict(cls, d: Dict[str, Any]) -> GenieAttachment:
375
406
  """Deserializes the GenieAttachment from a dictionary."""
376
- return cls(query=_from_dict(d, 'query', QueryAttachment), text=_from_dict(d, 'text', TextAttachment))
407
+ return cls(
408
+ attachment_id=d.get("attachment_id", None),
409
+ query=_from_dict(d, "query", GenieQueryAttachment),
410
+ text=_from_dict(d, "text", TextAttachment),
411
+ )
377
412
 
378
413
 
379
414
  @dataclass
380
415
  class GenieConversation:
381
416
  id: str
382
- """Conversation ID"""
417
+ """Conversation ID. Legacy identifier, use conversation_id instead"""
383
418
 
384
419
  space_id: str
385
420
  """Genie space ID"""
@@ -390,6 +425,9 @@ class GenieConversation:
390
425
  title: str
391
426
  """Conversation title"""
392
427
 
428
+ conversation_id: str
429
+ """Conversation ID"""
430
+
393
431
  created_timestamp: Optional[int] = None
394
432
  """Timestamp when the message was created"""
395
433
 
@@ -399,36 +437,53 @@ class GenieConversation:
399
437
  def as_dict(self) -> dict:
400
438
  """Serializes the GenieConversation into a dictionary suitable for use as a JSON request body."""
401
439
  body = {}
402
- if self.created_timestamp is not None: body['created_timestamp'] = self.created_timestamp
403
- if self.id is not None: body['id'] = self.id
440
+ if self.conversation_id is not None:
441
+ body["conversation_id"] = self.conversation_id
442
+ if self.created_timestamp is not None:
443
+ body["created_timestamp"] = self.created_timestamp
444
+ if self.id is not None:
445
+ body["id"] = self.id
404
446
  if self.last_updated_timestamp is not None:
405
- body['last_updated_timestamp'] = self.last_updated_timestamp
406
- if self.space_id is not None: body['space_id'] = self.space_id
407
- if self.title is not None: body['title'] = self.title
408
- if self.user_id is not None: body['user_id'] = self.user_id
447
+ body["last_updated_timestamp"] = self.last_updated_timestamp
448
+ if self.space_id is not None:
449
+ body["space_id"] = self.space_id
450
+ if self.title is not None:
451
+ body["title"] = self.title
452
+ if self.user_id is not None:
453
+ body["user_id"] = self.user_id
409
454
  return body
410
455
 
411
456
  def as_shallow_dict(self) -> dict:
412
457
  """Serializes the GenieConversation into a shallow dictionary of its immediate attributes."""
413
458
  body = {}
414
- if self.created_timestamp is not None: body['created_timestamp'] = self.created_timestamp
415
- if self.id is not None: body['id'] = self.id
459
+ if self.conversation_id is not None:
460
+ body["conversation_id"] = self.conversation_id
461
+ if self.created_timestamp is not None:
462
+ body["created_timestamp"] = self.created_timestamp
463
+ if self.id is not None:
464
+ body["id"] = self.id
416
465
  if self.last_updated_timestamp is not None:
417
- body['last_updated_timestamp'] = self.last_updated_timestamp
418
- if self.space_id is not None: body['space_id'] = self.space_id
419
- if self.title is not None: body['title'] = self.title
420
- if self.user_id is not None: body['user_id'] = self.user_id
466
+ body["last_updated_timestamp"] = self.last_updated_timestamp
467
+ if self.space_id is not None:
468
+ body["space_id"] = self.space_id
469
+ if self.title is not None:
470
+ body["title"] = self.title
471
+ if self.user_id is not None:
472
+ body["user_id"] = self.user_id
421
473
  return body
422
474
 
423
475
  @classmethod
424
- def from_dict(cls, d: Dict[str, any]) -> GenieConversation:
476
+ def from_dict(cls, d: Dict[str, Any]) -> GenieConversation:
425
477
  """Deserializes the GenieConversation from a dictionary."""
426
- return cls(created_timestamp=d.get('created_timestamp', None),
427
- id=d.get('id', None),
428
- last_updated_timestamp=d.get('last_updated_timestamp', None),
429
- space_id=d.get('space_id', None),
430
- title=d.get('title', None),
431
- user_id=d.get('user_id', None))
478
+ return cls(
479
+ conversation_id=d.get("conversation_id", None),
480
+ created_timestamp=d.get("created_timestamp", None),
481
+ id=d.get("id", None),
482
+ last_updated_timestamp=d.get("last_updated_timestamp", None),
483
+ space_id=d.get("space_id", None),
484
+ title=d.get("title", None),
485
+ user_id=d.get("user_id", None),
486
+ )
432
487
 
433
488
 
434
489
  @dataclass
@@ -445,25 +500,33 @@ class GenieCreateConversationMessageRequest:
445
500
  def as_dict(self) -> dict:
446
501
  """Serializes the GenieCreateConversationMessageRequest into a dictionary suitable for use as a JSON request body."""
447
502
  body = {}
448
- if self.content is not None: body['content'] = self.content
449
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
450
- if self.space_id is not None: body['space_id'] = self.space_id
503
+ if self.content is not None:
504
+ body["content"] = self.content
505
+ if self.conversation_id is not None:
506
+ body["conversation_id"] = self.conversation_id
507
+ if self.space_id is not None:
508
+ body["space_id"] = self.space_id
451
509
  return body
452
510
 
453
511
  def as_shallow_dict(self) -> dict:
454
512
  """Serializes the GenieCreateConversationMessageRequest into a shallow dictionary of its immediate attributes."""
455
513
  body = {}
456
- if self.content is not None: body['content'] = self.content
457
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
458
- if self.space_id is not None: body['space_id'] = self.space_id
514
+ if self.content is not None:
515
+ body["content"] = self.content
516
+ if self.conversation_id is not None:
517
+ body["conversation_id"] = self.conversation_id
518
+ if self.space_id is not None:
519
+ body["space_id"] = self.space_id
459
520
  return body
460
521
 
461
522
  @classmethod
462
- def from_dict(cls, d: Dict[str, any]) -> GenieCreateConversationMessageRequest:
523
+ def from_dict(cls, d: Dict[str, Any]) -> GenieCreateConversationMessageRequest:
463
524
  """Deserializes the GenieCreateConversationMessageRequest from a dictionary."""
464
- return cls(content=d.get('content', None),
465
- conversation_id=d.get('conversation_id', None),
466
- space_id=d.get('space_id', None))
525
+ return cls(
526
+ content=d.get("content", None),
527
+ conversation_id=d.get("conversation_id", None),
528
+ space_id=d.get("space_id", None),
529
+ )
467
530
 
468
531
 
469
532
  @dataclass
@@ -475,25 +538,27 @@ class GenieGetMessageQueryResultResponse:
475
538
  def as_dict(self) -> dict:
476
539
  """Serializes the GenieGetMessageQueryResultResponse into a dictionary suitable for use as a JSON request body."""
477
540
  body = {}
478
- if self.statement_response: body['statement_response'] = self.statement_response.as_dict()
541
+ if self.statement_response:
542
+ body["statement_response"] = self.statement_response.as_dict()
479
543
  return body
480
544
 
481
545
  def as_shallow_dict(self) -> dict:
482
546
  """Serializes the GenieGetMessageQueryResultResponse into a shallow dictionary of its immediate attributes."""
483
547
  body = {}
484
- if self.statement_response: body['statement_response'] = self.statement_response
548
+ if self.statement_response:
549
+ body["statement_response"] = self.statement_response
485
550
  return body
486
551
 
487
552
  @classmethod
488
- def from_dict(cls, d: Dict[str, any]) -> GenieGetMessageQueryResultResponse:
553
+ def from_dict(cls, d: Dict[str, Any]) -> GenieGetMessageQueryResultResponse:
489
554
  """Deserializes the GenieGetMessageQueryResultResponse from a dictionary."""
490
- return cls(statement_response=_from_dict(d, 'statement_response', sql.StatementResponse))
555
+ return cls(statement_response=_from_dict(d, "statement_response", sql.StatementResponse))
491
556
 
492
557
 
493
558
  @dataclass
494
559
  class GenieMessage:
495
560
  id: str
496
- """Message ID"""
561
+ """Message ID. Legacy identifier, use message_id instead"""
497
562
 
498
563
  space_id: str
499
564
  """Genie space ID"""
@@ -504,35 +569,40 @@ class GenieMessage:
504
569
  content: str
505
570
  """User message content"""
506
571
 
572
+ message_id: str
573
+ """Message ID"""
574
+
507
575
  attachments: Optional[List[GenieAttachment]] = None
508
- """AI produced response to the message"""
576
+ """AI-generated response to the message"""
509
577
 
510
578
  created_timestamp: Optional[int] = None
511
579
  """Timestamp when the message was created"""
512
580
 
513
581
  error: Optional[MessageError] = None
514
- """Error message if AI failed to respond to the message"""
582
+ """Error message if Genie failed to respond to the message"""
515
583
 
516
584
  last_updated_timestamp: Optional[int] = None
517
585
  """Timestamp when the message was last updated"""
518
586
 
519
587
  query_result: Optional[Result] = None
520
- """The result of SQL query if the message has a query attachment"""
588
+ """The result of SQL query if the message includes a query attachment. Deprecated. Use
589
+ `query_result_metadata` in `GenieQueryAttachment` instead."""
521
590
 
522
591
  status: Optional[MessageStatus] = None
523
- """MesssageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
592
+ """MessageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
524
593
  sources. * `FILTERING_CONTEXT`: Running smart context step to determine relevant context. *
525
- `ASKING_AI`: Waiting for the LLM to respond to the users question. * `PENDING_WAREHOUSE`:
526
- Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing
527
- AI provided SQL query. Get the SQL query result by calling
528
- [getMessageQueryResult](:method:genie/getMessageQueryResult) API. **Important: The message
529
- status will stay in the `EXECUTING_QUERY` until a client calls
530
- [getMessageQueryResult](:method:genie/getMessageQueryResult)**. * `FAILED`: Generating a
531
- response or the executing the query failed. Please see `error` field. * `COMPLETED`: Message
532
- processing is completed. Results are in the `attachments` field. Get the SQL query result by
533
- calling [getMessageQueryResult](:method:genie/getMessageQueryResult) API. * `SUBMITTED`: Message
534
- has been submitted. * `QUERY_RESULT_EXPIRED`: SQL result is not available anymore. The user
535
- needs to execute the query again. * `CANCELLED`: Message has been cancelled."""
594
+ `ASKING_AI`: Waiting for the LLM to respond to the user's question. * `PENDING_WAREHOUSE`:
595
+ Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing a
596
+ generated SQL query. Get the SQL query result by calling
597
+ [getMessageAttachmentQueryResult](:method:genie/getMessageAttachmentQueryResult) API. *
598
+ `FAILED`: The response generation or query execution failed. See `error` field. * `COMPLETED`:
599
+ Message processing is completed. Results are in the `attachments` field. Get the SQL query
600
+ result by calling
601
+ [getMessageAttachmentQueryResult](:method:genie/getMessageAttachmentQueryResult) API. *
602
+ `SUBMITTED`: Message has been submitted. * `QUERY_RESULT_EXPIRED`: SQL result is not available
603
+ anymore. The user needs to rerun the query. Rerun the SQL query result by calling
604
+ [executeMessageAttachmentQuery](:method:genie/executeMessageAttachmentQuery) API. * `CANCELLED`:
605
+ Message has been cancelled."""
536
606
 
537
607
  user_id: Optional[int] = None
538
608
  """ID of the user who created the message"""
@@ -540,51 +610,224 @@ class GenieMessage:
540
610
  def as_dict(self) -> dict:
541
611
  """Serializes the GenieMessage into a dictionary suitable for use as a JSON request body."""
542
612
  body = {}
543
- if self.attachments: body['attachments'] = [v.as_dict() for v in self.attachments]
544
- if self.content is not None: body['content'] = self.content
545
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
546
- if self.created_timestamp is not None: body['created_timestamp'] = self.created_timestamp
547
- if self.error: body['error'] = self.error.as_dict()
548
- if self.id is not None: body['id'] = self.id
613
+ if self.attachments:
614
+ body["attachments"] = [v.as_dict() for v in self.attachments]
615
+ if self.content is not None:
616
+ body["content"] = self.content
617
+ if self.conversation_id is not None:
618
+ body["conversation_id"] = self.conversation_id
619
+ if self.created_timestamp is not None:
620
+ body["created_timestamp"] = self.created_timestamp
621
+ if self.error:
622
+ body["error"] = self.error.as_dict()
623
+ if self.id is not None:
624
+ body["id"] = self.id
549
625
  if self.last_updated_timestamp is not None:
550
- body['last_updated_timestamp'] = self.last_updated_timestamp
551
- if self.query_result: body['query_result'] = self.query_result.as_dict()
552
- if self.space_id is not None: body['space_id'] = self.space_id
553
- if self.status is not None: body['status'] = self.status.value
554
- if self.user_id is not None: body['user_id'] = self.user_id
626
+ body["last_updated_timestamp"] = self.last_updated_timestamp
627
+ if self.message_id is not None:
628
+ body["message_id"] = self.message_id
629
+ if self.query_result:
630
+ body["query_result"] = self.query_result.as_dict()
631
+ if self.space_id is not None:
632
+ body["space_id"] = self.space_id
633
+ if self.status is not None:
634
+ body["status"] = self.status.value
635
+ if self.user_id is not None:
636
+ body["user_id"] = self.user_id
555
637
  return body
556
638
 
557
639
  def as_shallow_dict(self) -> dict:
558
640
  """Serializes the GenieMessage into a shallow dictionary of its immediate attributes."""
559
641
  body = {}
560
- if self.attachments: body['attachments'] = self.attachments
561
- if self.content is not None: body['content'] = self.content
562
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
563
- if self.created_timestamp is not None: body['created_timestamp'] = self.created_timestamp
564
- if self.error: body['error'] = self.error
565
- if self.id is not None: body['id'] = self.id
642
+ if self.attachments:
643
+ body["attachments"] = self.attachments
644
+ if self.content is not None:
645
+ body["content"] = self.content
646
+ if self.conversation_id is not None:
647
+ body["conversation_id"] = self.conversation_id
648
+ if self.created_timestamp is not None:
649
+ body["created_timestamp"] = self.created_timestamp
650
+ if self.error:
651
+ body["error"] = self.error
652
+ if self.id is not None:
653
+ body["id"] = self.id
566
654
  if self.last_updated_timestamp is not None:
567
- body['last_updated_timestamp'] = self.last_updated_timestamp
568
- if self.query_result: body['query_result'] = self.query_result
569
- if self.space_id is not None: body['space_id'] = self.space_id
570
- if self.status is not None: body['status'] = self.status
571
- if self.user_id is not None: body['user_id'] = self.user_id
655
+ body["last_updated_timestamp"] = self.last_updated_timestamp
656
+ if self.message_id is not None:
657
+ body["message_id"] = self.message_id
658
+ if self.query_result:
659
+ body["query_result"] = self.query_result
660
+ if self.space_id is not None:
661
+ body["space_id"] = self.space_id
662
+ if self.status is not None:
663
+ body["status"] = self.status
664
+ if self.user_id is not None:
665
+ body["user_id"] = self.user_id
572
666
  return body
573
667
 
574
668
  @classmethod
575
- def from_dict(cls, d: Dict[str, any]) -> GenieMessage:
669
+ def from_dict(cls, d: Dict[str, Any]) -> GenieMessage:
576
670
  """Deserializes the GenieMessage from a dictionary."""
577
- return cls(attachments=_repeated_dict(d, 'attachments', GenieAttachment),
578
- content=d.get('content', None),
579
- conversation_id=d.get('conversation_id', None),
580
- created_timestamp=d.get('created_timestamp', None),
581
- error=_from_dict(d, 'error', MessageError),
582
- id=d.get('id', None),
583
- last_updated_timestamp=d.get('last_updated_timestamp', None),
584
- query_result=_from_dict(d, 'query_result', Result),
585
- space_id=d.get('space_id', None),
586
- status=_enum(d, 'status', MessageStatus),
587
- user_id=d.get('user_id', None))
671
+ return cls(
672
+ attachments=_repeated_dict(d, "attachments", GenieAttachment),
673
+ content=d.get("content", None),
674
+ conversation_id=d.get("conversation_id", None),
675
+ created_timestamp=d.get("created_timestamp", None),
676
+ error=_from_dict(d, "error", MessageError),
677
+ id=d.get("id", None),
678
+ last_updated_timestamp=d.get("last_updated_timestamp", None),
679
+ message_id=d.get("message_id", None),
680
+ query_result=_from_dict(d, "query_result", Result),
681
+ space_id=d.get("space_id", None),
682
+ status=_enum(d, "status", MessageStatus),
683
+ user_id=d.get("user_id", None),
684
+ )
685
+
686
+
687
+ @dataclass
688
+ class GenieQueryAttachment:
689
+ description: Optional[str] = None
690
+ """Description of the query"""
691
+
692
+ id: Optional[str] = None
693
+
694
+ last_updated_timestamp: Optional[int] = None
695
+ """Time when the user updated the query last"""
696
+
697
+ query: Optional[str] = None
698
+ """AI generated SQL query"""
699
+
700
+ query_result_metadata: Optional[GenieResultMetadata] = None
701
+ """Metadata associated with the query result."""
702
+
703
+ statement_id: Optional[str] = None
704
+ """Statement Execution API statement id. Use [Get status, manifest, and result first
705
+ chunk](:method:statementexecution/getstatement) to get the full result data."""
706
+
707
+ title: Optional[str] = None
708
+ """Name of the query"""
709
+
710
+ def as_dict(self) -> dict:
711
+ """Serializes the GenieQueryAttachment into a dictionary suitable for use as a JSON request body."""
712
+ body = {}
713
+ if self.description is not None:
714
+ body["description"] = self.description
715
+ if self.id is not None:
716
+ body["id"] = self.id
717
+ if self.last_updated_timestamp is not None:
718
+ body["last_updated_timestamp"] = self.last_updated_timestamp
719
+ if self.query is not None:
720
+ body["query"] = self.query
721
+ if self.query_result_metadata:
722
+ body["query_result_metadata"] = self.query_result_metadata.as_dict()
723
+ if self.statement_id is not None:
724
+ body["statement_id"] = self.statement_id
725
+ if self.title is not None:
726
+ body["title"] = self.title
727
+ return body
728
+
729
+ def as_shallow_dict(self) -> dict:
730
+ """Serializes the GenieQueryAttachment into a shallow dictionary of its immediate attributes."""
731
+ body = {}
732
+ if self.description is not None:
733
+ body["description"] = self.description
734
+ if self.id is not None:
735
+ body["id"] = self.id
736
+ if self.last_updated_timestamp is not None:
737
+ body["last_updated_timestamp"] = self.last_updated_timestamp
738
+ if self.query is not None:
739
+ body["query"] = self.query
740
+ if self.query_result_metadata:
741
+ body["query_result_metadata"] = self.query_result_metadata
742
+ if self.statement_id is not None:
743
+ body["statement_id"] = self.statement_id
744
+ if self.title is not None:
745
+ body["title"] = self.title
746
+ return body
747
+
748
+ @classmethod
749
+ def from_dict(cls, d: Dict[str, Any]) -> GenieQueryAttachment:
750
+ """Deserializes the GenieQueryAttachment from a dictionary."""
751
+ return cls(
752
+ description=d.get("description", None),
753
+ id=d.get("id", None),
754
+ last_updated_timestamp=d.get("last_updated_timestamp", None),
755
+ query=d.get("query", None),
756
+ query_result_metadata=_from_dict(d, "query_result_metadata", GenieResultMetadata),
757
+ statement_id=d.get("statement_id", None),
758
+ title=d.get("title", None),
759
+ )
760
+
761
+
762
+ @dataclass
763
+ class GenieResultMetadata:
764
+ is_truncated: Optional[bool] = None
765
+ """Indicates whether the result set is truncated."""
766
+
767
+ row_count: Optional[int] = None
768
+ """The number of rows in the result set."""
769
+
770
+ def as_dict(self) -> dict:
771
+ """Serializes the GenieResultMetadata into a dictionary suitable for use as a JSON request body."""
772
+ body = {}
773
+ if self.is_truncated is not None:
774
+ body["is_truncated"] = self.is_truncated
775
+ if self.row_count is not None:
776
+ body["row_count"] = self.row_count
777
+ return body
778
+
779
+ def as_shallow_dict(self) -> dict:
780
+ """Serializes the GenieResultMetadata into a shallow dictionary of its immediate attributes."""
781
+ body = {}
782
+ if self.is_truncated is not None:
783
+ body["is_truncated"] = self.is_truncated
784
+ if self.row_count is not None:
785
+ body["row_count"] = self.row_count
786
+ return body
787
+
788
+ @classmethod
789
+ def from_dict(cls, d: Dict[str, Any]) -> GenieResultMetadata:
790
+ """Deserializes the GenieResultMetadata from a dictionary."""
791
+ return cls(is_truncated=d.get("is_truncated", None), row_count=d.get("row_count", None))
792
+
793
+
794
+ @dataclass
795
+ class GenieSpace:
796
+ space_id: str
797
+ """Space ID"""
798
+
799
+ title: str
800
+ """Title of the Genie Space"""
801
+
802
+ description: Optional[str] = None
803
+ """Description of the Genie Space"""
804
+
805
+ def as_dict(self) -> dict:
806
+ """Serializes the GenieSpace into a dictionary suitable for use as a JSON request body."""
807
+ body = {}
808
+ if self.description is not None:
809
+ body["description"] = self.description
810
+ if self.space_id is not None:
811
+ body["space_id"] = self.space_id
812
+ if self.title is not None:
813
+ body["title"] = self.title
814
+ return body
815
+
816
+ def as_shallow_dict(self) -> dict:
817
+ """Serializes the GenieSpace into a shallow dictionary of its immediate attributes."""
818
+ body = {}
819
+ if self.description is not None:
820
+ body["description"] = self.description
821
+ if self.space_id is not None:
822
+ body["space_id"] = self.space_id
823
+ if self.title is not None:
824
+ body["title"] = self.title
825
+ return body
826
+
827
+ @classmethod
828
+ def from_dict(cls, d: Dict[str, Any]) -> GenieSpace:
829
+ """Deserializes the GenieSpace from a dictionary."""
830
+ return cls(description=d.get("description", None), space_id=d.get("space_id", None), title=d.get("title", None))
588
831
 
589
832
 
590
833
  @dataclass
@@ -598,21 +841,25 @@ class GenieStartConversationMessageRequest:
598
841
  def as_dict(self) -> dict:
599
842
  """Serializes the GenieStartConversationMessageRequest into a dictionary suitable for use as a JSON request body."""
600
843
  body = {}
601
- if self.content is not None: body['content'] = self.content
602
- if self.space_id is not None: body['space_id'] = self.space_id
844
+ if self.content is not None:
845
+ body["content"] = self.content
846
+ if self.space_id is not None:
847
+ body["space_id"] = self.space_id
603
848
  return body
604
849
 
605
850
  def as_shallow_dict(self) -> dict:
606
851
  """Serializes the GenieStartConversationMessageRequest into a shallow dictionary of its immediate attributes."""
607
852
  body = {}
608
- if self.content is not None: body['content'] = self.content
609
- if self.space_id is not None: body['space_id'] = self.space_id
853
+ if self.content is not None:
854
+ body["content"] = self.content
855
+ if self.space_id is not None:
856
+ body["space_id"] = self.space_id
610
857
  return body
611
858
 
612
859
  @classmethod
613
- def from_dict(cls, d: Dict[str, any]) -> GenieStartConversationMessageRequest:
860
+ def from_dict(cls, d: Dict[str, Any]) -> GenieStartConversationMessageRequest:
614
861
  """Deserializes the GenieStartConversationMessageRequest from a dictionary."""
615
- return cls(content=d.get('content', None), space_id=d.get('space_id', None))
862
+ return cls(content=d.get("content", None), space_id=d.get("space_id", None))
616
863
 
617
864
 
618
865
  @dataclass
@@ -630,33 +877,42 @@ class GenieStartConversationResponse:
630
877
  def as_dict(self) -> dict:
631
878
  """Serializes the GenieStartConversationResponse into a dictionary suitable for use as a JSON request body."""
632
879
  body = {}
633
- if self.conversation: body['conversation'] = self.conversation.as_dict()
634
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
635
- if self.message: body['message'] = self.message.as_dict()
636
- if self.message_id is not None: body['message_id'] = self.message_id
880
+ if self.conversation:
881
+ body["conversation"] = self.conversation.as_dict()
882
+ if self.conversation_id is not None:
883
+ body["conversation_id"] = self.conversation_id
884
+ if self.message:
885
+ body["message"] = self.message.as_dict()
886
+ if self.message_id is not None:
887
+ body["message_id"] = self.message_id
637
888
  return body
638
889
 
639
890
  def as_shallow_dict(self) -> dict:
640
891
  """Serializes the GenieStartConversationResponse into a shallow dictionary of its immediate attributes."""
641
892
  body = {}
642
- if self.conversation: body['conversation'] = self.conversation
643
- if self.conversation_id is not None: body['conversation_id'] = self.conversation_id
644
- if self.message: body['message'] = self.message
645
- if self.message_id is not None: body['message_id'] = self.message_id
893
+ if self.conversation:
894
+ body["conversation"] = self.conversation
895
+ if self.conversation_id is not None:
896
+ body["conversation_id"] = self.conversation_id
897
+ if self.message:
898
+ body["message"] = self.message
899
+ if self.message_id is not None:
900
+ body["message_id"] = self.message_id
646
901
  return body
647
902
 
648
903
  @classmethod
649
- def from_dict(cls, d: Dict[str, any]) -> GenieStartConversationResponse:
904
+ def from_dict(cls, d: Dict[str, Any]) -> GenieStartConversationResponse:
650
905
  """Deserializes the GenieStartConversationResponse from a dictionary."""
651
- return cls(conversation=_from_dict(d, 'conversation', GenieConversation),
652
- conversation_id=d.get('conversation_id', None),
653
- message=_from_dict(d, 'message', GenieMessage),
654
- message_id=d.get('message_id', None))
906
+ return cls(
907
+ conversation=_from_dict(d, "conversation", GenieConversation),
908
+ conversation_id=d.get("conversation_id", None),
909
+ message=_from_dict(d, "message", GenieMessage),
910
+ message_id=d.get("message_id", None),
911
+ )
655
912
 
656
913
 
657
914
  @dataclass
658
915
  class GetPublishedDashboardEmbeddedResponse:
659
-
660
916
  def as_dict(self) -> dict:
661
917
  """Serializes the GetPublishedDashboardEmbeddedResponse into a dictionary suitable for use as a JSON request body."""
662
918
  body = {}
@@ -668,15 +924,15 @@ class GetPublishedDashboardEmbeddedResponse:
668
924
  return body
669
925
 
670
926
  @classmethod
671
- def from_dict(cls, d: Dict[str, any]) -> GetPublishedDashboardEmbeddedResponse:
927
+ def from_dict(cls, d: Dict[str, Any]) -> GetPublishedDashboardEmbeddedResponse:
672
928
  """Deserializes the GetPublishedDashboardEmbeddedResponse from a dictionary."""
673
929
  return cls()
674
930
 
675
931
 
676
932
  class LifecycleState(Enum):
677
933
 
678
- ACTIVE = 'ACTIVE'
679
- TRASHED = 'TRASHED'
934
+ ACTIVE = "ACTIVE"
935
+ TRASHED = "TRASHED"
680
936
 
681
937
 
682
938
  @dataclass
@@ -690,22 +946,27 @@ class ListDashboardsResponse:
690
946
  def as_dict(self) -> dict:
691
947
  """Serializes the ListDashboardsResponse into a dictionary suitable for use as a JSON request body."""
692
948
  body = {}
693
- if self.dashboards: body['dashboards'] = [v.as_dict() for v in self.dashboards]
694
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
949
+ if self.dashboards:
950
+ body["dashboards"] = [v.as_dict() for v in self.dashboards]
951
+ if self.next_page_token is not None:
952
+ body["next_page_token"] = self.next_page_token
695
953
  return body
696
954
 
697
955
  def as_shallow_dict(self) -> dict:
698
956
  """Serializes the ListDashboardsResponse into a shallow dictionary of its immediate attributes."""
699
957
  body = {}
700
- if self.dashboards: body['dashboards'] = self.dashboards
701
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
958
+ if self.dashboards:
959
+ body["dashboards"] = self.dashboards
960
+ if self.next_page_token is not None:
961
+ body["next_page_token"] = self.next_page_token
702
962
  return body
703
963
 
704
964
  @classmethod
705
- def from_dict(cls, d: Dict[str, any]) -> ListDashboardsResponse:
965
+ def from_dict(cls, d: Dict[str, Any]) -> ListDashboardsResponse:
706
966
  """Deserializes the ListDashboardsResponse from a dictionary."""
707
- return cls(dashboards=_repeated_dict(d, 'dashboards', Dashboard),
708
- next_page_token=d.get('next_page_token', None))
967
+ return cls(
968
+ dashboards=_repeated_dict(d, "dashboards", Dashboard), next_page_token=d.get("next_page_token", None)
969
+ )
709
970
 
710
971
 
711
972
  @dataclass
@@ -719,22 +980,25 @@ class ListSchedulesResponse:
719
980
  def as_dict(self) -> dict:
720
981
  """Serializes the ListSchedulesResponse into a dictionary suitable for use as a JSON request body."""
721
982
  body = {}
722
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
723
- if self.schedules: body['schedules'] = [v.as_dict() for v in self.schedules]
983
+ if self.next_page_token is not None:
984
+ body["next_page_token"] = self.next_page_token
985
+ if self.schedules:
986
+ body["schedules"] = [v.as_dict() for v in self.schedules]
724
987
  return body
725
988
 
726
989
  def as_shallow_dict(self) -> dict:
727
990
  """Serializes the ListSchedulesResponse into a shallow dictionary of its immediate attributes."""
728
991
  body = {}
729
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
730
- if self.schedules: body['schedules'] = self.schedules
992
+ if self.next_page_token is not None:
993
+ body["next_page_token"] = self.next_page_token
994
+ if self.schedules:
995
+ body["schedules"] = self.schedules
731
996
  return body
732
997
 
733
998
  @classmethod
734
- def from_dict(cls, d: Dict[str, any]) -> ListSchedulesResponse:
999
+ def from_dict(cls, d: Dict[str, Any]) -> ListSchedulesResponse:
735
1000
  """Deserializes the ListSchedulesResponse from a dictionary."""
736
- return cls(next_page_token=d.get('next_page_token', None),
737
- schedules=_repeated_dict(d, 'schedules', Schedule))
1001
+ return cls(next_page_token=d.get("next_page_token", None), schedules=_repeated_dict(d, "schedules", Schedule))
738
1002
 
739
1003
 
740
1004
  @dataclass
@@ -748,22 +1012,28 @@ class ListSubscriptionsResponse:
748
1012
  def as_dict(self) -> dict:
749
1013
  """Serializes the ListSubscriptionsResponse into a dictionary suitable for use as a JSON request body."""
750
1014
  body = {}
751
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
752
- if self.subscriptions: body['subscriptions'] = [v.as_dict() for v in self.subscriptions]
1015
+ if self.next_page_token is not None:
1016
+ body["next_page_token"] = self.next_page_token
1017
+ if self.subscriptions:
1018
+ body["subscriptions"] = [v.as_dict() for v in self.subscriptions]
753
1019
  return body
754
1020
 
755
1021
  def as_shallow_dict(self) -> dict:
756
1022
  """Serializes the ListSubscriptionsResponse into a shallow dictionary of its immediate attributes."""
757
1023
  body = {}
758
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
759
- if self.subscriptions: body['subscriptions'] = self.subscriptions
1024
+ if self.next_page_token is not None:
1025
+ body["next_page_token"] = self.next_page_token
1026
+ if self.subscriptions:
1027
+ body["subscriptions"] = self.subscriptions
760
1028
  return body
761
1029
 
762
1030
  @classmethod
763
- def from_dict(cls, d: Dict[str, any]) -> ListSubscriptionsResponse:
1031
+ def from_dict(cls, d: Dict[str, Any]) -> ListSubscriptionsResponse:
764
1032
  """Deserializes the ListSubscriptionsResponse from a dictionary."""
765
- return cls(next_page_token=d.get('next_page_token', None),
766
- subscriptions=_repeated_dict(d, 'subscriptions', Subscription))
1033
+ return cls(
1034
+ next_page_token=d.get("next_page_token", None),
1035
+ subscriptions=_repeated_dict(d, "subscriptions", Subscription),
1036
+ )
767
1037
 
768
1038
 
769
1039
  @dataclass
@@ -775,93 +1045,101 @@ class MessageError:
775
1045
  def as_dict(self) -> dict:
776
1046
  """Serializes the MessageError into a dictionary suitable for use as a JSON request body."""
777
1047
  body = {}
778
- if self.error is not None: body['error'] = self.error
779
- if self.type is not None: body['type'] = self.type.value
1048
+ if self.error is not None:
1049
+ body["error"] = self.error
1050
+ if self.type is not None:
1051
+ body["type"] = self.type.value
780
1052
  return body
781
1053
 
782
1054
  def as_shallow_dict(self) -> dict:
783
1055
  """Serializes the MessageError into a shallow dictionary of its immediate attributes."""
784
1056
  body = {}
785
- if self.error is not None: body['error'] = self.error
786
- if self.type is not None: body['type'] = self.type
1057
+ if self.error is not None:
1058
+ body["error"] = self.error
1059
+ if self.type is not None:
1060
+ body["type"] = self.type
787
1061
  return body
788
1062
 
789
1063
  @classmethod
790
- def from_dict(cls, d: Dict[str, any]) -> MessageError:
1064
+ def from_dict(cls, d: Dict[str, Any]) -> MessageError:
791
1065
  """Deserializes the MessageError from a dictionary."""
792
- return cls(error=d.get('error', None), type=_enum(d, 'type', MessageErrorType))
1066
+ return cls(error=d.get("error", None), type=_enum(d, "type", MessageErrorType))
793
1067
 
794
1068
 
795
1069
  class MessageErrorType(Enum):
796
1070
 
797
- BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION = 'BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION'
798
- CHAT_COMPLETION_CLIENT_EXCEPTION = 'CHAT_COMPLETION_CLIENT_EXCEPTION'
799
- CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION = 'CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION'
800
- CHAT_COMPLETION_NETWORK_EXCEPTION = 'CHAT_COMPLETION_NETWORK_EXCEPTION'
801
- CONTENT_FILTER_EXCEPTION = 'CONTENT_FILTER_EXCEPTION'
802
- CONTEXT_EXCEEDED_EXCEPTION = 'CONTEXT_EXCEEDED_EXCEPTION'
803
- COULD_NOT_GET_UC_SCHEMA_EXCEPTION = 'COULD_NOT_GET_UC_SCHEMA_EXCEPTION'
804
- DEPLOYMENT_NOT_FOUND_EXCEPTION = 'DEPLOYMENT_NOT_FOUND_EXCEPTION'
805
- FUNCTIONS_NOT_AVAILABLE_EXCEPTION = 'FUNCTIONS_NOT_AVAILABLE_EXCEPTION'
806
- FUNCTION_ARGUMENTS_INVALID_EXCEPTION = 'FUNCTION_ARGUMENTS_INVALID_EXCEPTION'
807
- FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION = 'FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION'
808
- FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION = 'FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION'
809
- GENERIC_CHAT_COMPLETION_EXCEPTION = 'GENERIC_CHAT_COMPLETION_EXCEPTION'
810
- GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION = 'GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION'
811
- GENERIC_SQL_EXEC_API_CALL_EXCEPTION = 'GENERIC_SQL_EXEC_API_CALL_EXCEPTION'
812
- ILLEGAL_PARAMETER_DEFINITION_EXCEPTION = 'ILLEGAL_PARAMETER_DEFINITION_EXCEPTION'
813
- INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION = 'INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION'
814
- INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION = 'INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION'
815
- INVALID_CHAT_COMPLETION_JSON_EXCEPTION = 'INVALID_CHAT_COMPLETION_JSON_EXCEPTION'
816
- INVALID_COMPLETION_REQUEST_EXCEPTION = 'INVALID_COMPLETION_REQUEST_EXCEPTION'
817
- INVALID_FUNCTION_CALL_EXCEPTION = 'INVALID_FUNCTION_CALL_EXCEPTION'
818
- INVALID_TABLE_IDENTIFIER_EXCEPTION = 'INVALID_TABLE_IDENTIFIER_EXCEPTION'
819
- LOCAL_CONTEXT_EXCEEDED_EXCEPTION = 'LOCAL_CONTEXT_EXCEEDED_EXCEPTION'
820
- MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION = 'MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION'
821
- MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION = 'MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION'
822
- NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE = 'NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE'
823
- NO_QUERY_TO_VISUALIZE_EXCEPTION = 'NO_QUERY_TO_VISUALIZE_EXCEPTION'
824
- NO_TABLES_TO_QUERY_EXCEPTION = 'NO_TABLES_TO_QUERY_EXCEPTION'
825
- RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION = 'RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION'
826
- RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION = 'RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION'
827
- REPLY_PROCESS_TIMEOUT_EXCEPTION = 'REPLY_PROCESS_TIMEOUT_EXCEPTION'
828
- RETRYABLE_PROCESSING_EXCEPTION = 'RETRYABLE_PROCESSING_EXCEPTION'
829
- SQL_EXECUTION_EXCEPTION = 'SQL_EXECUTION_EXCEPTION'
830
- STOP_PROCESS_DUE_TO_AUTO_REGENERATE = 'STOP_PROCESS_DUE_TO_AUTO_REGENERATE'
831
- TABLES_MISSING_EXCEPTION = 'TABLES_MISSING_EXCEPTION'
832
- TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION = 'TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION'
833
- TOO_MANY_TABLES_EXCEPTION = 'TOO_MANY_TABLES_EXCEPTION'
834
- UNEXPECTED_REPLY_PROCESS_EXCEPTION = 'UNEXPECTED_REPLY_PROCESS_EXCEPTION'
835
- UNKNOWN_AI_MODEL = 'UNKNOWN_AI_MODEL'
836
- WAREHOUSE_ACCESS_MISSING_EXCEPTION = 'WAREHOUSE_ACCESS_MISSING_EXCEPTION'
837
- WAREHOUSE_NOT_FOUND_EXCEPTION = 'WAREHOUSE_NOT_FOUND_EXCEPTION'
1071
+ BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION = "BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION"
1072
+ CHAT_COMPLETION_CLIENT_EXCEPTION = "CHAT_COMPLETION_CLIENT_EXCEPTION"
1073
+ CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION = "CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION"
1074
+ CHAT_COMPLETION_NETWORK_EXCEPTION = "CHAT_COMPLETION_NETWORK_EXCEPTION"
1075
+ CONTENT_FILTER_EXCEPTION = "CONTENT_FILTER_EXCEPTION"
1076
+ CONTEXT_EXCEEDED_EXCEPTION = "CONTEXT_EXCEEDED_EXCEPTION"
1077
+ COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION = "COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION"
1078
+ COULD_NOT_GET_UC_SCHEMA_EXCEPTION = "COULD_NOT_GET_UC_SCHEMA_EXCEPTION"
1079
+ DEPLOYMENT_NOT_FOUND_EXCEPTION = "DEPLOYMENT_NOT_FOUND_EXCEPTION"
1080
+ FUNCTIONS_NOT_AVAILABLE_EXCEPTION = "FUNCTIONS_NOT_AVAILABLE_EXCEPTION"
1081
+ FUNCTION_ARGUMENTS_INVALID_EXCEPTION = "FUNCTION_ARGUMENTS_INVALID_EXCEPTION"
1082
+ FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION = "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION"
1083
+ FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION = "FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION"
1084
+ FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION = "FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION"
1085
+ GENERIC_CHAT_COMPLETION_EXCEPTION = "GENERIC_CHAT_COMPLETION_EXCEPTION"
1086
+ GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION = "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION"
1087
+ GENERIC_SQL_EXEC_API_CALL_EXCEPTION = "GENERIC_SQL_EXEC_API_CALL_EXCEPTION"
1088
+ ILLEGAL_PARAMETER_DEFINITION_EXCEPTION = "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION"
1089
+ INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION = "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION"
1090
+ INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION = "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION"
1091
+ INVALID_CHAT_COMPLETION_JSON_EXCEPTION = "INVALID_CHAT_COMPLETION_JSON_EXCEPTION"
1092
+ INVALID_COMPLETION_REQUEST_EXCEPTION = "INVALID_COMPLETION_REQUEST_EXCEPTION"
1093
+ INVALID_FUNCTION_CALL_EXCEPTION = "INVALID_FUNCTION_CALL_EXCEPTION"
1094
+ INVALID_TABLE_IDENTIFIER_EXCEPTION = "INVALID_TABLE_IDENTIFIER_EXCEPTION"
1095
+ LOCAL_CONTEXT_EXCEEDED_EXCEPTION = "LOCAL_CONTEXT_EXCEEDED_EXCEPTION"
1096
+ MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION = "MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION"
1097
+ MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION = "MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION"
1098
+ MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION = "MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION"
1099
+ NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE = "NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE"
1100
+ NO_QUERY_TO_VISUALIZE_EXCEPTION = "NO_QUERY_TO_VISUALIZE_EXCEPTION"
1101
+ NO_TABLES_TO_QUERY_EXCEPTION = "NO_TABLES_TO_QUERY_EXCEPTION"
1102
+ RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION = "RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION"
1103
+ RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION = "RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION"
1104
+ REPLY_PROCESS_TIMEOUT_EXCEPTION = "REPLY_PROCESS_TIMEOUT_EXCEPTION"
1105
+ RETRYABLE_PROCESSING_EXCEPTION = "RETRYABLE_PROCESSING_EXCEPTION"
1106
+ SQL_EXECUTION_EXCEPTION = "SQL_EXECUTION_EXCEPTION"
1107
+ STOP_PROCESS_DUE_TO_AUTO_REGENERATE = "STOP_PROCESS_DUE_TO_AUTO_REGENERATE"
1108
+ TABLES_MISSING_EXCEPTION = "TABLES_MISSING_EXCEPTION"
1109
+ TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION = "TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION"
1110
+ TOO_MANY_TABLES_EXCEPTION = "TOO_MANY_TABLES_EXCEPTION"
1111
+ UNEXPECTED_REPLY_PROCESS_EXCEPTION = "UNEXPECTED_REPLY_PROCESS_EXCEPTION"
1112
+ UNKNOWN_AI_MODEL = "UNKNOWN_AI_MODEL"
1113
+ WAREHOUSE_ACCESS_MISSING_EXCEPTION = "WAREHOUSE_ACCESS_MISSING_EXCEPTION"
1114
+ WAREHOUSE_NOT_FOUND_EXCEPTION = "WAREHOUSE_NOT_FOUND_EXCEPTION"
838
1115
 
839
1116
 
840
1117
  class MessageStatus(Enum):
841
- """MesssageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
1118
+ """MessageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
842
1119
  sources. * `FILTERING_CONTEXT`: Running smart context step to determine relevant context. *
843
- `ASKING_AI`: Waiting for the LLM to respond to the users question. * `PENDING_WAREHOUSE`:
844
- Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing
845
- AI provided SQL query. Get the SQL query result by calling
846
- [getMessageQueryResult](:method:genie/getMessageQueryResult) API. **Important: The message
847
- status will stay in the `EXECUTING_QUERY` until a client calls
848
- [getMessageQueryResult](:method:genie/getMessageQueryResult)**. * `FAILED`: Generating a
849
- response or the executing the query failed. Please see `error` field. * `COMPLETED`: Message
850
- processing is completed. Results are in the `attachments` field. Get the SQL query result by
851
- calling [getMessageQueryResult](:method:genie/getMessageQueryResult) API. * `SUBMITTED`: Message
852
- has been submitted. * `QUERY_RESULT_EXPIRED`: SQL result is not available anymore. The user
853
- needs to execute the query again. * `CANCELLED`: Message has been cancelled."""
854
-
855
- ASKING_AI = 'ASKING_AI'
856
- CANCELLED = 'CANCELLED'
857
- COMPLETED = 'COMPLETED'
858
- EXECUTING_QUERY = 'EXECUTING_QUERY'
859
- FAILED = 'FAILED'
860
- FETCHING_METADATA = 'FETCHING_METADATA'
861
- FILTERING_CONTEXT = 'FILTERING_CONTEXT'
862
- PENDING_WAREHOUSE = 'PENDING_WAREHOUSE'
863
- QUERY_RESULT_EXPIRED = 'QUERY_RESULT_EXPIRED'
864
- SUBMITTED = 'SUBMITTED'
1120
+ `ASKING_AI`: Waiting for the LLM to respond to the user's question. * `PENDING_WAREHOUSE`:
1121
+ Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing a
1122
+ generated SQL query. Get the SQL query result by calling
1123
+ [getMessageAttachmentQueryResult](:method:genie/getMessageAttachmentQueryResult) API. *
1124
+ `FAILED`: The response generation or query execution failed. See `error` field. * `COMPLETED`:
1125
+ Message processing is completed. Results are in the `attachments` field. Get the SQL query
1126
+ result by calling
1127
+ [getMessageAttachmentQueryResult](:method:genie/getMessageAttachmentQueryResult) API. *
1128
+ `SUBMITTED`: Message has been submitted. * `QUERY_RESULT_EXPIRED`: SQL result is not available
1129
+ anymore. The user needs to rerun the query. Rerun the SQL query result by calling
1130
+ [executeMessageAttachmentQuery](:method:genie/executeMessageAttachmentQuery) API. * `CANCELLED`:
1131
+ Message has been cancelled."""
1132
+
1133
+ ASKING_AI = "ASKING_AI"
1134
+ CANCELLED = "CANCELLED"
1135
+ COMPLETED = "COMPLETED"
1136
+ EXECUTING_QUERY = "EXECUTING_QUERY"
1137
+ FAILED = "FAILED"
1138
+ FETCHING_METADATA = "FETCHING_METADATA"
1139
+ FILTERING_CONTEXT = "FILTERING_CONTEXT"
1140
+ PENDING_WAREHOUSE = "PENDING_WAREHOUSE"
1141
+ QUERY_RESULT_EXPIRED = "QUERY_RESULT_EXPIRED"
1142
+ SUBMITTED = "SUBMITTED"
865
1143
 
866
1144
 
867
1145
  @dataclass
@@ -882,30 +1160,38 @@ class MigrateDashboardRequest:
882
1160
  def as_dict(self) -> dict:
883
1161
  """Serializes the MigrateDashboardRequest into a dictionary suitable for use as a JSON request body."""
884
1162
  body = {}
885
- if self.display_name is not None: body['display_name'] = self.display_name
886
- if self.parent_path is not None: body['parent_path'] = self.parent_path
887
- if self.source_dashboard_id is not None: body['source_dashboard_id'] = self.source_dashboard_id
1163
+ if self.display_name is not None:
1164
+ body["display_name"] = self.display_name
1165
+ if self.parent_path is not None:
1166
+ body["parent_path"] = self.parent_path
1167
+ if self.source_dashboard_id is not None:
1168
+ body["source_dashboard_id"] = self.source_dashboard_id
888
1169
  if self.update_parameter_syntax is not None:
889
- body['update_parameter_syntax'] = self.update_parameter_syntax
1170
+ body["update_parameter_syntax"] = self.update_parameter_syntax
890
1171
  return body
891
1172
 
892
1173
  def as_shallow_dict(self) -> dict:
893
1174
  """Serializes the MigrateDashboardRequest into a shallow dictionary of its immediate attributes."""
894
1175
  body = {}
895
- if self.display_name is not None: body['display_name'] = self.display_name
896
- if self.parent_path is not None: body['parent_path'] = self.parent_path
897
- if self.source_dashboard_id is not None: body['source_dashboard_id'] = self.source_dashboard_id
1176
+ if self.display_name is not None:
1177
+ body["display_name"] = self.display_name
1178
+ if self.parent_path is not None:
1179
+ body["parent_path"] = self.parent_path
1180
+ if self.source_dashboard_id is not None:
1181
+ body["source_dashboard_id"] = self.source_dashboard_id
898
1182
  if self.update_parameter_syntax is not None:
899
- body['update_parameter_syntax'] = self.update_parameter_syntax
1183
+ body["update_parameter_syntax"] = self.update_parameter_syntax
900
1184
  return body
901
1185
 
902
1186
  @classmethod
903
- def from_dict(cls, d: Dict[str, any]) -> MigrateDashboardRequest:
1187
+ def from_dict(cls, d: Dict[str, Any]) -> MigrateDashboardRequest:
904
1188
  """Deserializes the MigrateDashboardRequest from a dictionary."""
905
- return cls(display_name=d.get('display_name', None),
906
- parent_path=d.get('parent_path', None),
907
- source_dashboard_id=d.get('source_dashboard_id', None),
908
- update_parameter_syntax=d.get('update_parameter_syntax', None))
1189
+ return cls(
1190
+ display_name=d.get("display_name", None),
1191
+ parent_path=d.get("parent_path", None),
1192
+ source_dashboard_id=d.get("source_dashboard_id", None),
1193
+ update_parameter_syntax=d.get("update_parameter_syntax", None),
1194
+ )
909
1195
 
910
1196
 
911
1197
  @dataclass
@@ -917,19 +1203,21 @@ class PendingStatus:
917
1203
  def as_dict(self) -> dict:
918
1204
  """Serializes the PendingStatus into a dictionary suitable for use as a JSON request body."""
919
1205
  body = {}
920
- if self.data_token is not None: body['data_token'] = self.data_token
1206
+ if self.data_token is not None:
1207
+ body["data_token"] = self.data_token
921
1208
  return body
922
1209
 
923
1210
  def as_shallow_dict(self) -> dict:
924
1211
  """Serializes the PendingStatus into a shallow dictionary of its immediate attributes."""
925
1212
  body = {}
926
- if self.data_token is not None: body['data_token'] = self.data_token
1213
+ if self.data_token is not None:
1214
+ body["data_token"] = self.data_token
927
1215
  return body
928
1216
 
929
1217
  @classmethod
930
- def from_dict(cls, d: Dict[str, any]) -> PendingStatus:
1218
+ def from_dict(cls, d: Dict[str, Any]) -> PendingStatus:
931
1219
  """Deserializes the PendingStatus from a dictionary."""
932
- return cls(data_token=d.get('data_token', None))
1220
+ return cls(data_token=d.get("data_token", None))
933
1221
 
934
1222
 
935
1223
  @dataclass
@@ -939,19 +1227,21 @@ class PollQueryStatusResponse:
939
1227
  def as_dict(self) -> dict:
940
1228
  """Serializes the PollQueryStatusResponse into a dictionary suitable for use as a JSON request body."""
941
1229
  body = {}
942
- if self.data: body['data'] = [v.as_dict() for v in self.data]
1230
+ if self.data:
1231
+ body["data"] = [v.as_dict() for v in self.data]
943
1232
  return body
944
1233
 
945
1234
  def as_shallow_dict(self) -> dict:
946
1235
  """Serializes the PollQueryStatusResponse into a shallow dictionary of its immediate attributes."""
947
1236
  body = {}
948
- if self.data: body['data'] = self.data
1237
+ if self.data:
1238
+ body["data"] = self.data
949
1239
  return body
950
1240
 
951
1241
  @classmethod
952
- def from_dict(cls, d: Dict[str, any]) -> PollQueryStatusResponse:
1242
+ def from_dict(cls, d: Dict[str, Any]) -> PollQueryStatusResponse:
953
1243
  """Deserializes the PollQueryStatusResponse from a dictionary."""
954
- return cls(data=_repeated_dict(d, 'data', PollQueryStatusResponseData))
1244
+ return cls(data=_repeated_dict(d, "data", PollQueryStatusResponseData))
955
1245
 
956
1246
 
957
1247
  @dataclass
@@ -961,19 +1251,21 @@ class PollQueryStatusResponseData:
961
1251
  def as_dict(self) -> dict:
962
1252
  """Serializes the PollQueryStatusResponseData into a dictionary suitable for use as a JSON request body."""
963
1253
  body = {}
964
- if self.status: body['status'] = self.status.as_dict()
1254
+ if self.status:
1255
+ body["status"] = self.status.as_dict()
965
1256
  return body
966
1257
 
967
1258
  def as_shallow_dict(self) -> dict:
968
1259
  """Serializes the PollQueryStatusResponseData into a shallow dictionary of its immediate attributes."""
969
1260
  body = {}
970
- if self.status: body['status'] = self.status
1261
+ if self.status:
1262
+ body["status"] = self.status
971
1263
  return body
972
1264
 
973
1265
  @classmethod
974
- def from_dict(cls, d: Dict[str, any]) -> PollQueryStatusResponseData:
1266
+ def from_dict(cls, d: Dict[str, Any]) -> PollQueryStatusResponseData:
975
1267
  """Deserializes the PollQueryStatusResponseData from a dictionary."""
976
- return cls(status=_from_dict(d, 'status', QueryResponseStatus))
1268
+ return cls(status=_from_dict(d, "status", QueryResponseStatus))
977
1269
 
978
1270
 
979
1271
  @dataclass
@@ -991,25 +1283,33 @@ class PublishRequest:
991
1283
  def as_dict(self) -> dict:
992
1284
  """Serializes the PublishRequest into a dictionary suitable for use as a JSON request body."""
993
1285
  body = {}
994
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
995
- if self.embed_credentials is not None: body['embed_credentials'] = self.embed_credentials
996
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1286
+ if self.dashboard_id is not None:
1287
+ body["dashboard_id"] = self.dashboard_id
1288
+ if self.embed_credentials is not None:
1289
+ body["embed_credentials"] = self.embed_credentials
1290
+ if self.warehouse_id is not None:
1291
+ body["warehouse_id"] = self.warehouse_id
997
1292
  return body
998
1293
 
999
1294
  def as_shallow_dict(self) -> dict:
1000
1295
  """Serializes the PublishRequest into a shallow dictionary of its immediate attributes."""
1001
1296
  body = {}
1002
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
1003
- if self.embed_credentials is not None: body['embed_credentials'] = self.embed_credentials
1004
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1297
+ if self.dashboard_id is not None:
1298
+ body["dashboard_id"] = self.dashboard_id
1299
+ if self.embed_credentials is not None:
1300
+ body["embed_credentials"] = self.embed_credentials
1301
+ if self.warehouse_id is not None:
1302
+ body["warehouse_id"] = self.warehouse_id
1005
1303
  return body
1006
1304
 
1007
1305
  @classmethod
1008
- def from_dict(cls, d: Dict[str, any]) -> PublishRequest:
1306
+ def from_dict(cls, d: Dict[str, Any]) -> PublishRequest:
1009
1307
  """Deserializes the PublishRequest from a dictionary."""
1010
- return cls(dashboard_id=d.get('dashboard_id', None),
1011
- embed_credentials=d.get('embed_credentials', None),
1012
- warehouse_id=d.get('warehouse_id', None))
1308
+ return cls(
1309
+ dashboard_id=d.get("dashboard_id", None),
1310
+ embed_credentials=d.get("embed_credentials", None),
1311
+ warehouse_id=d.get("warehouse_id", None),
1312
+ )
1013
1313
 
1014
1314
 
1015
1315
  @dataclass
@@ -1029,99 +1329,38 @@ class PublishedDashboard:
1029
1329
  def as_dict(self) -> dict:
1030
1330
  """Serializes the PublishedDashboard into a dictionary suitable for use as a JSON request body."""
1031
1331
  body = {}
1032
- if self.display_name is not None: body['display_name'] = self.display_name
1033
- if self.embed_credentials is not None: body['embed_credentials'] = self.embed_credentials
1034
- if self.revision_create_time is not None: body['revision_create_time'] = self.revision_create_time
1035
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1332
+ if self.display_name is not None:
1333
+ body["display_name"] = self.display_name
1334
+ if self.embed_credentials is not None:
1335
+ body["embed_credentials"] = self.embed_credentials
1336
+ if self.revision_create_time is not None:
1337
+ body["revision_create_time"] = self.revision_create_time
1338
+ if self.warehouse_id is not None:
1339
+ body["warehouse_id"] = self.warehouse_id
1036
1340
  return body
1037
1341
 
1038
1342
  def as_shallow_dict(self) -> dict:
1039
1343
  """Serializes the PublishedDashboard into a shallow dictionary of its immediate attributes."""
1040
1344
  body = {}
1041
- if self.display_name is not None: body['display_name'] = self.display_name
1042
- if self.embed_credentials is not None: body['embed_credentials'] = self.embed_credentials
1043
- if self.revision_create_time is not None: body['revision_create_time'] = self.revision_create_time
1044
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1345
+ if self.display_name is not None:
1346
+ body["display_name"] = self.display_name
1347
+ if self.embed_credentials is not None:
1348
+ body["embed_credentials"] = self.embed_credentials
1349
+ if self.revision_create_time is not None:
1350
+ body["revision_create_time"] = self.revision_create_time
1351
+ if self.warehouse_id is not None:
1352
+ body["warehouse_id"] = self.warehouse_id
1045
1353
  return body
1046
1354
 
1047
1355
  @classmethod
1048
- def from_dict(cls, d: Dict[str, any]) -> PublishedDashboard:
1356
+ def from_dict(cls, d: Dict[str, Any]) -> PublishedDashboard:
1049
1357
  """Deserializes the PublishedDashboard from a dictionary."""
1050
- return cls(display_name=d.get('display_name', None),
1051
- embed_credentials=d.get('embed_credentials', None),
1052
- revision_create_time=d.get('revision_create_time', None),
1053
- warehouse_id=d.get('warehouse_id', None))
1054
-
1055
-
1056
- @dataclass
1057
- class QueryAttachment:
1058
- cached_query_schema: Optional[QuerySchema] = None
1059
-
1060
- description: Optional[str] = None
1061
- """Description of the query"""
1062
-
1063
- id: Optional[str] = None
1064
-
1065
- instruction_id: Optional[str] = None
1066
- """If the query was created on an instruction (trusted asset) we link to the id"""
1067
-
1068
- instruction_title: Optional[str] = None
1069
- """Always store the title next to the id in case the original instruction title changes or the
1070
- instruction is deleted."""
1071
-
1072
- last_updated_timestamp: Optional[int] = None
1073
- """Time when the user updated the query last"""
1074
-
1075
- query: Optional[str] = None
1076
- """AI generated SQL query"""
1077
-
1078
- statement_id: Optional[str] = None
1079
-
1080
- title: Optional[str] = None
1081
- """Name of the query"""
1082
-
1083
- def as_dict(self) -> dict:
1084
- """Serializes the QueryAttachment into a dictionary suitable for use as a JSON request body."""
1085
- body = {}
1086
- if self.cached_query_schema: body['cached_query_schema'] = self.cached_query_schema.as_dict()
1087
- if self.description is not None: body['description'] = self.description
1088
- if self.id is not None: body['id'] = self.id
1089
- if self.instruction_id is not None: body['instruction_id'] = self.instruction_id
1090
- if self.instruction_title is not None: body['instruction_title'] = self.instruction_title
1091
- if self.last_updated_timestamp is not None:
1092
- body['last_updated_timestamp'] = self.last_updated_timestamp
1093
- if self.query is not None: body['query'] = self.query
1094
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1095
- if self.title is not None: body['title'] = self.title
1096
- return body
1097
-
1098
- def as_shallow_dict(self) -> dict:
1099
- """Serializes the QueryAttachment into a shallow dictionary of its immediate attributes."""
1100
- body = {}
1101
- if self.cached_query_schema: body['cached_query_schema'] = self.cached_query_schema
1102
- if self.description is not None: body['description'] = self.description
1103
- if self.id is not None: body['id'] = self.id
1104
- if self.instruction_id is not None: body['instruction_id'] = self.instruction_id
1105
- if self.instruction_title is not None: body['instruction_title'] = self.instruction_title
1106
- if self.last_updated_timestamp is not None:
1107
- body['last_updated_timestamp'] = self.last_updated_timestamp
1108
- if self.query is not None: body['query'] = self.query
1109
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1110
- if self.title is not None: body['title'] = self.title
1111
- return body
1112
-
1113
- @classmethod
1114
- def from_dict(cls, d: Dict[str, any]) -> QueryAttachment:
1115
- """Deserializes the QueryAttachment from a dictionary."""
1116
- return cls(cached_query_schema=_from_dict(d, 'cached_query_schema', QuerySchema),
1117
- description=d.get('description', None),
1118
- id=d.get('id', None),
1119
- instruction_id=d.get('instruction_id', None),
1120
- instruction_title=d.get('instruction_title', None),
1121
- last_updated_timestamp=d.get('last_updated_timestamp', None),
1122
- query=d.get('query', None),
1123
- statement_id=d.get('statement_id', None),
1124
- title=d.get('title', None))
1358
+ return cls(
1359
+ display_name=d.get("display_name", None),
1360
+ embed_credentials=d.get("embed_credentials", None),
1361
+ revision_create_time=d.get("revision_create_time", None),
1362
+ warehouse_id=d.get("warehouse_id", None),
1363
+ )
1125
1364
 
1126
1365
 
1127
1366
  @dataclass
@@ -1146,94 +1385,43 @@ class QueryResponseStatus:
1146
1385
  def as_dict(self) -> dict:
1147
1386
  """Serializes the QueryResponseStatus into a dictionary suitable for use as a JSON request body."""
1148
1387
  body = {}
1149
- if self.canceled: body['canceled'] = self.canceled.as_dict()
1150
- if self.closed: body['closed'] = self.closed.as_dict()
1151
- if self.pending: body['pending'] = self.pending.as_dict()
1152
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1153
- if self.success: body['success'] = self.success.as_dict()
1388
+ if self.canceled:
1389
+ body["canceled"] = self.canceled.as_dict()
1390
+ if self.closed:
1391
+ body["closed"] = self.closed.as_dict()
1392
+ if self.pending:
1393
+ body["pending"] = self.pending.as_dict()
1394
+ if self.statement_id is not None:
1395
+ body["statement_id"] = self.statement_id
1396
+ if self.success:
1397
+ body["success"] = self.success.as_dict()
1154
1398
  return body
1155
1399
 
1156
1400
  def as_shallow_dict(self) -> dict:
1157
1401
  """Serializes the QueryResponseStatus into a shallow dictionary of its immediate attributes."""
1158
1402
  body = {}
1159
- if self.canceled: body['canceled'] = self.canceled
1160
- if self.closed: body['closed'] = self.closed
1161
- if self.pending: body['pending'] = self.pending
1162
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1163
- if self.success: body['success'] = self.success
1403
+ if self.canceled:
1404
+ body["canceled"] = self.canceled
1405
+ if self.closed:
1406
+ body["closed"] = self.closed
1407
+ if self.pending:
1408
+ body["pending"] = self.pending
1409
+ if self.statement_id is not None:
1410
+ body["statement_id"] = self.statement_id
1411
+ if self.success:
1412
+ body["success"] = self.success
1164
1413
  return body
1165
1414
 
1166
1415
  @classmethod
1167
- def from_dict(cls, d: Dict[str, any]) -> QueryResponseStatus:
1416
+ def from_dict(cls, d: Dict[str, Any]) -> QueryResponseStatus:
1168
1417
  """Deserializes the QueryResponseStatus from a dictionary."""
1169
- return cls(canceled=_from_dict(d, 'canceled', Empty),
1170
- closed=_from_dict(d, 'closed', Empty),
1171
- pending=_from_dict(d, 'pending', PendingStatus),
1172
- statement_id=d.get('statement_id', None),
1173
- success=_from_dict(d, 'success', SuccessStatus))
1174
-
1175
-
1176
- @dataclass
1177
- class QuerySchema:
1178
- columns: Optional[List[QuerySchemaColumn]] = None
1179
-
1180
- statement_id: Optional[str] = None
1181
- """Used to determine if the stored query schema is compatible with the latest run. The service
1182
- should always clear the schema when the query is re-executed."""
1183
-
1184
- def as_dict(self) -> dict:
1185
- """Serializes the QuerySchema into a dictionary suitable for use as a JSON request body."""
1186
- body = {}
1187
- if self.columns: body['columns'] = [v.as_dict() for v in self.columns]
1188
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1189
- return body
1190
-
1191
- def as_shallow_dict(self) -> dict:
1192
- """Serializes the QuerySchema into a shallow dictionary of its immediate attributes."""
1193
- body = {}
1194
- if self.columns: body['columns'] = self.columns
1195
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1196
- return body
1197
-
1198
- @classmethod
1199
- def from_dict(cls, d: Dict[str, any]) -> QuerySchema:
1200
- """Deserializes the QuerySchema from a dictionary."""
1201
- return cls(columns=_repeated_dict(d, 'columns', QuerySchemaColumn),
1202
- statement_id=d.get('statement_id', None))
1203
-
1204
-
1205
- @dataclass
1206
- class QuerySchemaColumn:
1207
- name: str
1208
-
1209
- type_text: str
1210
- """Corresponds to type desc"""
1211
-
1212
- data_type: DataType
1213
- """Populated from https://docs.databricks.com/sql/language-manual/sql-ref-datatypes.html"""
1214
-
1215
- def as_dict(self) -> dict:
1216
- """Serializes the QuerySchemaColumn into a dictionary suitable for use as a JSON request body."""
1217
- body = {}
1218
- if self.data_type is not None: body['data_type'] = self.data_type.value
1219
- if self.name is not None: body['name'] = self.name
1220
- if self.type_text is not None: body['type_text'] = self.type_text
1221
- return body
1222
-
1223
- def as_shallow_dict(self) -> dict:
1224
- """Serializes the QuerySchemaColumn into a shallow dictionary of its immediate attributes."""
1225
- body = {}
1226
- if self.data_type is not None: body['data_type'] = self.data_type
1227
- if self.name is not None: body['name'] = self.name
1228
- if self.type_text is not None: body['type_text'] = self.type_text
1229
- return body
1230
-
1231
- @classmethod
1232
- def from_dict(cls, d: Dict[str, any]) -> QuerySchemaColumn:
1233
- """Deserializes the QuerySchemaColumn from a dictionary."""
1234
- return cls(data_type=_enum(d, 'data_type', DataType),
1235
- name=d.get('name', None),
1236
- type_text=d.get('type_text', None))
1418
+ return cls(
1419
+ canceled=_from_dict(d, "canceled", Empty),
1420
+ closed=_from_dict(d, "closed", Empty),
1421
+ pending=_from_dict(d, "pending", PendingStatus),
1422
+ statement_id=d.get("statement_id", None),
1423
+ success=_from_dict(d, "success", SuccessStatus),
1424
+ )
1237
1425
 
1238
1426
 
1239
1427
  @dataclass
@@ -1251,25 +1439,33 @@ class Result:
1251
1439
  def as_dict(self) -> dict:
1252
1440
  """Serializes the Result into a dictionary suitable for use as a JSON request body."""
1253
1441
  body = {}
1254
- if self.is_truncated is not None: body['is_truncated'] = self.is_truncated
1255
- if self.row_count is not None: body['row_count'] = self.row_count
1256
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1442
+ if self.is_truncated is not None:
1443
+ body["is_truncated"] = self.is_truncated
1444
+ if self.row_count is not None:
1445
+ body["row_count"] = self.row_count
1446
+ if self.statement_id is not None:
1447
+ body["statement_id"] = self.statement_id
1257
1448
  return body
1258
1449
 
1259
1450
  def as_shallow_dict(self) -> dict:
1260
1451
  """Serializes the Result into a shallow dictionary of its immediate attributes."""
1261
1452
  body = {}
1262
- if self.is_truncated is not None: body['is_truncated'] = self.is_truncated
1263
- if self.row_count is not None: body['row_count'] = self.row_count
1264
- if self.statement_id is not None: body['statement_id'] = self.statement_id
1453
+ if self.is_truncated is not None:
1454
+ body["is_truncated"] = self.is_truncated
1455
+ if self.row_count is not None:
1456
+ body["row_count"] = self.row_count
1457
+ if self.statement_id is not None:
1458
+ body["statement_id"] = self.statement_id
1265
1459
  return body
1266
1460
 
1267
1461
  @classmethod
1268
- def from_dict(cls, d: Dict[str, any]) -> Result:
1462
+ def from_dict(cls, d: Dict[str, Any]) -> Result:
1269
1463
  """Deserializes the Result from a dictionary."""
1270
- return cls(is_truncated=d.get('is_truncated', None),
1271
- row_count=d.get('row_count', None),
1272
- statement_id=d.get('statement_id', None))
1464
+ return cls(
1465
+ is_truncated=d.get("is_truncated", None),
1466
+ row_count=d.get("row_count", None),
1467
+ statement_id=d.get("statement_id", None),
1468
+ )
1273
1469
 
1274
1470
 
1275
1471
  @dataclass
@@ -1306,49 +1502,69 @@ class Schedule:
1306
1502
  def as_dict(self) -> dict:
1307
1503
  """Serializes the Schedule into a dictionary suitable for use as a JSON request body."""
1308
1504
  body = {}
1309
- if self.create_time is not None: body['create_time'] = self.create_time
1310
- if self.cron_schedule: body['cron_schedule'] = self.cron_schedule.as_dict()
1311
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
1312
- if self.display_name is not None: body['display_name'] = self.display_name
1313
- if self.etag is not None: body['etag'] = self.etag
1314
- if self.pause_status is not None: body['pause_status'] = self.pause_status.value
1315
- if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
1316
- if self.update_time is not None: body['update_time'] = self.update_time
1317
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1505
+ if self.create_time is not None:
1506
+ body["create_time"] = self.create_time
1507
+ if self.cron_schedule:
1508
+ body["cron_schedule"] = self.cron_schedule.as_dict()
1509
+ if self.dashboard_id is not None:
1510
+ body["dashboard_id"] = self.dashboard_id
1511
+ if self.display_name is not None:
1512
+ body["display_name"] = self.display_name
1513
+ if self.etag is not None:
1514
+ body["etag"] = self.etag
1515
+ if self.pause_status is not None:
1516
+ body["pause_status"] = self.pause_status.value
1517
+ if self.schedule_id is not None:
1518
+ body["schedule_id"] = self.schedule_id
1519
+ if self.update_time is not None:
1520
+ body["update_time"] = self.update_time
1521
+ if self.warehouse_id is not None:
1522
+ body["warehouse_id"] = self.warehouse_id
1318
1523
  return body
1319
1524
 
1320
1525
  def as_shallow_dict(self) -> dict:
1321
1526
  """Serializes the Schedule into a shallow dictionary of its immediate attributes."""
1322
1527
  body = {}
1323
- if self.create_time is not None: body['create_time'] = self.create_time
1324
- if self.cron_schedule: body['cron_schedule'] = self.cron_schedule
1325
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
1326
- if self.display_name is not None: body['display_name'] = self.display_name
1327
- if self.etag is not None: body['etag'] = self.etag
1328
- if self.pause_status is not None: body['pause_status'] = self.pause_status
1329
- if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
1330
- if self.update_time is not None: body['update_time'] = self.update_time
1331
- if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id
1528
+ if self.create_time is not None:
1529
+ body["create_time"] = self.create_time
1530
+ if self.cron_schedule:
1531
+ body["cron_schedule"] = self.cron_schedule
1532
+ if self.dashboard_id is not None:
1533
+ body["dashboard_id"] = self.dashboard_id
1534
+ if self.display_name is not None:
1535
+ body["display_name"] = self.display_name
1536
+ if self.etag is not None:
1537
+ body["etag"] = self.etag
1538
+ if self.pause_status is not None:
1539
+ body["pause_status"] = self.pause_status
1540
+ if self.schedule_id is not None:
1541
+ body["schedule_id"] = self.schedule_id
1542
+ if self.update_time is not None:
1543
+ body["update_time"] = self.update_time
1544
+ if self.warehouse_id is not None:
1545
+ body["warehouse_id"] = self.warehouse_id
1332
1546
  return body
1333
1547
 
1334
1548
  @classmethod
1335
- def from_dict(cls, d: Dict[str, any]) -> Schedule:
1549
+ def from_dict(cls, d: Dict[str, Any]) -> Schedule:
1336
1550
  """Deserializes the Schedule from a dictionary."""
1337
- return cls(create_time=d.get('create_time', None),
1338
- cron_schedule=_from_dict(d, 'cron_schedule', CronSchedule),
1339
- dashboard_id=d.get('dashboard_id', None),
1340
- display_name=d.get('display_name', None),
1341
- etag=d.get('etag', None),
1342
- pause_status=_enum(d, 'pause_status', SchedulePauseStatus),
1343
- schedule_id=d.get('schedule_id', None),
1344
- update_time=d.get('update_time', None),
1345
- warehouse_id=d.get('warehouse_id', None))
1551
+ return cls(
1552
+ create_time=d.get("create_time", None),
1553
+ cron_schedule=_from_dict(d, "cron_schedule", CronSchedule),
1554
+ dashboard_id=d.get("dashboard_id", None),
1555
+ display_name=d.get("display_name", None),
1556
+ etag=d.get("etag", None),
1557
+ pause_status=_enum(d, "pause_status", SchedulePauseStatus),
1558
+ schedule_id=d.get("schedule_id", None),
1559
+ update_time=d.get("update_time", None),
1560
+ warehouse_id=d.get("warehouse_id", None),
1561
+ )
1346
1562
 
1347
1563
 
1348
1564
  class SchedulePauseStatus(Enum):
1349
1565
 
1350
- PAUSED = 'PAUSED'
1351
- UNPAUSED = 'UNPAUSED'
1566
+ PAUSED = "PAUSED"
1567
+ UNPAUSED = "UNPAUSED"
1352
1568
 
1353
1569
 
1354
1570
  @dataclass
@@ -1364,23 +1580,28 @@ class Subscriber:
1364
1580
  def as_dict(self) -> dict:
1365
1581
  """Serializes the Subscriber into a dictionary suitable for use as a JSON request body."""
1366
1582
  body = {}
1367
- if self.destination_subscriber: body['destination_subscriber'] = self.destination_subscriber.as_dict()
1368
- if self.user_subscriber: body['user_subscriber'] = self.user_subscriber.as_dict()
1583
+ if self.destination_subscriber:
1584
+ body["destination_subscriber"] = self.destination_subscriber.as_dict()
1585
+ if self.user_subscriber:
1586
+ body["user_subscriber"] = self.user_subscriber.as_dict()
1369
1587
  return body
1370
1588
 
1371
1589
  def as_shallow_dict(self) -> dict:
1372
1590
  """Serializes the Subscriber into a shallow dictionary of its immediate attributes."""
1373
1591
  body = {}
1374
- if self.destination_subscriber: body['destination_subscriber'] = self.destination_subscriber
1375
- if self.user_subscriber: body['user_subscriber'] = self.user_subscriber
1592
+ if self.destination_subscriber:
1593
+ body["destination_subscriber"] = self.destination_subscriber
1594
+ if self.user_subscriber:
1595
+ body["user_subscriber"] = self.user_subscriber
1376
1596
  return body
1377
1597
 
1378
1598
  @classmethod
1379
- def from_dict(cls, d: Dict[str, any]) -> Subscriber:
1599
+ def from_dict(cls, d: Dict[str, Any]) -> Subscriber:
1380
1600
  """Deserializes the Subscriber from a dictionary."""
1381
- return cls(destination_subscriber=_from_dict(d, 'destination_subscriber',
1382
- SubscriptionSubscriberDestination),
1383
- user_subscriber=_from_dict(d, 'user_subscriber', SubscriptionSubscriberUser))
1601
+ return cls(
1602
+ destination_subscriber=_from_dict(d, "destination_subscriber", SubscriptionSubscriberDestination),
1603
+ user_subscriber=_from_dict(d, "user_subscriber", SubscriptionSubscriberUser),
1604
+ )
1384
1605
 
1385
1606
 
1386
1607
  @dataclass
@@ -1414,40 +1635,58 @@ class Subscription:
1414
1635
  def as_dict(self) -> dict:
1415
1636
  """Serializes the Subscription into a dictionary suitable for use as a JSON request body."""
1416
1637
  body = {}
1417
- if self.create_time is not None: body['create_time'] = self.create_time
1418
- if self.created_by_user_id is not None: body['created_by_user_id'] = self.created_by_user_id
1419
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
1420
- if self.etag is not None: body['etag'] = self.etag
1421
- if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
1422
- if self.subscriber: body['subscriber'] = self.subscriber.as_dict()
1423
- if self.subscription_id is not None: body['subscription_id'] = self.subscription_id
1424
- if self.update_time is not None: body['update_time'] = self.update_time
1638
+ if self.create_time is not None:
1639
+ body["create_time"] = self.create_time
1640
+ if self.created_by_user_id is not None:
1641
+ body["created_by_user_id"] = self.created_by_user_id
1642
+ if self.dashboard_id is not None:
1643
+ body["dashboard_id"] = self.dashboard_id
1644
+ if self.etag is not None:
1645
+ body["etag"] = self.etag
1646
+ if self.schedule_id is not None:
1647
+ body["schedule_id"] = self.schedule_id
1648
+ if self.subscriber:
1649
+ body["subscriber"] = self.subscriber.as_dict()
1650
+ if self.subscription_id is not None:
1651
+ body["subscription_id"] = self.subscription_id
1652
+ if self.update_time is not None:
1653
+ body["update_time"] = self.update_time
1425
1654
  return body
1426
1655
 
1427
1656
  def as_shallow_dict(self) -> dict:
1428
1657
  """Serializes the Subscription into a shallow dictionary of its immediate attributes."""
1429
1658
  body = {}
1430
- if self.create_time is not None: body['create_time'] = self.create_time
1431
- if self.created_by_user_id is not None: body['created_by_user_id'] = self.created_by_user_id
1432
- if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
1433
- if self.etag is not None: body['etag'] = self.etag
1434
- if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
1435
- if self.subscriber: body['subscriber'] = self.subscriber
1436
- if self.subscription_id is not None: body['subscription_id'] = self.subscription_id
1437
- if self.update_time is not None: body['update_time'] = self.update_time
1659
+ if self.create_time is not None:
1660
+ body["create_time"] = self.create_time
1661
+ if self.created_by_user_id is not None:
1662
+ body["created_by_user_id"] = self.created_by_user_id
1663
+ if self.dashboard_id is not None:
1664
+ body["dashboard_id"] = self.dashboard_id
1665
+ if self.etag is not None:
1666
+ body["etag"] = self.etag
1667
+ if self.schedule_id is not None:
1668
+ body["schedule_id"] = self.schedule_id
1669
+ if self.subscriber:
1670
+ body["subscriber"] = self.subscriber
1671
+ if self.subscription_id is not None:
1672
+ body["subscription_id"] = self.subscription_id
1673
+ if self.update_time is not None:
1674
+ body["update_time"] = self.update_time
1438
1675
  return body
1439
1676
 
1440
1677
  @classmethod
1441
- def from_dict(cls, d: Dict[str, any]) -> Subscription:
1678
+ def from_dict(cls, d: Dict[str, Any]) -> Subscription:
1442
1679
  """Deserializes the Subscription from a dictionary."""
1443
- return cls(create_time=d.get('create_time', None),
1444
- created_by_user_id=d.get('created_by_user_id', None),
1445
- dashboard_id=d.get('dashboard_id', None),
1446
- etag=d.get('etag', None),
1447
- schedule_id=d.get('schedule_id', None),
1448
- subscriber=_from_dict(d, 'subscriber', Subscriber),
1449
- subscription_id=d.get('subscription_id', None),
1450
- update_time=d.get('update_time', None))
1680
+ return cls(
1681
+ create_time=d.get("create_time", None),
1682
+ created_by_user_id=d.get("created_by_user_id", None),
1683
+ dashboard_id=d.get("dashboard_id", None),
1684
+ etag=d.get("etag", None),
1685
+ schedule_id=d.get("schedule_id", None),
1686
+ subscriber=_from_dict(d, "subscriber", Subscriber),
1687
+ subscription_id=d.get("subscription_id", None),
1688
+ update_time=d.get("update_time", None),
1689
+ )
1451
1690
 
1452
1691
 
1453
1692
  @dataclass
@@ -1458,19 +1697,21 @@ class SubscriptionSubscriberDestination:
1458
1697
  def as_dict(self) -> dict:
1459
1698
  """Serializes the SubscriptionSubscriberDestination into a dictionary suitable for use as a JSON request body."""
1460
1699
  body = {}
1461
- if self.destination_id is not None: body['destination_id'] = self.destination_id
1700
+ if self.destination_id is not None:
1701
+ body["destination_id"] = self.destination_id
1462
1702
  return body
1463
1703
 
1464
1704
  def as_shallow_dict(self) -> dict:
1465
1705
  """Serializes the SubscriptionSubscriberDestination into a shallow dictionary of its immediate attributes."""
1466
1706
  body = {}
1467
- if self.destination_id is not None: body['destination_id'] = self.destination_id
1707
+ if self.destination_id is not None:
1708
+ body["destination_id"] = self.destination_id
1468
1709
  return body
1469
1710
 
1470
1711
  @classmethod
1471
- def from_dict(cls, d: Dict[str, any]) -> SubscriptionSubscriberDestination:
1712
+ def from_dict(cls, d: Dict[str, Any]) -> SubscriptionSubscriberDestination:
1472
1713
  """Deserializes the SubscriptionSubscriberDestination from a dictionary."""
1473
- return cls(destination_id=d.get('destination_id', None))
1714
+ return cls(destination_id=d.get("destination_id", None))
1474
1715
 
1475
1716
 
1476
1717
  @dataclass
@@ -1481,19 +1722,21 @@ class SubscriptionSubscriberUser:
1481
1722
  def as_dict(self) -> dict:
1482
1723
  """Serializes the SubscriptionSubscriberUser into a dictionary suitable for use as a JSON request body."""
1483
1724
  body = {}
1484
- if self.user_id is not None: body['user_id'] = self.user_id
1725
+ if self.user_id is not None:
1726
+ body["user_id"] = self.user_id
1485
1727
  return body
1486
1728
 
1487
1729
  def as_shallow_dict(self) -> dict:
1488
1730
  """Serializes the SubscriptionSubscriberUser into a shallow dictionary of its immediate attributes."""
1489
1731
  body = {}
1490
- if self.user_id is not None: body['user_id'] = self.user_id
1732
+ if self.user_id is not None:
1733
+ body["user_id"] = self.user_id
1491
1734
  return body
1492
1735
 
1493
1736
  @classmethod
1494
- def from_dict(cls, d: Dict[str, any]) -> SubscriptionSubscriberUser:
1737
+ def from_dict(cls, d: Dict[str, Any]) -> SubscriptionSubscriberUser:
1495
1738
  """Deserializes the SubscriptionSubscriberUser from a dictionary."""
1496
- return cls(user_id=d.get('user_id', None))
1739
+ return cls(user_id=d.get("user_id", None))
1497
1740
 
1498
1741
 
1499
1742
  @dataclass
@@ -1508,21 +1751,25 @@ class SuccessStatus:
1508
1751
  def as_dict(self) -> dict:
1509
1752
  """Serializes the SuccessStatus into a dictionary suitable for use as a JSON request body."""
1510
1753
  body = {}
1511
- if self.data_token is not None: body['data_token'] = self.data_token
1512
- if self.truncated is not None: body['truncated'] = self.truncated
1754
+ if self.data_token is not None:
1755
+ body["data_token"] = self.data_token
1756
+ if self.truncated is not None:
1757
+ body["truncated"] = self.truncated
1513
1758
  return body
1514
1759
 
1515
1760
  def as_shallow_dict(self) -> dict:
1516
1761
  """Serializes the SuccessStatus into a shallow dictionary of its immediate attributes."""
1517
1762
  body = {}
1518
- if self.data_token is not None: body['data_token'] = self.data_token
1519
- if self.truncated is not None: body['truncated'] = self.truncated
1763
+ if self.data_token is not None:
1764
+ body["data_token"] = self.data_token
1765
+ if self.truncated is not None:
1766
+ body["truncated"] = self.truncated
1520
1767
  return body
1521
1768
 
1522
1769
  @classmethod
1523
- def from_dict(cls, d: Dict[str, any]) -> SuccessStatus:
1770
+ def from_dict(cls, d: Dict[str, Any]) -> SuccessStatus:
1524
1771
  """Deserializes the SuccessStatus from a dictionary."""
1525
- return cls(data_token=d.get('data_token', None), truncated=d.get('truncated', None))
1772
+ return cls(data_token=d.get("data_token", None), truncated=d.get("truncated", None))
1526
1773
 
1527
1774
 
1528
1775
  @dataclass
@@ -1535,26 +1782,29 @@ class TextAttachment:
1535
1782
  def as_dict(self) -> dict:
1536
1783
  """Serializes the TextAttachment into a dictionary suitable for use as a JSON request body."""
1537
1784
  body = {}
1538
- if self.content is not None: body['content'] = self.content
1539
- if self.id is not None: body['id'] = self.id
1785
+ if self.content is not None:
1786
+ body["content"] = self.content
1787
+ if self.id is not None:
1788
+ body["id"] = self.id
1540
1789
  return body
1541
1790
 
1542
1791
  def as_shallow_dict(self) -> dict:
1543
1792
  """Serializes the TextAttachment into a shallow dictionary of its immediate attributes."""
1544
1793
  body = {}
1545
- if self.content is not None: body['content'] = self.content
1546
- if self.id is not None: body['id'] = self.id
1794
+ if self.content is not None:
1795
+ body["content"] = self.content
1796
+ if self.id is not None:
1797
+ body["id"] = self.id
1547
1798
  return body
1548
1799
 
1549
1800
  @classmethod
1550
- def from_dict(cls, d: Dict[str, any]) -> TextAttachment:
1801
+ def from_dict(cls, d: Dict[str, Any]) -> TextAttachment:
1551
1802
  """Deserializes the TextAttachment from a dictionary."""
1552
- return cls(content=d.get('content', None), id=d.get('id', None))
1803
+ return cls(content=d.get("content", None), id=d.get("id", None))
1553
1804
 
1554
1805
 
1555
1806
  @dataclass
1556
1807
  class TrashDashboardResponse:
1557
-
1558
1808
  def as_dict(self) -> dict:
1559
1809
  """Serializes the TrashDashboardResponse into a dictionary suitable for use as a JSON request body."""
1560
1810
  body = {}
@@ -1566,14 +1816,13 @@ class TrashDashboardResponse:
1566
1816
  return body
1567
1817
 
1568
1818
  @classmethod
1569
- def from_dict(cls, d: Dict[str, any]) -> TrashDashboardResponse:
1819
+ def from_dict(cls, d: Dict[str, Any]) -> TrashDashboardResponse:
1570
1820
  """Deserializes the TrashDashboardResponse from a dictionary."""
1571
1821
  return cls()
1572
1822
 
1573
1823
 
1574
1824
  @dataclass
1575
1825
  class UnpublishDashboardResponse:
1576
-
1577
1826
  def as_dict(self) -> dict:
1578
1827
  """Serializes the UnpublishDashboardResponse into a dictionary suitable for use as a JSON request body."""
1579
1828
  body = {}
@@ -1585,7 +1834,7 @@ class UnpublishDashboardResponse:
1585
1834
  return body
1586
1835
 
1587
1836
  @classmethod
1588
- def from_dict(cls, d: Dict[str, any]) -> UnpublishDashboardResponse:
1837
+ def from_dict(cls, d: Dict[str, Any]) -> UnpublishDashboardResponse:
1589
1838
  """Deserializes the UnpublishDashboardResponse from a dictionary."""
1590
1839
  return cls()
1591
1840
 
@@ -1600,157 +1849,238 @@ class GenieAPI:
1600
1849
  self._api = api_client
1601
1850
 
1602
1851
  def wait_get_message_genie_completed(
1603
- self,
1604
- conversation_id: str,
1605
- message_id: str,
1606
- space_id: str,
1607
- timeout=timedelta(minutes=20),
1608
- callback: Optional[Callable[[GenieMessage], None]] = None) -> GenieMessage:
1852
+ self,
1853
+ conversation_id: str,
1854
+ message_id: str,
1855
+ space_id: str,
1856
+ timeout=timedelta(minutes=20),
1857
+ callback: Optional[Callable[[GenieMessage], None]] = None,
1858
+ ) -> GenieMessage:
1609
1859
  deadline = time.time() + timeout.total_seconds()
1610
- target_states = (MessageStatus.COMPLETED, )
1611
- failure_states = (MessageStatus.FAILED, )
1612
- status_message = 'polling...'
1860
+ target_states = (MessageStatus.COMPLETED,)
1861
+ failure_states = (MessageStatus.FAILED,)
1862
+ status_message = "polling..."
1613
1863
  attempt = 1
1614
1864
  while time.time() < deadline:
1615
1865
  poll = self.get_message(conversation_id=conversation_id, message_id=message_id, space_id=space_id)
1616
1866
  status = poll.status
1617
- status_message = f'current status: {status}'
1867
+ status_message = f"current status: {status}"
1618
1868
  if status in target_states:
1619
1869
  return poll
1620
1870
  if callback:
1621
1871
  callback(poll)
1622
1872
  if status in failure_states:
1623
- msg = f'failed to reach COMPLETED, got {status}: {status_message}'
1873
+ msg = f"failed to reach COMPLETED, got {status}: {status_message}"
1624
1874
  raise OperationFailed(msg)
1625
1875
  prefix = f"conversation_id={conversation_id}, message_id={message_id}, space_id={space_id}"
1626
1876
  sleep = attempt
1627
1877
  if sleep > 10:
1628
1878
  # sleep 10s max per attempt
1629
1879
  sleep = 10
1630
- _LOG.debug(f'{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)')
1880
+ _LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
1631
1881
  time.sleep(sleep + random.random())
1632
1882
  attempt += 1
1633
- raise TimeoutError(f'timed out after {timeout}: {status_message}')
1883
+ raise TimeoutError(f"timed out after {timeout}: {status_message}")
1634
1884
 
1635
1885
  def create_message(self, space_id: str, conversation_id: str, content: str) -> Wait[GenieMessage]:
1636
1886
  """Create conversation message.
1637
-
1638
- Create new message in [conversation](:method:genie/startconversation). The AI response uses all
1887
+
1888
+ Create new message in a [conversation](:method:genie/startconversation). The AI response uses all
1639
1889
  previously created messages in the conversation to respond.
1640
-
1890
+
1641
1891
  :param space_id: str
1642
1892
  The ID associated with the Genie space where the conversation is started.
1643
1893
  :param conversation_id: str
1644
1894
  The ID associated with the conversation.
1645
1895
  :param content: str
1646
1896
  User message content.
1647
-
1897
+
1648
1898
  :returns:
1649
1899
  Long-running operation waiter for :class:`GenieMessage`.
1650
1900
  See :method:wait_get_message_genie_completed for more details.
1651
1901
  """
1652
1902
  body = {}
1653
- if content is not None: body['content'] = content
1654
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1903
+ if content is not None:
1904
+ body["content"] = content
1905
+ headers = {
1906
+ "Accept": "application/json",
1907
+ "Content-Type": "application/json",
1908
+ }
1655
1909
 
1656
1910
  op_response = self._api.do(
1657
- 'POST',
1658
- f'/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages',
1911
+ "POST",
1912
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages",
1659
1913
  body=body,
1660
- headers=headers)
1661
- return Wait(self.wait_get_message_genie_completed,
1662
- response=GenieMessage.from_dict(op_response),
1663
- conversation_id=conversation_id,
1664
- message_id=op_response['id'],
1665
- space_id=space_id)
1666
-
1667
- def create_message_and_wait(self,
1668
- space_id: str,
1669
- conversation_id: str,
1670
- content: str,
1671
- timeout=timedelta(minutes=20)) -> GenieMessage:
1672
- return self.create_message(content=content, conversation_id=conversation_id,
1673
- space_id=space_id).result(timeout=timeout)
1674
-
1675
- def execute_message_query(self, space_id: str, conversation_id: str,
1676
- message_id: str) -> GenieGetMessageQueryResultResponse:
1677
- """Execute SQL query in a conversation message.
1678
-
1914
+ headers=headers,
1915
+ )
1916
+ return Wait(
1917
+ self.wait_get_message_genie_completed,
1918
+ response=GenieMessage.from_dict(op_response),
1919
+ conversation_id=conversation_id,
1920
+ message_id=op_response["id"],
1921
+ space_id=space_id,
1922
+ )
1923
+
1924
+ def create_message_and_wait(
1925
+ self, space_id: str, conversation_id: str, content: str, timeout=timedelta(minutes=20)
1926
+ ) -> GenieMessage:
1927
+ return self.create_message(content=content, conversation_id=conversation_id, space_id=space_id).result(
1928
+ timeout=timeout
1929
+ )
1930
+
1931
+ def execute_message_attachment_query(
1932
+ self, space_id: str, conversation_id: str, message_id: str, attachment_id: str
1933
+ ) -> GenieGetMessageQueryResultResponse:
1934
+ """Execute message attachment SQL query.
1935
+
1936
+ Execute the SQL for a message query attachment. Use this API when the query attachment has expired and
1937
+ needs to be re-executed.
1938
+
1939
+ :param space_id: str
1940
+ Genie space ID
1941
+ :param conversation_id: str
1942
+ Conversation ID
1943
+ :param message_id: str
1944
+ Message ID
1945
+ :param attachment_id: str
1946
+ Attachment ID
1947
+
1948
+ :returns: :class:`GenieGetMessageQueryResultResponse`
1949
+ """
1950
+
1951
+ headers = {
1952
+ "Accept": "application/json",
1953
+ }
1954
+
1955
+ res = self._api.do(
1956
+ "POST",
1957
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/attachments/{attachment_id}/execute-query",
1958
+ headers=headers,
1959
+ )
1960
+ return GenieGetMessageQueryResultResponse.from_dict(res)
1961
+
1962
+ def execute_message_query(
1963
+ self, space_id: str, conversation_id: str, message_id: str
1964
+ ) -> GenieGetMessageQueryResultResponse:
1965
+ """[Deprecated] Execute SQL query in a conversation message.
1966
+
1679
1967
  Execute the SQL query in the message.
1680
-
1968
+
1681
1969
  :param space_id: str
1682
1970
  Genie space ID
1683
1971
  :param conversation_id: str
1684
1972
  Conversation ID
1685
1973
  :param message_id: str
1686
1974
  Message ID
1687
-
1975
+
1688
1976
  :returns: :class:`GenieGetMessageQueryResultResponse`
1689
1977
  """
1690
1978
 
1691
- headers = {'Accept': 'application/json', }
1979
+ headers = {
1980
+ "Accept": "application/json",
1981
+ }
1692
1982
 
1693
1983
  res = self._api.do(
1694
- 'POST',
1695
- f'/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/execute-query',
1696
- headers=headers)
1984
+ "POST",
1985
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/execute-query",
1986
+ headers=headers,
1987
+ )
1697
1988
  return GenieGetMessageQueryResultResponse.from_dict(res)
1698
1989
 
1699
1990
  def get_message(self, space_id: str, conversation_id: str, message_id: str) -> GenieMessage:
1700
1991
  """Get conversation message.
1701
-
1992
+
1702
1993
  Get message from conversation.
1703
-
1994
+
1704
1995
  :param space_id: str
1705
1996
  The ID associated with the Genie space where the target conversation is located.
1706
1997
  :param conversation_id: str
1707
1998
  The ID associated with the target conversation.
1708
1999
  :param message_id: str
1709
2000
  The ID associated with the target message from the identified conversation.
1710
-
2001
+
1711
2002
  :returns: :class:`GenieMessage`
1712
2003
  """
1713
2004
 
1714
- headers = {'Accept': 'application/json', }
2005
+ headers = {
2006
+ "Accept": "application/json",
2007
+ }
1715
2008
 
1716
2009
  res = self._api.do(
1717
- 'GET',
1718
- f'/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}',
1719
- headers=headers)
2010
+ "GET",
2011
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}",
2012
+ headers=headers,
2013
+ )
1720
2014
  return GenieMessage.from_dict(res)
1721
2015
 
1722
- def get_message_query_result(self, space_id: str, conversation_id: str,
1723
- message_id: str) -> GenieGetMessageQueryResultResponse:
1724
- """Get conversation message SQL query result.
1725
-
2016
+ def get_message_attachment_query_result(
2017
+ self, space_id: str, conversation_id: str, message_id: str, attachment_id: str
2018
+ ) -> GenieGetMessageQueryResultResponse:
2019
+ """Get message attachment SQL query result.
2020
+
2021
+ Get the result of SQL query if the message has a query attachment. This is only available if a message
2022
+ has a query attachment and the message status is `EXECUTING_QUERY` OR `COMPLETED`.
2023
+
2024
+ :param space_id: str
2025
+ Genie space ID
2026
+ :param conversation_id: str
2027
+ Conversation ID
2028
+ :param message_id: str
2029
+ Message ID
2030
+ :param attachment_id: str
2031
+ Attachment ID
2032
+
2033
+ :returns: :class:`GenieGetMessageQueryResultResponse`
2034
+ """
2035
+
2036
+ headers = {
2037
+ "Accept": "application/json",
2038
+ }
2039
+
2040
+ res = self._api.do(
2041
+ "GET",
2042
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/attachments/{attachment_id}/query-result",
2043
+ headers=headers,
2044
+ )
2045
+ return GenieGetMessageQueryResultResponse.from_dict(res)
2046
+
2047
+ def get_message_query_result(
2048
+ self, space_id: str, conversation_id: str, message_id: str
2049
+ ) -> GenieGetMessageQueryResultResponse:
2050
+ """[Deprecated] Get conversation message SQL query result.
2051
+
1726
2052
  Get the result of SQL query if the message has a query attachment. This is only available if a message
1727
2053
  has a query attachment and the message status is `EXECUTING_QUERY`.
1728
-
2054
+
1729
2055
  :param space_id: str
1730
2056
  Genie space ID
1731
2057
  :param conversation_id: str
1732
2058
  Conversation ID
1733
2059
  :param message_id: str
1734
2060
  Message ID
1735
-
2061
+
1736
2062
  :returns: :class:`GenieGetMessageQueryResultResponse`
1737
2063
  """
1738
2064
 
1739
- headers = {'Accept': 'application/json', }
2065
+ headers = {
2066
+ "Accept": "application/json",
2067
+ }
1740
2068
 
1741
2069
  res = self._api.do(
1742
- 'GET',
1743
- f'/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/query-result',
1744
- headers=headers)
2070
+ "GET",
2071
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/query-result",
2072
+ headers=headers,
2073
+ )
1745
2074
  return GenieGetMessageQueryResultResponse.from_dict(res)
1746
2075
 
1747
- def get_message_query_result_by_attachment(self, space_id: str, conversation_id: str, message_id: str,
1748
- attachment_id: str) -> GenieGetMessageQueryResultResponse:
1749
- """Get conversation message SQL query result by attachment id.
1750
-
1751
- Get the result of SQL query by attachment id This is only available if a message has a query
1752
- attachment and the message status is `EXECUTING_QUERY`.
1753
-
2076
+ def get_message_query_result_by_attachment(
2077
+ self, space_id: str, conversation_id: str, message_id: str, attachment_id: str
2078
+ ) -> GenieGetMessageQueryResultResponse:
2079
+ """[Deprecated] Get conversation message SQL query result.
2080
+
2081
+ Get the result of SQL query if the message has a query attachment. This is only available if a message
2082
+ has a query attachment and the message status is `EXECUTING_QUERY` OR `COMPLETED`.
2083
+
1754
2084
  :param space_id: str
1755
2085
  Genie space ID
1756
2086
  :param conversation_id: str
@@ -1759,48 +2089,73 @@ class GenieAPI:
1759
2089
  Message ID
1760
2090
  :param attachment_id: str
1761
2091
  Attachment ID
1762
-
2092
+
1763
2093
  :returns: :class:`GenieGetMessageQueryResultResponse`
1764
2094
  """
1765
2095
 
1766
- headers = {'Accept': 'application/json', }
2096
+ headers = {
2097
+ "Accept": "application/json",
2098
+ }
1767
2099
 
1768
2100
  res = self._api.do(
1769
- 'GET',
1770
- f'/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/query-result/{attachment_id}',
1771
- headers=headers)
2101
+ "GET",
2102
+ f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/query-result/{attachment_id}",
2103
+ headers=headers,
2104
+ )
1772
2105
  return GenieGetMessageQueryResultResponse.from_dict(res)
1773
2106
 
2107
+ def get_space(self, space_id: str) -> GenieSpace:
2108
+ """Get Genie Space.
2109
+
2110
+ Get details of a Genie Space.
2111
+
2112
+ :param space_id: str
2113
+ The ID associated with the Genie space
2114
+
2115
+ :returns: :class:`GenieSpace`
2116
+ """
2117
+
2118
+ headers = {
2119
+ "Accept": "application/json",
2120
+ }
2121
+
2122
+ res = self._api.do("GET", f"/api/2.0/genie/spaces/{space_id}", headers=headers)
2123
+ return GenieSpace.from_dict(res)
2124
+
1774
2125
  def start_conversation(self, space_id: str, content: str) -> Wait[GenieMessage]:
1775
2126
  """Start conversation.
1776
-
2127
+
1777
2128
  Start a new conversation.
1778
-
2129
+
1779
2130
  :param space_id: str
1780
2131
  The ID associated with the Genie space where you want to start a conversation.
1781
2132
  :param content: str
1782
2133
  The text of the message that starts the conversation.
1783
-
2134
+
1784
2135
  :returns:
1785
2136
  Long-running operation waiter for :class:`GenieMessage`.
1786
2137
  See :method:wait_get_message_genie_completed for more details.
1787
2138
  """
1788
2139
  body = {}
1789
- if content is not None: body['content'] = content
1790
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1791
-
1792
- op_response = self._api.do('POST',
1793
- f'/api/2.0/genie/spaces/{space_id}/start-conversation',
1794
- body=body,
1795
- headers=headers)
1796
- return Wait(self.wait_get_message_genie_completed,
1797
- response=GenieStartConversationResponse.from_dict(op_response),
1798
- conversation_id=op_response['conversation_id'],
1799
- message_id=op_response['message_id'],
1800
- space_id=space_id)
1801
-
1802
- def start_conversation_and_wait(self, space_id: str, content: str,
1803
- timeout=timedelta(minutes=20)) -> GenieMessage:
2140
+ if content is not None:
2141
+ body["content"] = content
2142
+ headers = {
2143
+ "Accept": "application/json",
2144
+ "Content-Type": "application/json",
2145
+ }
2146
+
2147
+ op_response = self._api.do(
2148
+ "POST", f"/api/2.0/genie/spaces/{space_id}/start-conversation", body=body, headers=headers
2149
+ )
2150
+ return Wait(
2151
+ self.wait_get_message_genie_completed,
2152
+ response=GenieStartConversationResponse.from_dict(op_response),
2153
+ conversation_id=op_response["conversation_id"],
2154
+ message_id=op_response["message_id"],
2155
+ space_id=space_id,
2156
+ )
2157
+
2158
+ def start_conversation_and_wait(self, space_id: str, content: str, timeout=timedelta(minutes=20)) -> GenieMessage:
1804
2159
  return self.start_conversation(content=content, space_id=space_id).result(timeout=timeout)
1805
2160
 
1806
2161
 
@@ -1813,65 +2168,70 @@ class LakeviewAPI:
1813
2168
 
1814
2169
  def create(self, *, dashboard: Optional[Dashboard] = None) -> Dashboard:
1815
2170
  """Create dashboard.
1816
-
2171
+
1817
2172
  Create a draft dashboard.
1818
-
2173
+
1819
2174
  :param dashboard: :class:`Dashboard` (optional)
1820
-
2175
+
1821
2176
  :returns: :class:`Dashboard`
1822
2177
  """
1823
2178
  body = dashboard.as_dict()
1824
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2179
+ headers = {
2180
+ "Accept": "application/json",
2181
+ "Content-Type": "application/json",
2182
+ }
1825
2183
 
1826
- res = self._api.do('POST', '/api/2.0/lakeview/dashboards', body=body, headers=headers)
2184
+ res = self._api.do("POST", "/api/2.0/lakeview/dashboards", body=body, headers=headers)
1827
2185
  return Dashboard.from_dict(res)
1828
2186
 
1829
2187
  def create_schedule(self, dashboard_id: str, *, schedule: Optional[Schedule] = None) -> Schedule:
1830
2188
  """Create dashboard schedule.
1831
-
2189
+
1832
2190
  :param dashboard_id: str
1833
2191
  UUID identifying the dashboard to which the schedule belongs.
1834
2192
  :param schedule: :class:`Schedule` (optional)
1835
-
2193
+
1836
2194
  :returns: :class:`Schedule`
1837
2195
  """
1838
2196
  body = schedule.as_dict()
1839
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2197
+ headers = {
2198
+ "Accept": "application/json",
2199
+ "Content-Type": "application/json",
2200
+ }
1840
2201
 
1841
- res = self._api.do('POST',
1842
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules',
1843
- body=body,
1844
- headers=headers)
2202
+ res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", body=body, headers=headers)
1845
2203
  return Schedule.from_dict(res)
1846
2204
 
1847
- def create_subscription(self,
1848
- dashboard_id: str,
1849
- schedule_id: str,
1850
- *,
1851
- subscription: Optional[Subscription] = None) -> Subscription:
2205
+ def create_subscription(
2206
+ self, dashboard_id: str, schedule_id: str, *, subscription: Optional[Subscription] = None
2207
+ ) -> Subscription:
1852
2208
  """Create schedule subscription.
1853
-
2209
+
1854
2210
  :param dashboard_id: str
1855
2211
  UUID identifying the dashboard to which the subscription belongs.
1856
2212
  :param schedule_id: str
1857
2213
  UUID identifying the schedule to which the subscription belongs.
1858
2214
  :param subscription: :class:`Subscription` (optional)
1859
-
2215
+
1860
2216
  :returns: :class:`Subscription`
1861
2217
  """
1862
2218
  body = subscription.as_dict()
1863
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2219
+ headers = {
2220
+ "Accept": "application/json",
2221
+ "Content-Type": "application/json",
2222
+ }
1864
2223
 
1865
2224
  res = self._api.do(
1866
- 'POST',
1867
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions',
2225
+ "POST",
2226
+ f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions",
1868
2227
  body=body,
1869
- headers=headers)
2228
+ headers=headers,
2229
+ )
1870
2230
  return Subscription.from_dict(res)
1871
2231
 
1872
2232
  def delete_schedule(self, dashboard_id: str, schedule_id: str, *, etag: Optional[str] = None):
1873
2233
  """Delete dashboard schedule.
1874
-
2234
+
1875
2235
  :param dashboard_id: str
1876
2236
  UUID identifying the dashboard to which the schedule belongs.
1877
2237
  :param schedule_id: str
@@ -1879,27 +2239,29 @@ class LakeviewAPI:
1879
2239
  :param etag: str (optional)
1880
2240
  The etag for the schedule. Optionally, it can be provided to verify that the schedule has not been
1881
2241
  modified from its last retrieval.
1882
-
1883
-
2242
+
2243
+
1884
2244
  """
1885
2245
 
1886
2246
  query = {}
1887
- if etag is not None: query['etag'] = etag
1888
- headers = {'Accept': 'application/json', }
1889
-
1890
- self._api.do('DELETE',
1891
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
1892
- query=query,
1893
- headers=headers)
1894
-
1895
- def delete_subscription(self,
1896
- dashboard_id: str,
1897
- schedule_id: str,
1898
- subscription_id: str,
1899
- *,
1900
- etag: Optional[str] = None):
2247
+ if etag is not None:
2248
+ query["etag"] = etag
2249
+ headers = {
2250
+ "Accept": "application/json",
2251
+ }
2252
+
2253
+ self._api.do(
2254
+ "DELETE",
2255
+ f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}",
2256
+ query=query,
2257
+ headers=headers,
2258
+ )
2259
+
2260
+ def delete_subscription(
2261
+ self, dashboard_id: str, schedule_id: str, subscription_id: str, *, etag: Optional[str] = None
2262
+ ):
1901
2263
  """Delete schedule subscription.
1902
-
2264
+
1903
2265
  :param dashboard_id: str
1904
2266
  UUID identifying the dashboard which the subscription belongs.
1905
2267
  :param schedule_id: str
@@ -1909,99 +2271,114 @@ class LakeviewAPI:
1909
2271
  :param etag: str (optional)
1910
2272
  The etag for the subscription. Can be optionally provided to ensure that the subscription has not
1911
2273
  been modified since the last read.
1912
-
1913
-
2274
+
2275
+
1914
2276
  """
1915
2277
 
1916
2278
  query = {}
1917
- if etag is not None: query['etag'] = etag
1918
- headers = {'Accept': 'application/json', }
2279
+ if etag is not None:
2280
+ query["etag"] = etag
2281
+ headers = {
2282
+ "Accept": "application/json",
2283
+ }
1919
2284
 
1920
2285
  self._api.do(
1921
- 'DELETE',
1922
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}',
2286
+ "DELETE",
2287
+ f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}",
1923
2288
  query=query,
1924
- headers=headers)
2289
+ headers=headers,
2290
+ )
1925
2291
 
1926
2292
  def get(self, dashboard_id: str) -> Dashboard:
1927
2293
  """Get dashboard.
1928
-
2294
+
1929
2295
  Get a draft dashboard.
1930
-
2296
+
1931
2297
  :param dashboard_id: str
1932
2298
  UUID identifying the dashboard.
1933
-
2299
+
1934
2300
  :returns: :class:`Dashboard`
1935
2301
  """
1936
2302
 
1937
- headers = {'Accept': 'application/json', }
2303
+ headers = {
2304
+ "Accept": "application/json",
2305
+ }
1938
2306
 
1939
- res = self._api.do('GET', f'/api/2.0/lakeview/dashboards/{dashboard_id}', headers=headers)
2307
+ res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers)
1940
2308
  return Dashboard.from_dict(res)
1941
2309
 
1942
2310
  def get_published(self, dashboard_id: str) -> PublishedDashboard:
1943
2311
  """Get published dashboard.
1944
-
2312
+
1945
2313
  Get the current published dashboard.
1946
-
2314
+
1947
2315
  :param dashboard_id: str
1948
2316
  UUID identifying the published dashboard.
1949
-
2317
+
1950
2318
  :returns: :class:`PublishedDashboard`
1951
2319
  """
1952
2320
 
1953
- headers = {'Accept': 'application/json', }
2321
+ headers = {
2322
+ "Accept": "application/json",
2323
+ }
1954
2324
 
1955
- res = self._api.do('GET', f'/api/2.0/lakeview/dashboards/{dashboard_id}/published', headers=headers)
2325
+ res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers)
1956
2326
  return PublishedDashboard.from_dict(res)
1957
2327
 
1958
2328
  def get_schedule(self, dashboard_id: str, schedule_id: str) -> Schedule:
1959
2329
  """Get dashboard schedule.
1960
-
2330
+
1961
2331
  :param dashboard_id: str
1962
2332
  UUID identifying the dashboard to which the schedule belongs.
1963
2333
  :param schedule_id: str
1964
2334
  UUID identifying the schedule.
1965
-
2335
+
1966
2336
  :returns: :class:`Schedule`
1967
2337
  """
1968
2338
 
1969
- headers = {'Accept': 'application/json', }
2339
+ headers = {
2340
+ "Accept": "application/json",
2341
+ }
1970
2342
 
1971
- res = self._api.do('GET',
1972
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
1973
- headers=headers)
2343
+ res = self._api.do(
2344
+ "GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", headers=headers
2345
+ )
1974
2346
  return Schedule.from_dict(res)
1975
2347
 
1976
2348
  def get_subscription(self, dashboard_id: str, schedule_id: str, subscription_id: str) -> Subscription:
1977
2349
  """Get schedule subscription.
1978
-
2350
+
1979
2351
  :param dashboard_id: str
1980
2352
  UUID identifying the dashboard which the subscription belongs.
1981
2353
  :param schedule_id: str
1982
2354
  UUID identifying the schedule which the subscription belongs.
1983
2355
  :param subscription_id: str
1984
2356
  UUID identifying the subscription.
1985
-
2357
+
1986
2358
  :returns: :class:`Subscription`
1987
2359
  """
1988
2360
 
1989
- headers = {'Accept': 'application/json', }
2361
+ headers = {
2362
+ "Accept": "application/json",
2363
+ }
1990
2364
 
1991
2365
  res = self._api.do(
1992
- 'GET',
1993
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}',
1994
- headers=headers)
2366
+ "GET",
2367
+ f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}",
2368
+ headers=headers,
2369
+ )
1995
2370
  return Subscription.from_dict(res)
1996
2371
 
1997
- def list(self,
1998
- *,
1999
- page_size: Optional[int] = None,
2000
- page_token: Optional[str] = None,
2001
- show_trashed: Optional[bool] = None,
2002
- view: Optional[DashboardView] = None) -> Iterator[Dashboard]:
2372
+ def list(
2373
+ self,
2374
+ *,
2375
+ page_size: Optional[int] = None,
2376
+ page_token: Optional[str] = None,
2377
+ show_trashed: Optional[bool] = None,
2378
+ view: Optional[DashboardView] = None,
2379
+ ) -> Iterator[Dashboard]:
2003
2380
  """List dashboards.
2004
-
2381
+
2005
2382
  :param page_size: int (optional)
2006
2383
  The number of dashboards to return per page.
2007
2384
  :param page_token: str (optional)
@@ -2012,33 +2389,37 @@ class LakeviewAPI:
2012
2389
  returned.
2013
2390
  :param view: :class:`DashboardView` (optional)
2014
2391
  `DASHBOARD_VIEW_BASIC`only includes summary metadata from the dashboard.
2015
-
2392
+
2016
2393
  :returns: Iterator over :class:`Dashboard`
2017
2394
  """
2018
2395
 
2019
2396
  query = {}
2020
- if page_size is not None: query['page_size'] = page_size
2021
- if page_token is not None: query['page_token'] = page_token
2022
- if show_trashed is not None: query['show_trashed'] = show_trashed
2023
- if view is not None: query['view'] = view.value
2024
- headers = {'Accept': 'application/json', }
2397
+ if page_size is not None:
2398
+ query["page_size"] = page_size
2399
+ if page_token is not None:
2400
+ query["page_token"] = page_token
2401
+ if show_trashed is not None:
2402
+ query["show_trashed"] = show_trashed
2403
+ if view is not None:
2404
+ query["view"] = view.value
2405
+ headers = {
2406
+ "Accept": "application/json",
2407
+ }
2025
2408
 
2026
2409
  while True:
2027
- json = self._api.do('GET', '/api/2.0/lakeview/dashboards', query=query, headers=headers)
2028
- if 'dashboards' in json:
2029
- for v in json['dashboards']:
2410
+ json = self._api.do("GET", "/api/2.0/lakeview/dashboards", query=query, headers=headers)
2411
+ if "dashboards" in json:
2412
+ for v in json["dashboards"]:
2030
2413
  yield Dashboard.from_dict(v)
2031
- if 'next_page_token' not in json or not json['next_page_token']:
2414
+ if "next_page_token" not in json or not json["next_page_token"]:
2032
2415
  return
2033
- query['page_token'] = json['next_page_token']
2416
+ query["page_token"] = json["next_page_token"]
2034
2417
 
2035
- def list_schedules(self,
2036
- dashboard_id: str,
2037
- *,
2038
- page_size: Optional[int] = None,
2039
- page_token: Optional[str] = None) -> Iterator[Schedule]:
2418
+ def list_schedules(
2419
+ self, dashboard_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None
2420
+ ) -> Iterator[Schedule]:
2040
2421
  """List dashboard schedules.
2041
-
2422
+
2042
2423
  :param dashboard_id: str
2043
2424
  UUID identifying the dashboard to which the schedules belongs.
2044
2425
  :param page_size: int (optional)
@@ -2046,35 +2427,35 @@ class LakeviewAPI:
2046
2427
  :param page_token: str (optional)
2047
2428
  A page token, received from a previous `ListSchedules` call. Use this to retrieve the subsequent
2048
2429
  page.
2049
-
2430
+
2050
2431
  :returns: Iterator over :class:`Schedule`
2051
2432
  """
2052
2433
 
2053
2434
  query = {}
2054
- if page_size is not None: query['page_size'] = page_size
2055
- if page_token is not None: query['page_token'] = page_token
2056
- headers = {'Accept': 'application/json', }
2435
+ if page_size is not None:
2436
+ query["page_size"] = page_size
2437
+ if page_token is not None:
2438
+ query["page_token"] = page_token
2439
+ headers = {
2440
+ "Accept": "application/json",
2441
+ }
2057
2442
 
2058
2443
  while True:
2059
- json = self._api.do('GET',
2060
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules',
2061
- query=query,
2062
- headers=headers)
2063
- if 'schedules' in json:
2064
- for v in json['schedules']:
2444
+ json = self._api.do(
2445
+ "GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", query=query, headers=headers
2446
+ )
2447
+ if "schedules" in json:
2448
+ for v in json["schedules"]:
2065
2449
  yield Schedule.from_dict(v)
2066
- if 'next_page_token' not in json or not json['next_page_token']:
2450
+ if "next_page_token" not in json or not json["next_page_token"]:
2067
2451
  return
2068
- query['page_token'] = json['next_page_token']
2069
-
2070
- def list_subscriptions(self,
2071
- dashboard_id: str,
2072
- schedule_id: str,
2073
- *,
2074
- page_size: Optional[int] = None,
2075
- page_token: Optional[str] = None) -> Iterator[Subscription]:
2452
+ query["page_token"] = json["next_page_token"]
2453
+
2454
+ def list_subscriptions(
2455
+ self, dashboard_id: str, schedule_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None
2456
+ ) -> Iterator[Subscription]:
2076
2457
  """List schedule subscriptions.
2077
-
2458
+
2078
2459
  :param dashboard_id: str
2079
2460
  UUID identifying the dashboard which the subscriptions belongs.
2080
2461
  :param schedule_id: str
@@ -2084,38 +2465,45 @@ class LakeviewAPI:
2084
2465
  :param page_token: str (optional)
2085
2466
  A page token, received from a previous `ListSubscriptions` call. Use this to retrieve the subsequent
2086
2467
  page.
2087
-
2468
+
2088
2469
  :returns: Iterator over :class:`Subscription`
2089
2470
  """
2090
2471
 
2091
2472
  query = {}
2092
- if page_size is not None: query['page_size'] = page_size
2093
- if page_token is not None: query['page_token'] = page_token
2094
- headers = {'Accept': 'application/json', }
2473
+ if page_size is not None:
2474
+ query["page_size"] = page_size
2475
+ if page_token is not None:
2476
+ query["page_token"] = page_token
2477
+ headers = {
2478
+ "Accept": "application/json",
2479
+ }
2095
2480
 
2096
2481
  while True:
2097
2482
  json = self._api.do(
2098
- 'GET',
2099
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions',
2483
+ "GET",
2484
+ f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions",
2100
2485
  query=query,
2101
- headers=headers)
2102
- if 'subscriptions' in json:
2103
- for v in json['subscriptions']:
2486
+ headers=headers,
2487
+ )
2488
+ if "subscriptions" in json:
2489
+ for v in json["subscriptions"]:
2104
2490
  yield Subscription.from_dict(v)
2105
- if 'next_page_token' not in json or not json['next_page_token']:
2491
+ if "next_page_token" not in json or not json["next_page_token"]:
2106
2492
  return
2107
- query['page_token'] = json['next_page_token']
2108
-
2109
- def migrate(self,
2110
- source_dashboard_id: str,
2111
- *,
2112
- display_name: Optional[str] = None,
2113
- parent_path: Optional[str] = None,
2114
- update_parameter_syntax: Optional[bool] = None) -> Dashboard:
2493
+ query["page_token"] = json["next_page_token"]
2494
+
2495
+ def migrate(
2496
+ self,
2497
+ source_dashboard_id: str,
2498
+ *,
2499
+ display_name: Optional[str] = None,
2500
+ parent_path: Optional[str] = None,
2501
+ update_parameter_syntax: Optional[bool] = None,
2502
+ ) -> Dashboard:
2115
2503
  """Migrate dashboard.
2116
-
2504
+
2117
2505
  Migrates a classic SQL dashboard to Lakeview.
2118
-
2506
+
2119
2507
  :param source_dashboard_id: str
2120
2508
  UUID of the dashboard to be migrated.
2121
2509
  :param display_name: str (optional)
@@ -2125,28 +2513,33 @@ class LakeviewAPI:
2125
2513
  :param update_parameter_syntax: bool (optional)
2126
2514
  Flag to indicate if mustache parameter syntax ({{ param }}) should be auto-updated to named syntax
2127
2515
  (:param) when converting datasets in the dashboard.
2128
-
2516
+
2129
2517
  :returns: :class:`Dashboard`
2130
2518
  """
2131
2519
  body = {}
2132
- if display_name is not None: body['display_name'] = display_name
2133
- if parent_path is not None: body['parent_path'] = parent_path
2134
- if source_dashboard_id is not None: body['source_dashboard_id'] = source_dashboard_id
2135
- if update_parameter_syntax is not None: body['update_parameter_syntax'] = update_parameter_syntax
2136
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2137
-
2138
- res = self._api.do('POST', '/api/2.0/lakeview/dashboards/migrate', body=body, headers=headers)
2520
+ if display_name is not None:
2521
+ body["display_name"] = display_name
2522
+ if parent_path is not None:
2523
+ body["parent_path"] = parent_path
2524
+ if source_dashboard_id is not None:
2525
+ body["source_dashboard_id"] = source_dashboard_id
2526
+ if update_parameter_syntax is not None:
2527
+ body["update_parameter_syntax"] = update_parameter_syntax
2528
+ headers = {
2529
+ "Accept": "application/json",
2530
+ "Content-Type": "application/json",
2531
+ }
2532
+
2533
+ res = self._api.do("POST", "/api/2.0/lakeview/dashboards/migrate", body=body, headers=headers)
2139
2534
  return Dashboard.from_dict(res)
2140
2535
 
2141
- def publish(self,
2142
- dashboard_id: str,
2143
- *,
2144
- embed_credentials: Optional[bool] = None,
2145
- warehouse_id: Optional[str] = None) -> PublishedDashboard:
2536
+ def publish(
2537
+ self, dashboard_id: str, *, embed_credentials: Optional[bool] = None, warehouse_id: Optional[str] = None
2538
+ ) -> PublishedDashboard:
2146
2539
  """Publish dashboard.
2147
-
2540
+
2148
2541
  Publish the current draft dashboard.
2149
-
2542
+
2150
2543
  :param dashboard_id: str
2151
2544
  UUID identifying the dashboard to be published.
2152
2545
  :param embed_credentials: bool (optional)
@@ -2154,92 +2547,96 @@ class LakeviewAPI:
2154
2547
  embedded credentials will be used to execute the published dashboard's queries.
2155
2548
  :param warehouse_id: str (optional)
2156
2549
  The ID of the warehouse that can be used to override the warehouse which was set in the draft.
2157
-
2550
+
2158
2551
  :returns: :class:`PublishedDashboard`
2159
2552
  """
2160
2553
  body = {}
2161
- if embed_credentials is not None: body['embed_credentials'] = embed_credentials
2162
- if warehouse_id is not None: body['warehouse_id'] = warehouse_id
2163
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2554
+ if embed_credentials is not None:
2555
+ body["embed_credentials"] = embed_credentials
2556
+ if warehouse_id is not None:
2557
+ body["warehouse_id"] = warehouse_id
2558
+ headers = {
2559
+ "Accept": "application/json",
2560
+ "Content-Type": "application/json",
2561
+ }
2164
2562
 
2165
- res = self._api.do('POST',
2166
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/published',
2167
- body=body,
2168
- headers=headers)
2563
+ res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", body=body, headers=headers)
2169
2564
  return PublishedDashboard.from_dict(res)
2170
2565
 
2171
2566
  def trash(self, dashboard_id: str):
2172
2567
  """Trash dashboard.
2173
-
2568
+
2174
2569
  Trash a dashboard.
2175
-
2570
+
2176
2571
  :param dashboard_id: str
2177
2572
  UUID identifying the dashboard.
2178
-
2179
-
2573
+
2574
+
2180
2575
  """
2181
2576
 
2182
- headers = {'Accept': 'application/json', }
2577
+ headers = {
2578
+ "Accept": "application/json",
2579
+ }
2183
2580
 
2184
- self._api.do('DELETE', f'/api/2.0/lakeview/dashboards/{dashboard_id}', headers=headers)
2581
+ self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers)
2185
2582
 
2186
2583
  def unpublish(self, dashboard_id: str):
2187
2584
  """Unpublish dashboard.
2188
-
2585
+
2189
2586
  Unpublish the dashboard.
2190
-
2587
+
2191
2588
  :param dashboard_id: str
2192
2589
  UUID identifying the published dashboard.
2193
-
2194
-
2590
+
2591
+
2195
2592
  """
2196
2593
 
2197
- headers = {'Accept': 'application/json', }
2594
+ headers = {
2595
+ "Accept": "application/json",
2596
+ }
2198
2597
 
2199
- self._api.do('DELETE', f'/api/2.0/lakeview/dashboards/{dashboard_id}/published', headers=headers)
2598
+ self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers)
2200
2599
 
2201
2600
  def update(self, dashboard_id: str, *, dashboard: Optional[Dashboard] = None) -> Dashboard:
2202
2601
  """Update dashboard.
2203
-
2602
+
2204
2603
  Update a draft dashboard.
2205
-
2604
+
2206
2605
  :param dashboard_id: str
2207
2606
  UUID identifying the dashboard.
2208
2607
  :param dashboard: :class:`Dashboard` (optional)
2209
-
2608
+
2210
2609
  :returns: :class:`Dashboard`
2211
2610
  """
2212
2611
  body = dashboard.as_dict()
2213
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2612
+ headers = {
2613
+ "Accept": "application/json",
2614
+ "Content-Type": "application/json",
2615
+ }
2214
2616
 
2215
- res = self._api.do('PATCH',
2216
- f'/api/2.0/lakeview/dashboards/{dashboard_id}',
2217
- body=body,
2218
- headers=headers)
2617
+ res = self._api.do("PATCH", f"/api/2.0/lakeview/dashboards/{dashboard_id}", body=body, headers=headers)
2219
2618
  return Dashboard.from_dict(res)
2220
2619
 
2221
- def update_schedule(self,
2222
- dashboard_id: str,
2223
- schedule_id: str,
2224
- *,
2225
- schedule: Optional[Schedule] = None) -> Schedule:
2620
+ def update_schedule(self, dashboard_id: str, schedule_id: str, *, schedule: Optional[Schedule] = None) -> Schedule:
2226
2621
  """Update dashboard schedule.
2227
-
2622
+
2228
2623
  :param dashboard_id: str
2229
2624
  UUID identifying the dashboard to which the schedule belongs.
2230
2625
  :param schedule_id: str
2231
2626
  UUID identifying the schedule.
2232
2627
  :param schedule: :class:`Schedule` (optional)
2233
-
2628
+
2234
2629
  :returns: :class:`Schedule`
2235
2630
  """
2236
2631
  body = schedule.as_dict()
2237
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2632
+ headers = {
2633
+ "Accept": "application/json",
2634
+ "Content-Type": "application/json",
2635
+ }
2238
2636
 
2239
- res = self._api.do('PUT',
2240
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
2241
- body=body,
2242
- headers=headers)
2637
+ res = self._api.do(
2638
+ "PUT", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", body=body, headers=headers
2639
+ )
2243
2640
  return Schedule.from_dict(res)
2244
2641
 
2245
2642
 
@@ -2251,20 +2648,20 @@ class LakeviewEmbeddedAPI:
2251
2648
 
2252
2649
  def get_published_dashboard_embedded(self, dashboard_id: str):
2253
2650
  """Read a published dashboard in an embedded ui.
2254
-
2651
+
2255
2652
  Get the current published dashboard within an embedded context.
2256
-
2653
+
2257
2654
  :param dashboard_id: str
2258
2655
  UUID identifying the published dashboard.
2259
-
2260
-
2656
+
2657
+
2261
2658
  """
2262
2659
 
2263
- headers = {'Accept': 'application/json', }
2660
+ headers = {
2661
+ "Accept": "application/json",
2662
+ }
2264
2663
 
2265
- self._api.do('GET',
2266
- f'/api/2.0/lakeview/dashboards/{dashboard_id}/published/embedded',
2267
- headers=headers)
2664
+ self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published/embedded", headers=headers)
2268
2665
 
2269
2666
 
2270
2667
  class QueryExecutionAPI:
@@ -2273,37 +2670,38 @@ class QueryExecutionAPI:
2273
2670
  def __init__(self, api_client):
2274
2671
  self._api = api_client
2275
2672
 
2276
- def cancel_published_query_execution(self,
2277
- dashboard_name: str,
2278
- dashboard_revision_id: str,
2279
- *,
2280
- tokens: Optional[List[str]] = None) -> CancelQueryExecutionResponse:
2673
+ def cancel_published_query_execution(
2674
+ self, dashboard_name: str, dashboard_revision_id: str, *, tokens: Optional[List[str]] = None
2675
+ ) -> CancelQueryExecutionResponse:
2281
2676
  """Cancel the results for the a query for a published, embedded dashboard.
2282
-
2677
+
2283
2678
  :param dashboard_name: str
2284
2679
  :param dashboard_revision_id: str
2285
2680
  :param tokens: List[str] (optional)
2286
2681
  Example: EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ
2287
-
2682
+
2288
2683
  :returns: :class:`CancelQueryExecutionResponse`
2289
2684
  """
2290
2685
 
2291
2686
  query = {}
2292
- if dashboard_name is not None: query['dashboard_name'] = dashboard_name
2293
- if dashboard_revision_id is not None: query['dashboard_revision_id'] = dashboard_revision_id
2294
- if tokens is not None: query['tokens'] = [v for v in tokens]
2295
- headers = {'Accept': 'application/json', }
2296
-
2297
- res = self._api.do('DELETE', '/api/2.0/lakeview-query/query/published', query=query, headers=headers)
2687
+ if dashboard_name is not None:
2688
+ query["dashboard_name"] = dashboard_name
2689
+ if dashboard_revision_id is not None:
2690
+ query["dashboard_revision_id"] = dashboard_revision_id
2691
+ if tokens is not None:
2692
+ query["tokens"] = [v for v in tokens]
2693
+ headers = {
2694
+ "Accept": "application/json",
2695
+ }
2696
+
2697
+ res = self._api.do("DELETE", "/api/2.0/lakeview-query/query/published", query=query, headers=headers)
2298
2698
  return CancelQueryExecutionResponse.from_dict(res)
2299
2699
 
2300
- def execute_published_dashboard_query(self,
2301
- dashboard_name: str,
2302
- dashboard_revision_id: str,
2303
- *,
2304
- override_warehouse_id: Optional[str] = None):
2700
+ def execute_published_dashboard_query(
2701
+ self, dashboard_name: str, dashboard_revision_id: str, *, override_warehouse_id: Optional[str] = None
2702
+ ):
2305
2703
  """Execute a query for a published dashboard.
2306
-
2704
+
2307
2705
  :param dashboard_name: str
2308
2706
  Dashboard name and revision_id is required to retrieve PublishedDatasetDataModel which contains the
2309
2707
  list of datasets, warehouse_id, and embedded_credentials
@@ -2311,37 +2709,46 @@ class QueryExecutionAPI:
2311
2709
  :param override_warehouse_id: str (optional)
2312
2710
  A dashboard schedule can override the warehouse used as compute for processing the published
2313
2711
  dashboard queries
2314
-
2315
-
2316
- """
2317
- body = {}
2318
- if dashboard_name is not None: body['dashboard_name'] = dashboard_name
2319
- if dashboard_revision_id is not None: body['dashboard_revision_id'] = dashboard_revision_id
2320
- if override_warehouse_id is not None: body['override_warehouse_id'] = override_warehouse_id
2321
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2322
2712
 
2323
- self._api.do('POST', '/api/2.0/lakeview-query/query/published', body=body, headers=headers)
2324
2713
 
2325
- def poll_published_query_status(self,
2326
- dashboard_name: str,
2327
- dashboard_revision_id: str,
2328
- *,
2329
- tokens: Optional[List[str]] = None) -> PollQueryStatusResponse:
2714
+ """
2715
+ body = {}
2716
+ if dashboard_name is not None:
2717
+ body["dashboard_name"] = dashboard_name
2718
+ if dashboard_revision_id is not None:
2719
+ body["dashboard_revision_id"] = dashboard_revision_id
2720
+ if override_warehouse_id is not None:
2721
+ body["override_warehouse_id"] = override_warehouse_id
2722
+ headers = {
2723
+ "Accept": "application/json",
2724
+ "Content-Type": "application/json",
2725
+ }
2726
+
2727
+ self._api.do("POST", "/api/2.0/lakeview-query/query/published", body=body, headers=headers)
2728
+
2729
+ def poll_published_query_status(
2730
+ self, dashboard_name: str, dashboard_revision_id: str, *, tokens: Optional[List[str]] = None
2731
+ ) -> PollQueryStatusResponse:
2330
2732
  """Poll the results for the a query for a published, embedded dashboard.
2331
-
2733
+
2332
2734
  :param dashboard_name: str
2333
2735
  :param dashboard_revision_id: str
2334
2736
  :param tokens: List[str] (optional)
2335
2737
  Example: EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ
2336
-
2738
+
2337
2739
  :returns: :class:`PollQueryStatusResponse`
2338
2740
  """
2339
2741
 
2340
2742
  query = {}
2341
- if dashboard_name is not None: query['dashboard_name'] = dashboard_name
2342
- if dashboard_revision_id is not None: query['dashboard_revision_id'] = dashboard_revision_id
2343
- if tokens is not None: query['tokens'] = [v for v in tokens]
2344
- headers = {'Accept': 'application/json', }
2345
-
2346
- res = self._api.do('GET', '/api/2.0/lakeview-query/query/published', query=query, headers=headers)
2743
+ if dashboard_name is not None:
2744
+ query["dashboard_name"] = dashboard_name
2745
+ if dashboard_revision_id is not None:
2746
+ query["dashboard_revision_id"] = dashboard_revision_id
2747
+ if tokens is not None:
2748
+ query["tokens"] = [v for v in tokens]
2749
+ headers = {
2750
+ "Accept": "application/json",
2751
+ }
2752
+
2753
+ res = self._api.do("GET", "/api/2.0/lakeview-query/query/published", query=query, headers=headers)
2347
2754
  return PollQueryStatusResponse.from_dict(res)