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.

Files changed (63) hide show
  1. databricks/sdk/__init__.py +123 -115
  2. databricks/sdk/_base_client.py +112 -88
  3. databricks/sdk/_property.py +12 -7
  4. databricks/sdk/_widgets/__init__.py +13 -2
  5. databricks/sdk/_widgets/default_widgets_utils.py +21 -15
  6. databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
  7. databricks/sdk/azure.py +8 -6
  8. databricks/sdk/casing.py +5 -5
  9. databricks/sdk/config.py +152 -99
  10. databricks/sdk/core.py +57 -47
  11. databricks/sdk/credentials_provider.py +360 -210
  12. databricks/sdk/data_plane.py +86 -3
  13. databricks/sdk/dbutils.py +123 -87
  14. databricks/sdk/environments.py +52 -35
  15. databricks/sdk/errors/base.py +61 -35
  16. databricks/sdk/errors/customizer.py +3 -3
  17. databricks/sdk/errors/deserializer.py +38 -25
  18. databricks/sdk/errors/details.py +417 -0
  19. databricks/sdk/errors/mapper.py +1 -1
  20. databricks/sdk/errors/overrides.py +27 -24
  21. databricks/sdk/errors/parser.py +26 -14
  22. databricks/sdk/errors/platform.py +10 -10
  23. databricks/sdk/errors/private_link.py +24 -24
  24. databricks/sdk/logger/round_trip_logger.py +28 -20
  25. databricks/sdk/mixins/compute.py +90 -60
  26. databricks/sdk/mixins/files.py +815 -145
  27. databricks/sdk/mixins/jobs.py +201 -20
  28. databricks/sdk/mixins/open_ai_client.py +26 -20
  29. databricks/sdk/mixins/workspace.py +45 -34
  30. databricks/sdk/oauth.py +372 -196
  31. databricks/sdk/retries.py +14 -12
  32. databricks/sdk/runtime/__init__.py +34 -17
  33. databricks/sdk/runtime/dbutils_stub.py +52 -39
  34. databricks/sdk/service/_internal.py +12 -7
  35. databricks/sdk/service/apps.py +618 -418
  36. databricks/sdk/service/billing.py +827 -604
  37. databricks/sdk/service/catalog.py +6552 -4474
  38. databricks/sdk/service/cleanrooms.py +550 -388
  39. databricks/sdk/service/compute.py +5241 -3531
  40. databricks/sdk/service/dashboards.py +1313 -923
  41. databricks/sdk/service/files.py +442 -309
  42. databricks/sdk/service/iam.py +2115 -1483
  43. databricks/sdk/service/jobs.py +4151 -2588
  44. databricks/sdk/service/marketplace.py +2210 -1517
  45. databricks/sdk/service/ml.py +3364 -2255
  46. databricks/sdk/service/oauth2.py +922 -584
  47. databricks/sdk/service/pipelines.py +1865 -1203
  48. databricks/sdk/service/provisioning.py +1435 -1029
  49. databricks/sdk/service/serving.py +2040 -1278
  50. databricks/sdk/service/settings.py +2846 -1929
  51. databricks/sdk/service/sharing.py +2201 -877
  52. databricks/sdk/service/sql.py +4650 -3103
  53. databricks/sdk/service/vectorsearch.py +816 -550
  54. databricks/sdk/service/workspace.py +1330 -906
  55. databricks/sdk/useragent.py +36 -22
  56. databricks/sdk/version.py +1 -1
  57. {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/METADATA +31 -31
  58. databricks_sdk-0.45.0.dist-info/RECORD +70 -0
  59. {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/WHEEL +1 -1
  60. databricks_sdk-0.44.0.dist-info/RECORD +0 -69
  61. {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/LICENSE +0 -0
  62. {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/NOTICE +0 -0
  63. {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/top_level.txt +0 -0
@@ -16,8 +16,9 @@ class _cached_property:
16
16
  if self.attrname is None:
17
17
  self.attrname = name
18
18
  elif name != self.attrname:
19
- raise TypeError("Cannot assign the same cached_property to two different names "
20
- f"({self.attrname!r} and {name!r}).")
19
+ raise TypeError(
20
+ "Cannot assign the same cached_property to two different names " f"({self.attrname!r} and {name!r})."
21
+ )
21
22
 
22
23
  def __get__(self, instance, owner=None):
23
24
  if instance is None:
@@ -26,9 +27,11 @@ class _cached_property:
26
27
  raise TypeError("Cannot use cached_property instance without calling __set_name__ on it.")
27
28
  try:
28
29
  cache = instance.__dict__
29
- except AttributeError: # not all objects have __dict__ (e.g. class defines slots)
30
- msg = (f"No '__dict__' attribute on {type(instance).__name__!r} "
31
- f"instance to cache {self.attrname!r} property.")
30
+ except AttributeError: # not all objects have __dict__ (e.g. class defines slots)
31
+ msg = (
32
+ f"No '__dict__' attribute on {type(instance).__name__!r} "
33
+ f"instance to cache {self.attrname!r} property."
34
+ )
32
35
  raise TypeError(msg) from None
33
36
  val = cache.get(self.attrname, _NOT_FOUND)
34
37
  if val is _NOT_FOUND:
@@ -36,7 +39,9 @@ class _cached_property:
36
39
  try:
37
40
  cache[self.attrname] = val
38
41
  except TypeError:
39
- msg = (f"The '__dict__' attribute on {type(instance).__name__!r} instance "
40
- f"does not support item assignment for caching {self.attrname!r} property.")
42
+ msg = (
43
+ f"The '__dict__' attribute on {type(instance).__name__!r} instance "
44
+ f"does not support item assignment for caching {self.attrname!r} property."
45
+ )
41
46
  raise TypeError(msg) from None
42
47
  return val
@@ -43,7 +43,17 @@ try:
43
43
  # Detect if we are in an interactive notebook by iterating over the mro of the current ipython instance,
44
44
  # to find ZMQInteractiveShell (jupyter). When used from REPL or file, this check will fail, since the
45
45
  # mro only contains TerminalInteractiveShell.
46
- if len(list(filter(lambda i: i.__name__ == 'ZMQInteractiveShell', get_ipython().__class__.__mro__))) == 0:
46
+ if (
47
+ len(
48
+ list(
49
+ filter(
50
+ lambda i: i.__name__ == "ZMQInteractiveShell",
51
+ get_ipython().__class__.__mro__,
52
+ )
53
+ )
54
+ )
55
+ == 0
56
+ ):
47
57
  logging.debug("Not in an interactive notebook. Skipping ipywidgets implementation for dbutils.")
48
58
  raise EnvironmentError("Not in an interactive notebook.")
49
59
 
@@ -61,7 +71,8 @@ try:
61
71
  warnings.warn(
62
72
  "\nTo use databricks widgets interactively in your notebook, please install databricks sdk using:\n"
63
73
  "\tpip install 'databricks-sdk[notebook]'\n"
64
- "Falling back to default_value_only implementation for databricks widgets.")
74
+ "Falling back to default_value_only implementation for databricks widgets."
75
+ )
65
76
  logging.debug(f"{e.msg}. Skipping ipywidgets implementation for dbutils.")
66
77
  raise e
67
78
 
@@ -11,25 +11,31 @@ class DefaultValueOnlyWidgetUtils(WidgetUtils):
11
11
  def text(self, name: str, defaultValue: str, label: typing.Optional[str] = None):
12
12
  self._widgets[name] = defaultValue
13
13
 
14
- def dropdown(self,
15
- name: str,
16
- defaultValue: str,
17
- choices: typing.List[str],
18
- label: typing.Optional[str] = None):
14
+ def dropdown(
15
+ self,
16
+ name: str,
17
+ defaultValue: str,
18
+ choices: typing.List[str],
19
+ label: typing.Optional[str] = None,
20
+ ):
19
21
  self._widgets[name] = defaultValue
20
22
 
21
- def combobox(self,
22
- name: str,
23
- defaultValue: str,
24
- choices: typing.List[str],
25
- label: typing.Optional[str] = None):
23
+ def combobox(
24
+ self,
25
+ name: str,
26
+ defaultValue: str,
27
+ choices: typing.List[str],
28
+ label: typing.Optional[str] = None,
29
+ ):
26
30
  self._widgets[name] = defaultValue
27
31
 
28
- def multiselect(self,
29
- name: str,
30
- defaultValue: str,
31
- choices: typing.List[str],
32
- label: typing.Optional[str] = None):
32
+ def multiselect(
33
+ self,
34
+ name: str,
35
+ defaultValue: str,
36
+ choices: typing.List[str],
37
+ label: typing.Optional[str] = None,
38
+ ):
33
39
  self._widgets[name] = defaultValue
34
40
 
35
41
  def _get(self, name: str) -> str:
@@ -28,9 +28,9 @@ class DbUtilsWidget:
28
28
  if type(value) == str or value is None:
29
29
  return value
30
30
  if type(value) == list or type(value) == tuple:
31
- return ','.join(value)
31
+ return ",".join(value)
32
32
 
33
- raise ValueError("The returned value has invalid type (" + type(value) + ").")
33
+ raise ValueError(f"The returned value has invalid type ({type(value)}).")
34
34
 
35
35
 
36
36
  class IPyWidgetUtil(WidgetUtils):
@@ -38,7 +38,12 @@ class IPyWidgetUtil(WidgetUtils):
38
38
  def __init__(self) -> None:
39
39
  self._widgets: typing.Dict[str, DbUtilsWidget] = {}
40
40
 
41
- def _register(self, name: str, widget: ValueWidget, label: typing.Optional[str] = None):
41
+ def _register(
42
+ self,
43
+ name: str,
44
+ widget: ValueWidget,
45
+ label: typing.Optional[str] = None,
46
+ ):
42
47
  label = label if label is not None else name
43
48
  w = DbUtilsWidget(label, widget)
44
49
 
@@ -51,29 +56,47 @@ class IPyWidgetUtil(WidgetUtils):
51
56
  def text(self, name: str, defaultValue: str, label: typing.Optional[str] = None):
52
57
  self._register(name, widget_string.Text(defaultValue), label)
53
58
 
54
- def dropdown(self,
55
- name: str,
56
- defaultValue: str,
57
- choices: typing.List[str],
58
- label: typing.Optional[str] = None):
59
- self._register(name, widget_selection.Dropdown(value=defaultValue, options=choices), label)
60
-
61
- def combobox(self,
62
- name: str,
63
- defaultValue: str,
64
- choices: typing.List[str],
65
- label: typing.Optional[str] = None):
66
- self._register(name, widget_string.Combobox(value=defaultValue, options=choices), label)
67
-
68
- def multiselect(self,
69
- name: str,
70
- defaultValue: str,
71
- choices: typing.List[str],
72
- label: typing.Optional[str] = None):
59
+ def dropdown(
60
+ self,
61
+ name: str,
62
+ defaultValue: str,
63
+ choices: typing.List[str],
64
+ label: typing.Optional[str] = None,
65
+ ):
73
66
  self._register(
74
67
  name,
75
- widget_selection.SelectMultiple(value=(defaultValue, ),
76
- options=[("__EMPTY__", ""), *list(zip(choices, choices))]), label)
68
+ widget_selection.Dropdown(value=defaultValue, options=choices),
69
+ label,
70
+ )
71
+
72
+ def combobox(
73
+ self,
74
+ name: str,
75
+ defaultValue: str,
76
+ choices: typing.List[str],
77
+ label: typing.Optional[str] = None,
78
+ ):
79
+ self._register(
80
+ name,
81
+ widget_string.Combobox(value=defaultValue, options=choices),
82
+ label,
83
+ )
84
+
85
+ def multiselect(
86
+ self,
87
+ name: str,
88
+ defaultValue: str,
89
+ choices: typing.List[str],
90
+ label: typing.Optional[str] = None,
91
+ ):
92
+ self._register(
93
+ name,
94
+ widget_selection.SelectMultiple(
95
+ value=(defaultValue,),
96
+ options=[("__EMPTY__", ""), *list(zip(choices, choices))],
97
+ ),
98
+ label,
99
+ )
77
100
 
78
101
  def _get(self, name: str) -> str:
79
102
  return self._widgets[name].value
databricks/sdk/azure.py CHANGED
@@ -4,14 +4,14 @@ from .oauth import TokenSource
4
4
  from .service.provisioning import Workspace
5
5
 
6
6
 
7
- def add_workspace_id_header(cfg: 'Config', headers: Dict[str, str]):
7
+ def add_workspace_id_header(cfg: "Config", headers: Dict[str, str]):
8
8
  if cfg.azure_workspace_resource_id:
9
9
  headers["X-Databricks-Azure-Workspace-Resource-Id"] = cfg.azure_workspace_resource_id
10
10
 
11
11
 
12
- def add_sp_management_token(token_source: 'TokenSource', headers: Dict[str, str]):
12
+ def add_sp_management_token(token_source: "TokenSource", headers: Dict[str, str]):
13
13
  mgmt_token = token_source.token()
14
- headers['X-Databricks-Azure-SP-Management-Token'] = mgmt_token.access_token
14
+ headers["X-Databricks-Azure-SP-Management-Token"] = mgmt_token.access_token
15
15
 
16
16
 
17
17
  def get_azure_resource_id(workspace: Workspace):
@@ -22,6 +22,8 @@ def get_azure_resource_id(workspace: Workspace):
22
22
  """
23
23
  if workspace.azure_workspace_info is None:
24
24
  return None
25
- return (f'/subscriptions/{workspace.azure_workspace_info.subscription_id}'
26
- f'/resourceGroups/{workspace.azure_workspace_info.resource_group}'
27
- f'/providers/Microsoft.Databricks/workspaces/{workspace.workspace_name}')
25
+ return (
26
+ f"/subscriptions/{workspace.azure_workspace_info.subscription_id}"
27
+ f"/resourceGroups/{workspace.azure_workspace_info.resource_group}"
28
+ f"/providers/Microsoft.Databricks/workspaces/{workspace.workspace_name}"
29
+ )
databricks/sdk/casing.py CHANGED
@@ -8,22 +8,22 @@ class _Name(object):
8
8
  for ch in raw_name:
9
9
  if ch.isupper():
10
10
  if segment:
11
- self._segments.append(''.join(segment))
11
+ self._segments.append("".join(segment))
12
12
  segment = [ch.lower()]
13
13
  elif ch.islower():
14
14
  segment.append(ch)
15
15
  else:
16
16
  if segment:
17
- self._segments.append(''.join(segment))
17
+ self._segments.append("".join(segment))
18
18
  segment = []
19
19
  if segment:
20
- self._segments.append(''.join(segment))
20
+ self._segments.append("".join(segment))
21
21
 
22
22
  def to_snake_case(self) -> str:
23
- return '_'.join(self._segments)
23
+ return "_".join(self._segments)
24
24
 
25
25
  def to_header_case(self) -> str:
26
- return '-'.join([s.capitalize() for s in self._segments])
26
+ return "-".join([s.capitalize() for s in self._segments])
27
27
 
28
28
 
29
29
  class Casing(object):