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