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
databricks/sdk/_property.py
CHANGED
|
@@ -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(
|
|
20
|
-
|
|
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:
|
|
30
|
-
msg = (
|
|
31
|
-
|
|
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 = (
|
|
40
|
-
|
|
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
|
|
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(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
31
|
+
return ",".join(value)
|
|
32
32
|
|
|
33
|
-
raise ValueError("The returned value has invalid type (
|
|
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(
|
|
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(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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.
|
|
76
|
-
|
|
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:
|
|
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:
|
|
12
|
+
def add_sp_management_token(token_source: "TokenSource", headers: Dict[str, str]):
|
|
13
13
|
mgmt_token = token_source.token()
|
|
14
|
-
headers[
|
|
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 (
|
|
26
|
-
|
|
27
|
-
|
|
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(
|
|
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(
|
|
17
|
+
self._segments.append("".join(segment))
|
|
18
18
|
segment = []
|
|
19
19
|
if segment:
|
|
20
|
-
self._segments.append(
|
|
20
|
+
self._segments.append("".join(segment))
|
|
21
21
|
|
|
22
22
|
def to_snake_case(self) -> str:
|
|
23
|
-
return
|
|
23
|
+
return "_".join(self._segments)
|
|
24
24
|
|
|
25
25
|
def to_header_case(self) -> str:
|
|
26
|
-
return
|
|
26
|
+
return "-".join([s.capitalize() for s in self._segments])
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class Casing(object):
|