databricks-sdk 0.41.0__py3-none-any.whl → 0.43.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 +33 -5
- databricks/sdk/_base_client.py +20 -21
- databricks/sdk/credentials_provider.py +12 -6
- databricks/sdk/mixins/open_ai_client.py +25 -10
- databricks/sdk/retries.py +5 -1
- databricks/sdk/service/billing.py +348 -0
- databricks/sdk/service/catalog.py +33 -63
- databricks/sdk/service/cleanrooms.py +74 -3
- databricks/sdk/service/compute.py +36 -0
- databricks/sdk/service/dashboards.py +415 -0
- databricks/sdk/service/jobs.py +92 -1
- databricks/sdk/service/oauth2.py +41 -5
- databricks/sdk/service/serving.py +34 -40
- databricks/sdk/service/settings.py +454 -78
- databricks/sdk/service/sql.py +145 -18
- databricks/sdk/useragent.py +54 -0
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/METADATA +1 -1
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/RECORD +23 -23
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.41.0.dist-info → databricks_sdk-0.43.0.dist-info}/top_level.txt +0 -0
|
@@ -289,11 +289,24 @@ class CleanRoomAssetNotebook:
|
|
|
289
289
|
"""Base 64 representation of the notebook contents. This is the same format as returned by
|
|
290
290
|
:method:workspace/export with the format of **HTML**."""
|
|
291
291
|
|
|
292
|
+
review_state: Optional[CleanRoomNotebookReviewNotebookReviewState] = None
|
|
293
|
+
"""top-level status derived from all reviews"""
|
|
294
|
+
|
|
295
|
+
reviews: Optional[List[CleanRoomNotebookReview]] = None
|
|
296
|
+
"""All existing approvals or rejections"""
|
|
297
|
+
|
|
298
|
+
runner_collaborators: Optional[List[CleanRoomCollaborator]] = None
|
|
299
|
+
"""collaborators that can run the notebook"""
|
|
300
|
+
|
|
292
301
|
def as_dict(self) -> dict:
|
|
293
302
|
"""Serializes the CleanRoomAssetNotebook into a dictionary suitable for use as a JSON request body."""
|
|
294
303
|
body = {}
|
|
295
304
|
if self.etag is not None: body['etag'] = self.etag
|
|
296
305
|
if self.notebook_content is not None: body['notebook_content'] = self.notebook_content
|
|
306
|
+
if self.review_state is not None: body['review_state'] = self.review_state.value
|
|
307
|
+
if self.reviews: body['reviews'] = [v.as_dict() for v in self.reviews]
|
|
308
|
+
if self.runner_collaborators:
|
|
309
|
+
body['runner_collaborators'] = [v.as_dict() for v in self.runner_collaborators]
|
|
297
310
|
return body
|
|
298
311
|
|
|
299
312
|
def as_shallow_dict(self) -> dict:
|
|
@@ -301,12 +314,19 @@ class CleanRoomAssetNotebook:
|
|
|
301
314
|
body = {}
|
|
302
315
|
if self.etag is not None: body['etag'] = self.etag
|
|
303
316
|
if self.notebook_content is not None: body['notebook_content'] = self.notebook_content
|
|
317
|
+
if self.review_state is not None: body['review_state'] = self.review_state
|
|
318
|
+
if self.reviews: body['reviews'] = self.reviews
|
|
319
|
+
if self.runner_collaborators: body['runner_collaborators'] = self.runner_collaborators
|
|
304
320
|
return body
|
|
305
321
|
|
|
306
322
|
@classmethod
|
|
307
323
|
def from_dict(cls, d: Dict[str, any]) -> CleanRoomAssetNotebook:
|
|
308
324
|
"""Deserializes the CleanRoomAssetNotebook from a dictionary."""
|
|
309
|
-
return cls(etag=d.get('etag', None),
|
|
325
|
+
return cls(etag=d.get('etag', None),
|
|
326
|
+
notebook_content=d.get('notebook_content', None),
|
|
327
|
+
review_state=_enum(d, 'review_state', CleanRoomNotebookReviewNotebookReviewState),
|
|
328
|
+
reviews=_repeated_dict(d, 'reviews', CleanRoomNotebookReview),
|
|
329
|
+
runner_collaborators=_repeated_dict(d, 'runner_collaborators', CleanRoomCollaborator))
|
|
310
330
|
|
|
311
331
|
|
|
312
332
|
class CleanRoomAssetStatusEnum(Enum):
|
|
@@ -511,6 +531,56 @@ class CleanRoomCollaborator:
|
|
|
511
531
|
organization_name=d.get('organization_name', None))
|
|
512
532
|
|
|
513
533
|
|
|
534
|
+
@dataclass
|
|
535
|
+
class CleanRoomNotebookReview:
|
|
536
|
+
comment: Optional[str] = None
|
|
537
|
+
"""review comment"""
|
|
538
|
+
|
|
539
|
+
created_at_millis: Optional[int] = None
|
|
540
|
+
"""timestamp of when the review was submitted"""
|
|
541
|
+
|
|
542
|
+
review_state: Optional[CleanRoomNotebookReviewNotebookReviewState] = None
|
|
543
|
+
"""review outcome"""
|
|
544
|
+
|
|
545
|
+
reviewer_collaborator_alias: Optional[str] = None
|
|
546
|
+
"""collaborator alias of the reviewer"""
|
|
547
|
+
|
|
548
|
+
def as_dict(self) -> dict:
|
|
549
|
+
"""Serializes the CleanRoomNotebookReview into a dictionary suitable for use as a JSON request body."""
|
|
550
|
+
body = {}
|
|
551
|
+
if self.comment is not None: body['comment'] = self.comment
|
|
552
|
+
if self.created_at_millis is not None: body['created_at_millis'] = self.created_at_millis
|
|
553
|
+
if self.review_state is not None: body['review_state'] = self.review_state.value
|
|
554
|
+
if self.reviewer_collaborator_alias is not None:
|
|
555
|
+
body['reviewer_collaborator_alias'] = self.reviewer_collaborator_alias
|
|
556
|
+
return body
|
|
557
|
+
|
|
558
|
+
def as_shallow_dict(self) -> dict:
|
|
559
|
+
"""Serializes the CleanRoomNotebookReview into a shallow dictionary of its immediate attributes."""
|
|
560
|
+
body = {}
|
|
561
|
+
if self.comment is not None: body['comment'] = self.comment
|
|
562
|
+
if self.created_at_millis is not None: body['created_at_millis'] = self.created_at_millis
|
|
563
|
+
if self.review_state is not None: body['review_state'] = self.review_state
|
|
564
|
+
if self.reviewer_collaborator_alias is not None:
|
|
565
|
+
body['reviewer_collaborator_alias'] = self.reviewer_collaborator_alias
|
|
566
|
+
return body
|
|
567
|
+
|
|
568
|
+
@classmethod
|
|
569
|
+
def from_dict(cls, d: Dict[str, any]) -> CleanRoomNotebookReview:
|
|
570
|
+
"""Deserializes the CleanRoomNotebookReview from a dictionary."""
|
|
571
|
+
return cls(comment=d.get('comment', None),
|
|
572
|
+
created_at_millis=d.get('created_at_millis', None),
|
|
573
|
+
review_state=_enum(d, 'review_state', CleanRoomNotebookReviewNotebookReviewState),
|
|
574
|
+
reviewer_collaborator_alias=d.get('reviewer_collaborator_alias', None))
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
class CleanRoomNotebookReviewNotebookReviewState(Enum):
|
|
578
|
+
|
|
579
|
+
APPROVED = 'APPROVED'
|
|
580
|
+
PENDING = 'PENDING'
|
|
581
|
+
REJECTED = 'REJECTED'
|
|
582
|
+
|
|
583
|
+
|
|
514
584
|
@dataclass
|
|
515
585
|
class CleanRoomNotebookTaskRun:
|
|
516
586
|
"""Stores information about a single task run."""
|
|
@@ -1158,8 +1228,9 @@ class CleanRoomsAPI:
|
|
|
1158
1228
|
|
|
1159
1229
|
Create a new clean room with the specified collaborators. This method is asynchronous; the returned
|
|
1160
1230
|
name field inside the clean_room field can be used to poll the clean room status, using the
|
|
1161
|
-
:method:cleanrooms/get method. When this method returns, the
|
|
1162
|
-
|
|
1231
|
+
:method:cleanrooms/get method. When this method returns, the clean room will be in a PROVISIONING
|
|
1232
|
+
state, with only name, owner, comment, created_at and status populated. The clean room will be usable
|
|
1233
|
+
once it enters an ACTIVE state.
|
|
1163
1234
|
|
|
1164
1235
|
The caller must be a metastore admin or have the **CREATE_CLEAN_ROOM** privilege on the metastore.
|
|
1165
1236
|
|
|
@@ -2937,6 +2937,42 @@ class Created:
|
|
|
2937
2937
|
return cls(id=d.get('id', None))
|
|
2938
2938
|
|
|
2939
2939
|
|
|
2940
|
+
@dataclass
|
|
2941
|
+
class CustomPolicyTag:
|
|
2942
|
+
key: str
|
|
2943
|
+
"""The key of the tag. - Must be unique among all custom tags of the same policy - Cannot be
|
|
2944
|
+
“budget-policy-name”, “budget-policy-id” or "budget-policy-resolution-result" - these
|
|
2945
|
+
tags are preserved.
|
|
2946
|
+
|
|
2947
|
+
- Follows the regex pattern defined in cluster-common/conf/src/ClusterTagConstraints.scala
|
|
2948
|
+
(https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L17)"""
|
|
2949
|
+
|
|
2950
|
+
value: Optional[str] = None
|
|
2951
|
+
"""The value of the tag.
|
|
2952
|
+
|
|
2953
|
+
- Follows the regex pattern defined in cluster-common/conf/src/ClusterTagConstraints.scala
|
|
2954
|
+
(https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L24)"""
|
|
2955
|
+
|
|
2956
|
+
def as_dict(self) -> dict:
|
|
2957
|
+
"""Serializes the CustomPolicyTag into a dictionary suitable for use as a JSON request body."""
|
|
2958
|
+
body = {}
|
|
2959
|
+
if self.key is not None: body['key'] = self.key
|
|
2960
|
+
if self.value is not None: body['value'] = self.value
|
|
2961
|
+
return body
|
|
2962
|
+
|
|
2963
|
+
def as_shallow_dict(self) -> dict:
|
|
2964
|
+
"""Serializes the CustomPolicyTag into a shallow dictionary of its immediate attributes."""
|
|
2965
|
+
body = {}
|
|
2966
|
+
if self.key is not None: body['key'] = self.key
|
|
2967
|
+
if self.value is not None: body['value'] = self.value
|
|
2968
|
+
return body
|
|
2969
|
+
|
|
2970
|
+
@classmethod
|
|
2971
|
+
def from_dict(cls, d: Dict[str, any]) -> CustomPolicyTag:
|
|
2972
|
+
"""Deserializes the CustomPolicyTag from a dictionary."""
|
|
2973
|
+
return cls(key=d.get('key', None), value=d.get('value', None))
|
|
2974
|
+
|
|
2975
|
+
|
|
2940
2976
|
@dataclass
|
|
2941
2977
|
class DataPlaneEventDetails:
|
|
2942
2978
|
event_type: Optional[DataPlaneEventDetailsEventType] = None
|
|
@@ -20,6 +20,66 @@ from databricks.sdk.service import sql
|
|
|
20
20
|
# all definitions in this file are in alphabetical order
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
@dataclass
|
|
24
|
+
class CancelQueryExecutionResponse:
|
|
25
|
+
status: Optional[List[CancelQueryExecutionResponseStatus]] = None
|
|
26
|
+
|
|
27
|
+
def as_dict(self) -> dict:
|
|
28
|
+
"""Serializes the CancelQueryExecutionResponse into a dictionary suitable for use as a JSON request body."""
|
|
29
|
+
body = {}
|
|
30
|
+
if self.status: body['status'] = [v.as_dict() for v in self.status]
|
|
31
|
+
return body
|
|
32
|
+
|
|
33
|
+
def as_shallow_dict(self) -> dict:
|
|
34
|
+
"""Serializes the CancelQueryExecutionResponse into a shallow dictionary of its immediate attributes."""
|
|
35
|
+
body = {}
|
|
36
|
+
if self.status: body['status'] = self.status
|
|
37
|
+
return body
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_dict(cls, d: Dict[str, any]) -> CancelQueryExecutionResponse:
|
|
41
|
+
"""Deserializes the CancelQueryExecutionResponse from a dictionary."""
|
|
42
|
+
return cls(status=_repeated_dict(d, 'status', CancelQueryExecutionResponseStatus))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class CancelQueryExecutionResponseStatus:
|
|
47
|
+
data_token: str
|
|
48
|
+
"""The token to poll for result asynchronously Example:
|
|
49
|
+
EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ"""
|
|
50
|
+
|
|
51
|
+
pending: Optional[Empty] = None
|
|
52
|
+
"""Represents an empty message, similar to google.protobuf.Empty, which is not available in the
|
|
53
|
+
firm right now."""
|
|
54
|
+
|
|
55
|
+
success: Optional[Empty] = None
|
|
56
|
+
"""Represents an empty message, similar to google.protobuf.Empty, which is not available in the
|
|
57
|
+
firm right now."""
|
|
58
|
+
|
|
59
|
+
def as_dict(self) -> dict:
|
|
60
|
+
"""Serializes the CancelQueryExecutionResponseStatus into a dictionary suitable for use as a JSON request body."""
|
|
61
|
+
body = {}
|
|
62
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
63
|
+
if self.pending: body['pending'] = self.pending.as_dict()
|
|
64
|
+
if self.success: body['success'] = self.success.as_dict()
|
|
65
|
+
return body
|
|
66
|
+
|
|
67
|
+
def as_shallow_dict(self) -> dict:
|
|
68
|
+
"""Serializes the CancelQueryExecutionResponseStatus into a shallow dictionary of its immediate attributes."""
|
|
69
|
+
body = {}
|
|
70
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
71
|
+
if self.pending: body['pending'] = self.pending
|
|
72
|
+
if self.success: body['success'] = self.success
|
|
73
|
+
return body
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, d: Dict[str, any]) -> CancelQueryExecutionResponseStatus:
|
|
77
|
+
"""Deserializes the CancelQueryExecutionResponseStatus from a dictionary."""
|
|
78
|
+
return cls(data_token=d.get('data_token', None),
|
|
79
|
+
pending=_from_dict(d, 'pending', Empty),
|
|
80
|
+
success=_from_dict(d, 'success', Empty))
|
|
81
|
+
|
|
82
|
+
|
|
23
83
|
@dataclass
|
|
24
84
|
class CronSchedule:
|
|
25
85
|
quartz_cron_expression: str
|
|
@@ -207,6 +267,87 @@ class DeleteSubscriptionResponse:
|
|
|
207
267
|
return cls()
|
|
208
268
|
|
|
209
269
|
|
|
270
|
+
@dataclass
|
|
271
|
+
class Empty:
|
|
272
|
+
"""Represents an empty message, similar to google.protobuf.Empty, which is not available in the
|
|
273
|
+
firm right now."""
|
|
274
|
+
|
|
275
|
+
def as_dict(self) -> dict:
|
|
276
|
+
"""Serializes the Empty into a dictionary suitable for use as a JSON request body."""
|
|
277
|
+
body = {}
|
|
278
|
+
return body
|
|
279
|
+
|
|
280
|
+
def as_shallow_dict(self) -> dict:
|
|
281
|
+
"""Serializes the Empty into a shallow dictionary of its immediate attributes."""
|
|
282
|
+
body = {}
|
|
283
|
+
return body
|
|
284
|
+
|
|
285
|
+
@classmethod
|
|
286
|
+
def from_dict(cls, d: Dict[str, any]) -> Empty:
|
|
287
|
+
"""Deserializes the Empty from a dictionary."""
|
|
288
|
+
return cls()
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
@dataclass
|
|
292
|
+
class ExecutePublishedDashboardQueryRequest:
|
|
293
|
+
"""Execute query request for published Dashboards. Since published dashboards have the option of
|
|
294
|
+
running as the publisher, the datasets, warehouse_id are excluded from the request and instead
|
|
295
|
+
read from the source (lakeview-config) via the additional parameters (dashboardName and
|
|
296
|
+
dashboardRevisionId)"""
|
|
297
|
+
|
|
298
|
+
dashboard_name: str
|
|
299
|
+
"""Dashboard name and revision_id is required to retrieve PublishedDatasetDataModel which contains
|
|
300
|
+
the list of datasets, warehouse_id, and embedded_credentials"""
|
|
301
|
+
|
|
302
|
+
dashboard_revision_id: str
|
|
303
|
+
|
|
304
|
+
override_warehouse_id: Optional[str] = None
|
|
305
|
+
"""A dashboard schedule can override the warehouse used as compute for processing the published
|
|
306
|
+
dashboard queries"""
|
|
307
|
+
|
|
308
|
+
def as_dict(self) -> dict:
|
|
309
|
+
"""Serializes the ExecutePublishedDashboardQueryRequest into a dictionary suitable for use as a JSON request body."""
|
|
310
|
+
body = {}
|
|
311
|
+
if self.dashboard_name is not None: body['dashboard_name'] = self.dashboard_name
|
|
312
|
+
if self.dashboard_revision_id is not None: body['dashboard_revision_id'] = self.dashboard_revision_id
|
|
313
|
+
if self.override_warehouse_id is not None: body['override_warehouse_id'] = self.override_warehouse_id
|
|
314
|
+
return body
|
|
315
|
+
|
|
316
|
+
def as_shallow_dict(self) -> dict:
|
|
317
|
+
"""Serializes the ExecutePublishedDashboardQueryRequest into a shallow dictionary of its immediate attributes."""
|
|
318
|
+
body = {}
|
|
319
|
+
if self.dashboard_name is not None: body['dashboard_name'] = self.dashboard_name
|
|
320
|
+
if self.dashboard_revision_id is not None: body['dashboard_revision_id'] = self.dashboard_revision_id
|
|
321
|
+
if self.override_warehouse_id is not None: body['override_warehouse_id'] = self.override_warehouse_id
|
|
322
|
+
return body
|
|
323
|
+
|
|
324
|
+
@classmethod
|
|
325
|
+
def from_dict(cls, d: Dict[str, any]) -> ExecutePublishedDashboardQueryRequest:
|
|
326
|
+
"""Deserializes the ExecutePublishedDashboardQueryRequest from a dictionary."""
|
|
327
|
+
return cls(dashboard_name=d.get('dashboard_name', None),
|
|
328
|
+
dashboard_revision_id=d.get('dashboard_revision_id', None),
|
|
329
|
+
override_warehouse_id=d.get('override_warehouse_id', None))
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@dataclass
|
|
333
|
+
class ExecuteQueryResponse:
|
|
334
|
+
|
|
335
|
+
def as_dict(self) -> dict:
|
|
336
|
+
"""Serializes the ExecuteQueryResponse into a dictionary suitable for use as a JSON request body."""
|
|
337
|
+
body = {}
|
|
338
|
+
return body
|
|
339
|
+
|
|
340
|
+
def as_shallow_dict(self) -> dict:
|
|
341
|
+
"""Serializes the ExecuteQueryResponse into a shallow dictionary of its immediate attributes."""
|
|
342
|
+
body = {}
|
|
343
|
+
return body
|
|
344
|
+
|
|
345
|
+
@classmethod
|
|
346
|
+
def from_dict(cls, d: Dict[str, any]) -> ExecuteQueryResponse:
|
|
347
|
+
"""Deserializes the ExecuteQueryResponse from a dictionary."""
|
|
348
|
+
return cls()
|
|
349
|
+
|
|
350
|
+
|
|
210
351
|
@dataclass
|
|
211
352
|
class GenieAttachment:
|
|
212
353
|
"""Genie AI Response"""
|
|
@@ -513,6 +654,25 @@ class GenieStartConversationResponse:
|
|
|
513
654
|
message_id=d.get('message_id', None))
|
|
514
655
|
|
|
515
656
|
|
|
657
|
+
@dataclass
|
|
658
|
+
class GetPublishedDashboardEmbeddedResponse:
|
|
659
|
+
|
|
660
|
+
def as_dict(self) -> dict:
|
|
661
|
+
"""Serializes the GetPublishedDashboardEmbeddedResponse into a dictionary suitable for use as a JSON request body."""
|
|
662
|
+
body = {}
|
|
663
|
+
return body
|
|
664
|
+
|
|
665
|
+
def as_shallow_dict(self) -> dict:
|
|
666
|
+
"""Serializes the GetPublishedDashboardEmbeddedResponse into a shallow dictionary of its immediate attributes."""
|
|
667
|
+
body = {}
|
|
668
|
+
return body
|
|
669
|
+
|
|
670
|
+
@classmethod
|
|
671
|
+
def from_dict(cls, d: Dict[str, any]) -> GetPublishedDashboardEmbeddedResponse:
|
|
672
|
+
"""Deserializes the GetPublishedDashboardEmbeddedResponse from a dictionary."""
|
|
673
|
+
return cls()
|
|
674
|
+
|
|
675
|
+
|
|
516
676
|
class LifecycleState(Enum):
|
|
517
677
|
|
|
518
678
|
ACTIVE = 'ACTIVE'
|
|
@@ -747,6 +907,74 @@ class MigrateDashboardRequest:
|
|
|
747
907
|
update_parameter_syntax=d.get('update_parameter_syntax', None))
|
|
748
908
|
|
|
749
909
|
|
|
910
|
+
@dataclass
|
|
911
|
+
class PendingStatus:
|
|
912
|
+
data_token: str
|
|
913
|
+
"""The token to poll for result asynchronously Example:
|
|
914
|
+
EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ"""
|
|
915
|
+
|
|
916
|
+
def as_dict(self) -> dict:
|
|
917
|
+
"""Serializes the PendingStatus into a dictionary suitable for use as a JSON request body."""
|
|
918
|
+
body = {}
|
|
919
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
920
|
+
return body
|
|
921
|
+
|
|
922
|
+
def as_shallow_dict(self) -> dict:
|
|
923
|
+
"""Serializes the PendingStatus into a shallow dictionary of its immediate attributes."""
|
|
924
|
+
body = {}
|
|
925
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
926
|
+
return body
|
|
927
|
+
|
|
928
|
+
@classmethod
|
|
929
|
+
def from_dict(cls, d: Dict[str, any]) -> PendingStatus:
|
|
930
|
+
"""Deserializes the PendingStatus from a dictionary."""
|
|
931
|
+
return cls(data_token=d.get('data_token', None))
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
@dataclass
|
|
935
|
+
class PollQueryStatusResponse:
|
|
936
|
+
data: Optional[List[PollQueryStatusResponseData]] = None
|
|
937
|
+
|
|
938
|
+
def as_dict(self) -> dict:
|
|
939
|
+
"""Serializes the PollQueryStatusResponse into a dictionary suitable for use as a JSON request body."""
|
|
940
|
+
body = {}
|
|
941
|
+
if self.data: body['data'] = [v.as_dict() for v in self.data]
|
|
942
|
+
return body
|
|
943
|
+
|
|
944
|
+
def as_shallow_dict(self) -> dict:
|
|
945
|
+
"""Serializes the PollQueryStatusResponse into a shallow dictionary of its immediate attributes."""
|
|
946
|
+
body = {}
|
|
947
|
+
if self.data: body['data'] = self.data
|
|
948
|
+
return body
|
|
949
|
+
|
|
950
|
+
@classmethod
|
|
951
|
+
def from_dict(cls, d: Dict[str, any]) -> PollQueryStatusResponse:
|
|
952
|
+
"""Deserializes the PollQueryStatusResponse from a dictionary."""
|
|
953
|
+
return cls(data=_repeated_dict(d, 'data', PollQueryStatusResponseData))
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
@dataclass
|
|
957
|
+
class PollQueryStatusResponseData:
|
|
958
|
+
status: QueryResponseStatus
|
|
959
|
+
|
|
960
|
+
def as_dict(self) -> dict:
|
|
961
|
+
"""Serializes the PollQueryStatusResponseData into a dictionary suitable for use as a JSON request body."""
|
|
962
|
+
body = {}
|
|
963
|
+
if self.status: body['status'] = self.status.as_dict()
|
|
964
|
+
return body
|
|
965
|
+
|
|
966
|
+
def as_shallow_dict(self) -> dict:
|
|
967
|
+
"""Serializes the PollQueryStatusResponseData into a shallow dictionary of its immediate attributes."""
|
|
968
|
+
body = {}
|
|
969
|
+
if self.status: body['status'] = self.status
|
|
970
|
+
return body
|
|
971
|
+
|
|
972
|
+
@classmethod
|
|
973
|
+
def from_dict(cls, d: Dict[str, any]) -> PollQueryStatusResponseData:
|
|
974
|
+
"""Deserializes the PollQueryStatusResponseData from a dictionary."""
|
|
975
|
+
return cls(status=_from_dict(d, 'status', QueryResponseStatus))
|
|
976
|
+
|
|
977
|
+
|
|
750
978
|
@dataclass
|
|
751
979
|
class PublishRequest:
|
|
752
980
|
dashboard_id: Optional[str] = None
|
|
@@ -846,6 +1074,8 @@ class QueryAttachment:
|
|
|
846
1074
|
query: Optional[str] = None
|
|
847
1075
|
"""AI generated SQL query"""
|
|
848
1076
|
|
|
1077
|
+
statement_id: Optional[str] = None
|
|
1078
|
+
|
|
849
1079
|
title: Optional[str] = None
|
|
850
1080
|
"""Name of the query"""
|
|
851
1081
|
|
|
@@ -860,6 +1090,7 @@ class QueryAttachment:
|
|
|
860
1090
|
if self.last_updated_timestamp is not None:
|
|
861
1091
|
body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
862
1092
|
if self.query is not None: body['query'] = self.query
|
|
1093
|
+
if self.statement_id is not None: body['statement_id'] = self.statement_id
|
|
863
1094
|
if self.title is not None: body['title'] = self.title
|
|
864
1095
|
return body
|
|
865
1096
|
|
|
@@ -874,6 +1105,7 @@ class QueryAttachment:
|
|
|
874
1105
|
if self.last_updated_timestamp is not None:
|
|
875
1106
|
body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
876
1107
|
if self.query is not None: body['query'] = self.query
|
|
1108
|
+
if self.statement_id is not None: body['statement_id'] = self.statement_id
|
|
877
1109
|
if self.title is not None: body['title'] = self.title
|
|
878
1110
|
return body
|
|
879
1111
|
|
|
@@ -887,9 +1119,59 @@ class QueryAttachment:
|
|
|
887
1119
|
instruction_title=d.get('instruction_title', None),
|
|
888
1120
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
889
1121
|
query=d.get('query', None),
|
|
1122
|
+
statement_id=d.get('statement_id', None),
|
|
890
1123
|
title=d.get('title', None))
|
|
891
1124
|
|
|
892
1125
|
|
|
1126
|
+
@dataclass
|
|
1127
|
+
class QueryResponseStatus:
|
|
1128
|
+
canceled: Optional[Empty] = None
|
|
1129
|
+
"""Represents an empty message, similar to google.protobuf.Empty, which is not available in the
|
|
1130
|
+
firm right now."""
|
|
1131
|
+
|
|
1132
|
+
closed: Optional[Empty] = None
|
|
1133
|
+
"""Represents an empty message, similar to google.protobuf.Empty, which is not available in the
|
|
1134
|
+
firm right now."""
|
|
1135
|
+
|
|
1136
|
+
pending: Optional[PendingStatus] = None
|
|
1137
|
+
|
|
1138
|
+
statement_id: Optional[str] = None
|
|
1139
|
+
"""The statement id in format(01eef5da-c56e-1f36-bafa-21906587d6ba) The statement_id should be
|
|
1140
|
+
identical to data_token in SuccessStatus and PendingStatus. This field is created for audit
|
|
1141
|
+
logging purpose to record the statement_id of all QueryResponseStatus."""
|
|
1142
|
+
|
|
1143
|
+
success: Optional[SuccessStatus] = None
|
|
1144
|
+
|
|
1145
|
+
def as_dict(self) -> dict:
|
|
1146
|
+
"""Serializes the QueryResponseStatus into a dictionary suitable for use as a JSON request body."""
|
|
1147
|
+
body = {}
|
|
1148
|
+
if self.canceled: body['canceled'] = self.canceled.as_dict()
|
|
1149
|
+
if self.closed: body['closed'] = self.closed.as_dict()
|
|
1150
|
+
if self.pending: body['pending'] = self.pending.as_dict()
|
|
1151
|
+
if self.statement_id is not None: body['statement_id'] = self.statement_id
|
|
1152
|
+
if self.success: body['success'] = self.success.as_dict()
|
|
1153
|
+
return body
|
|
1154
|
+
|
|
1155
|
+
def as_shallow_dict(self) -> dict:
|
|
1156
|
+
"""Serializes the QueryResponseStatus into a shallow dictionary of its immediate attributes."""
|
|
1157
|
+
body = {}
|
|
1158
|
+
if self.canceled: body['canceled'] = self.canceled
|
|
1159
|
+
if self.closed: body['closed'] = self.closed
|
|
1160
|
+
if self.pending: body['pending'] = self.pending
|
|
1161
|
+
if self.statement_id is not None: body['statement_id'] = self.statement_id
|
|
1162
|
+
if self.success: body['success'] = self.success
|
|
1163
|
+
return body
|
|
1164
|
+
|
|
1165
|
+
@classmethod
|
|
1166
|
+
def from_dict(cls, d: Dict[str, any]) -> QueryResponseStatus:
|
|
1167
|
+
"""Deserializes the QueryResponseStatus from a dictionary."""
|
|
1168
|
+
return cls(canceled=_from_dict(d, 'canceled', Empty),
|
|
1169
|
+
closed=_from_dict(d, 'closed', Empty),
|
|
1170
|
+
pending=_from_dict(d, 'pending', PendingStatus),
|
|
1171
|
+
statement_id=d.get('statement_id', None),
|
|
1172
|
+
success=_from_dict(d, 'success', SuccessStatus))
|
|
1173
|
+
|
|
1174
|
+
|
|
893
1175
|
@dataclass
|
|
894
1176
|
class QuerySchema:
|
|
895
1177
|
columns: Optional[List[QuerySchemaColumn]] = None
|
|
@@ -1213,6 +1495,35 @@ class SubscriptionSubscriberUser:
|
|
|
1213
1495
|
return cls(user_id=d.get('user_id', None))
|
|
1214
1496
|
|
|
1215
1497
|
|
|
1498
|
+
@dataclass
|
|
1499
|
+
class SuccessStatus:
|
|
1500
|
+
data_token: str
|
|
1501
|
+
"""The token to poll for result asynchronously Example:
|
|
1502
|
+
EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ"""
|
|
1503
|
+
|
|
1504
|
+
truncated: Optional[bool] = None
|
|
1505
|
+
"""Whether the query result is truncated (either by byte limit or row limit)"""
|
|
1506
|
+
|
|
1507
|
+
def as_dict(self) -> dict:
|
|
1508
|
+
"""Serializes the SuccessStatus into a dictionary suitable for use as a JSON request body."""
|
|
1509
|
+
body = {}
|
|
1510
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
1511
|
+
if self.truncated is not None: body['truncated'] = self.truncated
|
|
1512
|
+
return body
|
|
1513
|
+
|
|
1514
|
+
def as_shallow_dict(self) -> dict:
|
|
1515
|
+
"""Serializes the SuccessStatus into a shallow dictionary of its immediate attributes."""
|
|
1516
|
+
body = {}
|
|
1517
|
+
if self.data_token is not None: body['data_token'] = self.data_token
|
|
1518
|
+
if self.truncated is not None: body['truncated'] = self.truncated
|
|
1519
|
+
return body
|
|
1520
|
+
|
|
1521
|
+
@classmethod
|
|
1522
|
+
def from_dict(cls, d: Dict[str, any]) -> SuccessStatus:
|
|
1523
|
+
"""Deserializes the SuccessStatus from a dictionary."""
|
|
1524
|
+
return cls(data_token=d.get('data_token', None), truncated=d.get('truncated', None))
|
|
1525
|
+
|
|
1526
|
+
|
|
1216
1527
|
@dataclass
|
|
1217
1528
|
class TextAttachment:
|
|
1218
1529
|
content: Optional[str] = None
|
|
@@ -1902,3 +2213,107 @@ class LakeviewAPI:
|
|
|
1902
2213
|
body=body,
|
|
1903
2214
|
headers=headers)
|
|
1904
2215
|
return Schedule.from_dict(res)
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
class LakeviewEmbeddedAPI:
|
|
2219
|
+
"""Token-based Lakeview APIs for embedding dashboards in external applications."""
|
|
2220
|
+
|
|
2221
|
+
def __init__(self, api_client):
|
|
2222
|
+
self._api = api_client
|
|
2223
|
+
|
|
2224
|
+
def get_published_dashboard_embedded(self, dashboard_id: str):
|
|
2225
|
+
"""Read a published dashboard in an embedded ui.
|
|
2226
|
+
|
|
2227
|
+
Get the current published dashboard within an embedded context.
|
|
2228
|
+
|
|
2229
|
+
:param dashboard_id: str
|
|
2230
|
+
UUID identifying the published dashboard.
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
"""
|
|
2234
|
+
|
|
2235
|
+
headers = {'Accept': 'application/json', }
|
|
2236
|
+
|
|
2237
|
+
self._api.do('GET',
|
|
2238
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/published/embedded',
|
|
2239
|
+
headers=headers)
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
class QueryExecutionAPI:
|
|
2243
|
+
"""Query execution APIs for AI / BI Dashboards"""
|
|
2244
|
+
|
|
2245
|
+
def __init__(self, api_client):
|
|
2246
|
+
self._api = api_client
|
|
2247
|
+
|
|
2248
|
+
def cancel_published_query_execution(self,
|
|
2249
|
+
dashboard_name: str,
|
|
2250
|
+
dashboard_revision_id: str,
|
|
2251
|
+
*,
|
|
2252
|
+
tokens: Optional[List[str]] = None) -> CancelQueryExecutionResponse:
|
|
2253
|
+
"""Cancel the results for the a query for a published, embedded dashboard.
|
|
2254
|
+
|
|
2255
|
+
:param dashboard_name: str
|
|
2256
|
+
:param dashboard_revision_id: str
|
|
2257
|
+
:param tokens: List[str] (optional)
|
|
2258
|
+
Example: EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ
|
|
2259
|
+
|
|
2260
|
+
:returns: :class:`CancelQueryExecutionResponse`
|
|
2261
|
+
"""
|
|
2262
|
+
|
|
2263
|
+
query = {}
|
|
2264
|
+
if dashboard_name is not None: query['dashboard_name'] = dashboard_name
|
|
2265
|
+
if dashboard_revision_id is not None: query['dashboard_revision_id'] = dashboard_revision_id
|
|
2266
|
+
if tokens is not None: query['tokens'] = [v for v in tokens]
|
|
2267
|
+
headers = {'Accept': 'application/json', }
|
|
2268
|
+
|
|
2269
|
+
res = self._api.do('DELETE', '/api/2.0/lakeview-query/query/published', query=query, headers=headers)
|
|
2270
|
+
return CancelQueryExecutionResponse.from_dict(res)
|
|
2271
|
+
|
|
2272
|
+
def execute_published_dashboard_query(self,
|
|
2273
|
+
dashboard_name: str,
|
|
2274
|
+
dashboard_revision_id: str,
|
|
2275
|
+
*,
|
|
2276
|
+
override_warehouse_id: Optional[str] = None):
|
|
2277
|
+
"""Execute a query for a published dashboard.
|
|
2278
|
+
|
|
2279
|
+
:param dashboard_name: str
|
|
2280
|
+
Dashboard name and revision_id is required to retrieve PublishedDatasetDataModel which contains the
|
|
2281
|
+
list of datasets, warehouse_id, and embedded_credentials
|
|
2282
|
+
:param dashboard_revision_id: str
|
|
2283
|
+
:param override_warehouse_id: str (optional)
|
|
2284
|
+
A dashboard schedule can override the warehouse used as compute for processing the published
|
|
2285
|
+
dashboard queries
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
"""
|
|
2289
|
+
body = {}
|
|
2290
|
+
if dashboard_name is not None: body['dashboard_name'] = dashboard_name
|
|
2291
|
+
if dashboard_revision_id is not None: body['dashboard_revision_id'] = dashboard_revision_id
|
|
2292
|
+
if override_warehouse_id is not None: body['override_warehouse_id'] = override_warehouse_id
|
|
2293
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2294
|
+
|
|
2295
|
+
self._api.do('POST', '/api/2.0/lakeview-query/query/published', body=body, headers=headers)
|
|
2296
|
+
|
|
2297
|
+
def poll_published_query_status(self,
|
|
2298
|
+
dashboard_name: str,
|
|
2299
|
+
dashboard_revision_id: str,
|
|
2300
|
+
*,
|
|
2301
|
+
tokens: Optional[List[str]] = None) -> PollQueryStatusResponse:
|
|
2302
|
+
"""Poll the results for the a query for a published, embedded dashboard.
|
|
2303
|
+
|
|
2304
|
+
:param dashboard_name: str
|
|
2305
|
+
:param dashboard_revision_id: str
|
|
2306
|
+
:param tokens: List[str] (optional)
|
|
2307
|
+
Example: EC0A..ChAB7WCEn_4Qo4vkLqEbXsxxEgh3Y2pbWw45WhoQXgZSQo9aS5q2ZvFcbvbx9CgA-PAEAQ
|
|
2308
|
+
|
|
2309
|
+
:returns: :class:`PollQueryStatusResponse`
|
|
2310
|
+
"""
|
|
2311
|
+
|
|
2312
|
+
query = {}
|
|
2313
|
+
if dashboard_name is not None: query['dashboard_name'] = dashboard_name
|
|
2314
|
+
if dashboard_revision_id is not None: query['dashboard_revision_id'] = dashboard_revision_id
|
|
2315
|
+
if tokens is not None: query['tokens'] = [v for v in tokens]
|
|
2316
|
+
headers = {'Accept': 'application/json', }
|
|
2317
|
+
|
|
2318
|
+
res = self._api.do('GET', '/api/2.0/lakeview-query/query/published', query=query, headers=headers)
|
|
2319
|
+
return PollQueryStatusResponse.from_dict(res)
|