databricks-sdk 0.66.0__py3-none-any.whl → 0.68.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of databricks-sdk might be problematic. Click here for more details.

Files changed (47) hide show
  1. databricks/sdk/__init__.py +10 -3
  2. databricks/sdk/_base_client.py +4 -1
  3. databricks/sdk/common/lro.py +17 -0
  4. databricks/sdk/common/types/__init__.py +0 -0
  5. databricks/sdk/common/types/fieldmask.py +39 -0
  6. databricks/sdk/credentials_provider.py +61 -12
  7. databricks/sdk/dbutils.py +5 -1
  8. databricks/sdk/errors/parser.py +8 -3
  9. databricks/sdk/mixins/files.py +1 -0
  10. databricks/sdk/oidc_token_supplier.py +80 -0
  11. databricks/sdk/retries.py +102 -2
  12. databricks/sdk/service/_internal.py +93 -1
  13. databricks/sdk/service/agentbricks.py +1 -1
  14. databricks/sdk/service/apps.py +264 -1
  15. databricks/sdk/service/billing.py +2 -3
  16. databricks/sdk/service/catalog.py +1030 -537
  17. databricks/sdk/service/cleanrooms.py +3 -3
  18. databricks/sdk/service/compute.py +21 -33
  19. databricks/sdk/service/dashboards.py +51 -3
  20. databricks/sdk/service/database.py +99 -8
  21. databricks/sdk/service/dataquality.py +1145 -0
  22. databricks/sdk/service/files.py +2 -1
  23. databricks/sdk/service/iam.py +6 -5
  24. databricks/sdk/service/iamv2.py +1 -1
  25. databricks/sdk/service/jobs.py +6 -9
  26. databricks/sdk/service/marketplace.py +3 -1
  27. databricks/sdk/service/ml.py +3 -1
  28. databricks/sdk/service/oauth2.py +1 -1
  29. databricks/sdk/service/pipelines.py +5 -6
  30. databricks/sdk/service/provisioning.py +544 -655
  31. databricks/sdk/service/qualitymonitorv2.py +1 -1
  32. databricks/sdk/service/serving.py +59 -1
  33. databricks/sdk/service/settings.py +5 -2
  34. databricks/sdk/service/settingsv2.py +1 -1
  35. databricks/sdk/service/sharing.py +12 -3
  36. databricks/sdk/service/sql.py +305 -70
  37. databricks/sdk/service/tags.py +1 -1
  38. databricks/sdk/service/vectorsearch.py +3 -1
  39. databricks/sdk/service/workspace.py +70 -17
  40. databricks/sdk/version.py +1 -1
  41. {databricks_sdk-0.66.0.dist-info → databricks_sdk-0.68.0.dist-info}/METADATA +4 -2
  42. databricks_sdk-0.68.0.dist-info/RECORD +83 -0
  43. databricks_sdk-0.66.0.dist-info/RECORD +0 -79
  44. {databricks_sdk-0.66.0.dist-info → databricks_sdk-0.68.0.dist-info}/WHEEL +0 -0
  45. {databricks_sdk-0.66.0.dist-info → databricks_sdk-0.68.0.dist-info}/licenses/LICENSE +0 -0
  46. {databricks_sdk-0.66.0.dist-info → databricks_sdk-0.68.0.dist-info}/licenses/NOTICE +0 -0
  47. {databricks_sdk-0.66.0.dist-info → databricks_sdk-0.68.0.dist-info}/top_level.txt +0 -0
@@ -10,8 +10,10 @@ from datetime import timedelta
10
10
  from enum import Enum
11
11
  from typing import Any, Callable, Dict, Iterator, List, Optional
12
12
 
13
+ from databricks.sdk.service._internal import (Wait, _enum, _from_dict,
14
+ _repeated_dict)
15
+
13
16
  from ..errors import OperationFailed
14
- from ._internal import Wait, _enum, _from_dict, _repeated_dict
15
17
 
16
18
  _LOG = logging.getLogger("databricks.sdk")
17
19
 
@@ -33,6 +35,8 @@ class App:
33
35
 
34
36
  budget_policy_id: Optional[str] = None
35
37
 
38
+ compute_size: Optional[ComputeSize] = None
39
+
36
40
  compute_status: Optional[ComputeStatus] = None
37
41
 
38
42
  create_time: Optional[str] = None
@@ -93,6 +97,8 @@ class App:
93
97
  body["app_status"] = self.app_status.as_dict()
94
98
  if self.budget_policy_id is not None:
95
99
  body["budget_policy_id"] = self.budget_policy_id
100
+ if self.compute_size is not None:
101
+ body["compute_size"] = self.compute_size.value
96
102
  if self.compute_status:
97
103
  body["compute_status"] = self.compute_status.as_dict()
98
104
  if self.create_time is not None:
@@ -144,6 +150,8 @@ class App:
144
150
  body["app_status"] = self.app_status
145
151
  if self.budget_policy_id is not None:
146
152
  body["budget_policy_id"] = self.budget_policy_id
153
+ if self.compute_size is not None:
154
+ body["compute_size"] = self.compute_size
147
155
  if self.compute_status:
148
156
  body["compute_status"] = self.compute_status
149
157
  if self.create_time is not None:
@@ -193,6 +201,7 @@ class App:
193
201
  active_deployment=_from_dict(d, "active_deployment", AppDeployment),
194
202
  app_status=_from_dict(d, "app_status", ApplicationStatus),
195
203
  budget_policy_id=d.get("budget_policy_id", None),
204
+ compute_size=_enum(d, "compute_size", ComputeSize),
196
205
  compute_status=_from_dict(d, "compute_status", ComputeStatus),
197
206
  create_time=d.get("create_time", None),
198
207
  creator=d.get("creator", None),
@@ -918,6 +927,8 @@ class AppResource:
918
927
  description: Optional[str] = None
919
928
  """Description of the App Resource."""
920
929
 
930
+ genie_space: Optional[AppResourceGenieSpace] = None
931
+
921
932
  job: Optional[AppResourceJob] = None
922
933
 
923
934
  secret: Optional[AppResourceSecret] = None
@@ -935,6 +946,8 @@ class AppResource:
935
946
  body["database"] = self.database.as_dict()
936
947
  if self.description is not None:
937
948
  body["description"] = self.description
949
+ if self.genie_space:
950
+ body["genie_space"] = self.genie_space.as_dict()
938
951
  if self.job:
939
952
  body["job"] = self.job.as_dict()
940
953
  if self.name is not None:
@@ -956,6 +969,8 @@ class AppResource:
956
969
  body["database"] = self.database
957
970
  if self.description is not None:
958
971
  body["description"] = self.description
972
+ if self.genie_space:
973
+ body["genie_space"] = self.genie_space
959
974
  if self.job:
960
975
  body["job"] = self.job
961
976
  if self.name is not None:
@@ -976,6 +991,7 @@ class AppResource:
976
991
  return cls(
977
992
  database=_from_dict(d, "database", AppResourceDatabase),
978
993
  description=d.get("description", None),
994
+ genie_space=_from_dict(d, "genie_space", AppResourceGenieSpace),
979
995
  job=_from_dict(d, "job", AppResourceJob),
980
996
  name=d.get("name", None),
981
997
  secret=_from_dict(d, "secret", AppResourceSecret),
@@ -1030,6 +1046,54 @@ class AppResourceDatabaseDatabasePermission(Enum):
1030
1046
  CAN_CONNECT_AND_CREATE = "CAN_CONNECT_AND_CREATE"
1031
1047
 
1032
1048
 
1049
+ @dataclass
1050
+ class AppResourceGenieSpace:
1051
+ name: str
1052
+
1053
+ space_id: str
1054
+
1055
+ permission: AppResourceGenieSpaceGenieSpacePermission
1056
+
1057
+ def as_dict(self) -> dict:
1058
+ """Serializes the AppResourceGenieSpace into a dictionary suitable for use as a JSON request body."""
1059
+ body = {}
1060
+ if self.name is not None:
1061
+ body["name"] = self.name
1062
+ if self.permission is not None:
1063
+ body["permission"] = self.permission.value
1064
+ if self.space_id is not None:
1065
+ body["space_id"] = self.space_id
1066
+ return body
1067
+
1068
+ def as_shallow_dict(self) -> dict:
1069
+ """Serializes the AppResourceGenieSpace into a shallow dictionary of its immediate attributes."""
1070
+ body = {}
1071
+ if self.name is not None:
1072
+ body["name"] = self.name
1073
+ if self.permission is not None:
1074
+ body["permission"] = self.permission
1075
+ if self.space_id is not None:
1076
+ body["space_id"] = self.space_id
1077
+ return body
1078
+
1079
+ @classmethod
1080
+ def from_dict(cls, d: Dict[str, Any]) -> AppResourceGenieSpace:
1081
+ """Deserializes the AppResourceGenieSpace from a dictionary."""
1082
+ return cls(
1083
+ name=d.get("name", None),
1084
+ permission=_enum(d, "permission", AppResourceGenieSpaceGenieSpacePermission),
1085
+ space_id=d.get("space_id", None),
1086
+ )
1087
+
1088
+
1089
+ class AppResourceGenieSpaceGenieSpacePermission(Enum):
1090
+
1091
+ CAN_EDIT = "CAN_EDIT"
1092
+ CAN_MANAGE = "CAN_MANAGE"
1093
+ CAN_RUN = "CAN_RUN"
1094
+ CAN_VIEW = "CAN_VIEW"
1095
+
1096
+
1033
1097
  @dataclass
1034
1098
  class AppResourceJob:
1035
1099
  id: str
@@ -1259,6 +1323,112 @@ class AppResourceUcSecurableUcSecurableType(Enum):
1259
1323
  VOLUME = "VOLUME"
1260
1324
 
1261
1325
 
1326
+ @dataclass
1327
+ class AppUpdate:
1328
+ budget_policy_id: Optional[str] = None
1329
+
1330
+ compute_size: Optional[ComputeSize] = None
1331
+
1332
+ description: Optional[str] = None
1333
+
1334
+ resources: Optional[List[AppResource]] = None
1335
+
1336
+ status: Optional[AppUpdateUpdateStatus] = None
1337
+
1338
+ usage_policy_id: Optional[str] = None
1339
+
1340
+ user_api_scopes: Optional[List[str]] = None
1341
+
1342
+ def as_dict(self) -> dict:
1343
+ """Serializes the AppUpdate into a dictionary suitable for use as a JSON request body."""
1344
+ body = {}
1345
+ if self.budget_policy_id is not None:
1346
+ body["budget_policy_id"] = self.budget_policy_id
1347
+ if self.compute_size is not None:
1348
+ body["compute_size"] = self.compute_size.value
1349
+ if self.description is not None:
1350
+ body["description"] = self.description
1351
+ if self.resources:
1352
+ body["resources"] = [v.as_dict() for v in self.resources]
1353
+ if self.status:
1354
+ body["status"] = self.status.as_dict()
1355
+ if self.usage_policy_id is not None:
1356
+ body["usage_policy_id"] = self.usage_policy_id
1357
+ if self.user_api_scopes:
1358
+ body["user_api_scopes"] = [v for v in self.user_api_scopes]
1359
+ return body
1360
+
1361
+ def as_shallow_dict(self) -> dict:
1362
+ """Serializes the AppUpdate into a shallow dictionary of its immediate attributes."""
1363
+ body = {}
1364
+ if self.budget_policy_id is not None:
1365
+ body["budget_policy_id"] = self.budget_policy_id
1366
+ if self.compute_size is not None:
1367
+ body["compute_size"] = self.compute_size
1368
+ if self.description is not None:
1369
+ body["description"] = self.description
1370
+ if self.resources:
1371
+ body["resources"] = self.resources
1372
+ if self.status:
1373
+ body["status"] = self.status
1374
+ if self.usage_policy_id is not None:
1375
+ body["usage_policy_id"] = self.usage_policy_id
1376
+ if self.user_api_scopes:
1377
+ body["user_api_scopes"] = self.user_api_scopes
1378
+ return body
1379
+
1380
+ @classmethod
1381
+ def from_dict(cls, d: Dict[str, Any]) -> AppUpdate:
1382
+ """Deserializes the AppUpdate from a dictionary."""
1383
+ return cls(
1384
+ budget_policy_id=d.get("budget_policy_id", None),
1385
+ compute_size=_enum(d, "compute_size", ComputeSize),
1386
+ description=d.get("description", None),
1387
+ resources=_repeated_dict(d, "resources", AppResource),
1388
+ status=_from_dict(d, "status", AppUpdateUpdateStatus),
1389
+ usage_policy_id=d.get("usage_policy_id", None),
1390
+ user_api_scopes=d.get("user_api_scopes", None),
1391
+ )
1392
+
1393
+
1394
+ @dataclass
1395
+ class AppUpdateUpdateStatus:
1396
+ message: Optional[str] = None
1397
+
1398
+ state: Optional[AppUpdateUpdateStatusUpdateState] = None
1399
+
1400
+ def as_dict(self) -> dict:
1401
+ """Serializes the AppUpdateUpdateStatus into a dictionary suitable for use as a JSON request body."""
1402
+ body = {}
1403
+ if self.message is not None:
1404
+ body["message"] = self.message
1405
+ if self.state is not None:
1406
+ body["state"] = self.state.value
1407
+ return body
1408
+
1409
+ def as_shallow_dict(self) -> dict:
1410
+ """Serializes the AppUpdateUpdateStatus into a shallow dictionary of its immediate attributes."""
1411
+ body = {}
1412
+ if self.message is not None:
1413
+ body["message"] = self.message
1414
+ if self.state is not None:
1415
+ body["state"] = self.state
1416
+ return body
1417
+
1418
+ @classmethod
1419
+ def from_dict(cls, d: Dict[str, Any]) -> AppUpdateUpdateStatus:
1420
+ """Deserializes the AppUpdateUpdateStatus from a dictionary."""
1421
+ return cls(message=d.get("message", None), state=_enum(d, "state", AppUpdateUpdateStatusUpdateState))
1422
+
1423
+
1424
+ class AppUpdateUpdateStatusUpdateState(Enum):
1425
+
1426
+ FAILED = "FAILED"
1427
+ IN_PROGRESS = "IN_PROGRESS"
1428
+ NOT_UPDATED = "NOT_UPDATED"
1429
+ SUCCEEDED = "SUCCEEDED"
1430
+
1431
+
1262
1432
  class ApplicationState(Enum):
1263
1433
 
1264
1434
  CRASHED = "CRASHED"
@@ -1299,6 +1469,13 @@ class ApplicationStatus:
1299
1469
  return cls(message=d.get("message", None), state=_enum(d, "state", ApplicationState))
1300
1470
 
1301
1471
 
1472
+ class ComputeSize(Enum):
1473
+
1474
+ LARGE = "LARGE"
1475
+ LIQUID = "LIQUID"
1476
+ MEDIUM = "MEDIUM"
1477
+
1478
+
1302
1479
  class ComputeState(Enum):
1303
1480
 
1304
1481
  ACTIVE = "ACTIVE"
@@ -1582,6 +1759,37 @@ class AppsAPI:
1582
1759
  attempt += 1
1583
1760
  raise TimeoutError(f"timed out after {timeout}: {status_message}")
1584
1761
 
1762
+ def wait_get_update_app_succeeded(
1763
+ self, app_name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[AppUpdate], None]] = None
1764
+ ) -> AppUpdate:
1765
+ deadline = time.time() + timeout.total_seconds()
1766
+ target_states = (AppUpdateUpdateStatusUpdateState.SUCCEEDED,)
1767
+ failure_states = (AppUpdateUpdateStatusUpdateState.FAILED,)
1768
+ status_message = "polling..."
1769
+ attempt = 1
1770
+ while time.time() < deadline:
1771
+ poll = self.get_update(app_name=app_name)
1772
+ status = poll.status.state
1773
+ status_message = f"current status: {status}"
1774
+ if poll.status:
1775
+ status_message = poll.status.message
1776
+ if status in target_states:
1777
+ return poll
1778
+ if callback:
1779
+ callback(poll)
1780
+ if status in failure_states:
1781
+ msg = f"failed to reach SUCCEEDED, got {status}: {status_message}"
1782
+ raise OperationFailed(msg)
1783
+ prefix = f"app_name={app_name}"
1784
+ sleep = attempt
1785
+ if sleep > 10:
1786
+ # sleep 10s max per attempt
1787
+ sleep = 10
1788
+ _LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
1789
+ time.sleep(sleep + random.random())
1790
+ attempt += 1
1791
+ raise TimeoutError(f"timed out after {timeout}: {status_message}")
1792
+
1585
1793
  def wait_get_deployment_app_succeeded(
1586
1794
  self,
1587
1795
  app_name: str,
@@ -1674,6 +1882,45 @@ class AppsAPI:
1674
1882
  def create_and_wait(self, app: App, *, no_compute: Optional[bool] = None, timeout=timedelta(minutes=20)) -> App:
1675
1883
  return self.create(app=app, no_compute=no_compute).result(timeout=timeout)
1676
1884
 
1885
+ def create_update(self, app_name: str, update_mask: str, *, app: Optional[App] = None) -> Wait[AppUpdate]:
1886
+ """Creates an app update and starts the update process. The update process is asynchronous and the status
1887
+ of the update can be checked with the GetAppUpdate method.
1888
+
1889
+ :param app_name: str
1890
+ :param update_mask: str
1891
+ The field mask must be a single string, with multiple fields separated by commas (no spaces). The
1892
+ field path is relative to the resource object, using a dot (`.`) to navigate sub-fields (e.g.,
1893
+ `author.given_name`). Specification of elements in sequence or map fields is not allowed, as only
1894
+ the entire collection field can be specified. Field names must exactly match the resource field
1895
+ names.
1896
+
1897
+ A field mask of `*` indicates full replacement. It’s recommended to always explicitly list the
1898
+ fields being updated and avoid using `*` wildcards, as it can lead to unintended results if the API
1899
+ changes in the future.
1900
+ :param app: :class:`App` (optional)
1901
+
1902
+ :returns:
1903
+ Long-running operation waiter for :class:`AppUpdate`.
1904
+ See :method:wait_get_update_app_succeeded for more details.
1905
+ """
1906
+ body = {}
1907
+ if app is not None:
1908
+ body["app"] = app.as_dict()
1909
+ if update_mask is not None:
1910
+ body["update_mask"] = update_mask
1911
+ headers = {
1912
+ "Accept": "application/json",
1913
+ "Content-Type": "application/json",
1914
+ }
1915
+
1916
+ op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/update", body=body, headers=headers)
1917
+ return Wait(self.wait_get_update_app_succeeded, response=AppUpdate.from_dict(op_response), app_name=app_name)
1918
+
1919
+ def create_update_and_wait(
1920
+ self, app_name: str, update_mask: str, *, app: Optional[App] = None, timeout=timedelta(minutes=20)
1921
+ ) -> AppUpdate:
1922
+ return self.create_update(app=app, app_name=app_name, update_mask=update_mask).result(timeout=timeout)
1923
+
1677
1924
  def delete(self, name: str) -> App:
1678
1925
  """Deletes an app.
1679
1926
 
@@ -1787,6 +2034,22 @@ class AppsAPI:
1787
2034
  res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}", headers=headers)
1788
2035
  return AppPermissions.from_dict(res)
1789
2036
 
2037
+ def get_update(self, app_name: str) -> AppUpdate:
2038
+ """Gets the status of an app update.
2039
+
2040
+ :param app_name: str
2041
+ The name of the app.
2042
+
2043
+ :returns: :class:`AppUpdate`
2044
+ """
2045
+
2046
+ headers = {
2047
+ "Accept": "application/json",
2048
+ }
2049
+
2050
+ res = self._api.do("GET", f"/api/2.0/apps/{app_name}/update", headers=headers)
2051
+ return AppUpdate.from_dict(res)
2052
+
1790
2053
  def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]:
1791
2054
  """Lists all apps in the workspace.
1792
2055
 
@@ -7,13 +7,12 @@ from dataclasses import dataclass
7
7
  from enum import Enum
8
8
  from typing import Any, BinaryIO, Dict, Iterator, List, Optional
9
9
 
10
- from ._internal import _enum, _from_dict, _repeated_dict
10
+ from databricks.sdk.service import compute
11
+ from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict
11
12
 
12
13
  _LOG = logging.getLogger("databricks.sdk")
13
14
 
14
15
 
15
- from databricks.sdk.service import compute
16
-
17
16
  # all definitions in this file are in alphabetical order
18
17
 
19
18