databricks-sdk 0.17.0__tar.gz → 0.19.0__tar.gz
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-0.17.0/databricks_sdk.egg-info → databricks-sdk-0.19.0}/PKG-INFO +4 -4
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/README.md +3 -3
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/__init__.py +41 -5
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/azure.py +17 -7
- databricks-sdk-0.19.0/databricks/sdk/clock.py +49 -0
- databricks-sdk-0.19.0/databricks/sdk/config.py +459 -0
- databricks-sdk-0.19.0/databricks/sdk/core.py +442 -0
- databricks-sdk-0.19.0/databricks/sdk/credentials_provider.py +628 -0
- databricks-sdk-0.19.0/databricks/sdk/environments.py +72 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/errors/__init__.py +1 -1
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/errors/mapper.py +5 -5
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/mixins/workspace.py +3 -3
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/oauth.py +2 -1
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/retries.py +9 -5
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/_internal.py +1 -1
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/catalog.py +946 -82
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/compute.py +106 -41
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/files.py +145 -31
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/iam.py +44 -40
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/jobs.py +199 -20
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/ml.py +33 -42
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/oauth2.py +3 -4
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/pipelines.py +51 -31
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/serving.py +1 -2
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/settings.py +377 -72
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/sharing.py +3 -4
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/sql.py +27 -19
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/vectorsearch.py +13 -17
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/workspace.py +20 -11
- databricks-sdk-0.19.0/databricks/sdk/version.py +1 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0/databricks_sdk.egg-info}/PKG-INFO +4 -4
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks_sdk.egg-info/SOURCES.txt +5 -1
- databricks-sdk-0.17.0/databricks/sdk/core.py +0 -1461
- databricks-sdk-0.17.0/databricks/sdk/version.py +0 -1
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/LICENSE +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/NOTICE +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/__init__.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/_widgets/__init__.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/_widgets/default_widgets_utils.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/_widgets/ipywidgets_utils.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/dbutils.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/errors/base.py +0 -0
- /databricks-sdk-0.17.0/databricks/sdk/errors/mapping.py → /databricks-sdk-0.19.0/databricks/sdk/errors/platform.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/errors/sdk.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/mixins/__init__.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/mixins/compute.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/mixins/files.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/py.typed +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/runtime/__init__.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/runtime/dbutils_stub.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/runtime/stub.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/__init__.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/billing.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/dashboards.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks/sdk/service/provisioning.py +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks_sdk.egg-info/dependency_links.txt +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks_sdk.egg-info/requires.txt +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/databricks_sdk.egg-info/top_level.txt +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/setup.cfg +0 -0
- {databricks-sdk-0.17.0 → databricks-sdk-0.19.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: databricks-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
4
4
|
Summary: Databricks SDK for Python (Beta)
|
|
5
5
|
Home-page: https://databricks-sdk-py.readthedocs.io
|
|
6
6
|
Author: Serge Smertin
|
|
@@ -180,12 +180,12 @@ The Databricks SDK for Python picks up an Azure CLI token, if you've previously
|
|
|
180
180
|
|
|
181
181
|
To authenticate as an Azure Active Directory (Azure AD) service principal, you must provide one of the following. See also [Add a service principal to your Azure Databricks account](https://learn.microsoft.com/azure/databricks/administration-guide/users-groups/service-principals#add-sp-account):
|
|
182
182
|
|
|
183
|
-
- `
|
|
184
|
-
- `
|
|
183
|
+
- `azure_workspace_resource_id`, `azure_client_secret`, `azure_client_id`, and `azure_tenant_id`; or their environment variable or `.databrickscfg` file field equivalents.
|
|
184
|
+
- `azure_workspace_resource_id` and `azure_use_msi`; or their environment variable or `.databrickscfg` file field equivalents.
|
|
185
185
|
|
|
186
186
|
| Argument | Description | Environment variable |
|
|
187
187
|
|-----------------------|-------------|----------------------|
|
|
188
|
-
| `
|
|
188
|
+
| `azure_workspace_resource_id` | _(String)_ The Azure Resource Manager ID for the Azure Databricks workspace, which is exchanged for a Databricks host URL. | `DATABRICKS_AZURE_RESOURCE_ID` |
|
|
189
189
|
| `azure_use_msi` | _(Boolean)_ `true` to use Azure Managed Service Identity passwordless authentication flow for service principals. _This feature is not yet implemented in the Databricks SDK for Python._ | `ARM_USE_MSI` |
|
|
190
190
|
| `azure_client_secret` | _(String)_ The Azure AD service principal's client secret. | `ARM_CLIENT_SECRET` |
|
|
191
191
|
| `azure_client_id` | _(String)_ The Azure AD service principal's application ID. | `ARM_CLIENT_ID` |
|
|
@@ -151,12 +151,12 @@ The Databricks SDK for Python picks up an Azure CLI token, if you've previously
|
|
|
151
151
|
|
|
152
152
|
To authenticate as an Azure Active Directory (Azure AD) service principal, you must provide one of the following. See also [Add a service principal to your Azure Databricks account](https://learn.microsoft.com/azure/databricks/administration-guide/users-groups/service-principals#add-sp-account):
|
|
153
153
|
|
|
154
|
-
- `
|
|
155
|
-
- `
|
|
154
|
+
- `azure_workspace_resource_id`, `azure_client_secret`, `azure_client_id`, and `azure_tenant_id`; or their environment variable or `.databrickscfg` file field equivalents.
|
|
155
|
+
- `azure_workspace_resource_id` and `azure_use_msi`; or their environment variable or `.databrickscfg` file field equivalents.
|
|
156
156
|
|
|
157
157
|
| Argument | Description | Environment variable |
|
|
158
158
|
|-----------------------|-------------|----------------------|
|
|
159
|
-
| `
|
|
159
|
+
| `azure_workspace_resource_id` | _(String)_ The Azure Resource Manager ID for the Azure Databricks workspace, which is exchanged for a Databricks host URL. | `DATABRICKS_AZURE_RESOURCE_ID` |
|
|
160
160
|
| `azure_use_msi` | _(Boolean)_ `true` to use Azure Managed Service Identity passwordless authentication flow for service principals. _This feature is not yet implemented in the Databricks SDK for Python._ | `ARM_USE_MSI` |
|
|
161
161
|
| `azure_client_secret` | _(String)_ The Azure AD service principal's client secret. | `ARM_CLIENT_SECRET` |
|
|
162
162
|
| `azure_client_id` | _(String)_ The Azure AD service principal's application ID. | `ARM_CLIENT_ID` |
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import databricks.sdk.core as client
|
|
2
2
|
import databricks.sdk.dbutils as dbutils
|
|
3
|
+
from databricks.sdk import azure
|
|
4
|
+
from databricks.sdk.credentials_provider import CredentialsProvider
|
|
3
5
|
from databricks.sdk.mixins.compute import ClustersExt
|
|
4
6
|
from databricks.sdk.mixins.files import DbfsExt
|
|
5
7
|
from databricks.sdk.mixins.workspace import WorkspaceExt
|
|
@@ -11,8 +13,8 @@ from databricks.sdk.service.catalog import (AccountMetastoreAssignmentsAPI,
|
|
|
11
13
|
ArtifactAllowlistsAPI, CatalogsAPI,
|
|
12
14
|
ConnectionsAPI,
|
|
13
15
|
ExternalLocationsAPI, FunctionsAPI,
|
|
14
|
-
GrantsAPI,
|
|
15
|
-
ModelVersionsAPI,
|
|
16
|
+
GrantsAPI, LakehouseMonitorsAPI,
|
|
17
|
+
MetastoresAPI, ModelVersionsAPI,
|
|
16
18
|
RegisteredModelsAPI, SchemasAPI,
|
|
17
19
|
StorageCredentialsAPI,
|
|
18
20
|
SystemSchemasAPI,
|
|
@@ -45,7 +47,7 @@ from databricks.sdk.service.provisioning import (CredentialsAPI,
|
|
|
45
47
|
EncryptionKeysAPI,
|
|
46
48
|
NetworksAPI, PrivateAccessAPI,
|
|
47
49
|
StorageAPI, VpcEndpointsAPI,
|
|
48
|
-
WorkspacesAPI)
|
|
50
|
+
Workspace, WorkspacesAPI)
|
|
49
51
|
from databricks.sdk.service.serving import AppsAPI, ServingEndpointsAPI
|
|
50
52
|
from databricks.sdk.service.settings import (AccountIpAccessListsAPI,
|
|
51
53
|
AccountSettingsAPI,
|
|
@@ -114,7 +116,7 @@ class WorkspaceClient:
|
|
|
114
116
|
debug_headers: bool = None,
|
|
115
117
|
product="unknown",
|
|
116
118
|
product_version="0.0.0",
|
|
117
|
-
credentials_provider:
|
|
119
|
+
credentials_provider: CredentialsProvider = None,
|
|
118
120
|
config: client.Config = None):
|
|
119
121
|
if not config:
|
|
120
122
|
config = client.Config(host=host,
|
|
@@ -172,6 +174,7 @@ class WorkspaceClient:
|
|
|
172
174
|
self._instance_profiles = InstanceProfilesAPI(self._api_client)
|
|
173
175
|
self._ip_access_lists = IpAccessListsAPI(self._api_client)
|
|
174
176
|
self._jobs = JobsAPI(self._api_client)
|
|
177
|
+
self._lakehouse_monitors = LakehouseMonitorsAPI(self._api_client)
|
|
175
178
|
self._lakeview = LakeviewAPI(self._api_client)
|
|
176
179
|
self._libraries = LibrariesAPI(self._api_client)
|
|
177
180
|
self._metastores = MetastoresAPI(self._api_client)
|
|
@@ -367,6 +370,11 @@ class WorkspaceClient:
|
|
|
367
370
|
"""The Jobs API allows you to create, edit, and delete jobs."""
|
|
368
371
|
return self._jobs
|
|
369
372
|
|
|
373
|
+
@property
|
|
374
|
+
def lakehouse_monitors(self) -> LakehouseMonitorsAPI:
|
|
375
|
+
"""A monitor computes and monitors data or model quality metrics for a table over time."""
|
|
376
|
+
return self._lakehouse_monitors
|
|
377
|
+
|
|
370
378
|
@property
|
|
371
379
|
def lakeview(self) -> LakeviewAPI:
|
|
372
380
|
"""These APIs provide specific management operations for Lakeview dashboards."""
|
|
@@ -585,7 +593,7 @@ class AccountClient:
|
|
|
585
593
|
debug_headers: bool = None,
|
|
586
594
|
product="unknown",
|
|
587
595
|
product_version="0.0.0",
|
|
588
|
-
credentials_provider:
|
|
596
|
+
credentials_provider: CredentialsProvider = None,
|
|
589
597
|
config: client.Config = None):
|
|
590
598
|
if not config:
|
|
591
599
|
config = client.Config(host=host,
|
|
@@ -772,5 +780,33 @@ class AccountClient:
|
|
|
772
780
|
"""These APIs manage workspaces for this account."""
|
|
773
781
|
return self._workspaces
|
|
774
782
|
|
|
783
|
+
def get_workspace_client(self, workspace: Workspace) -> WorkspaceClient:
|
|
784
|
+
"""Constructs a ``WorkspaceClient`` for the given workspace.
|
|
785
|
+
|
|
786
|
+
Returns a ``WorkspaceClient`` that is configured to use the same
|
|
787
|
+
credentials as this ``AccountClient``. The underlying config is
|
|
788
|
+
copied from this ``AccountClient``, but the ``host`` and
|
|
789
|
+
``azure_workspace_resource_id`` are overridden to match the
|
|
790
|
+
given workspace, and the ``account_id`` field is cleared.
|
|
791
|
+
|
|
792
|
+
Usage:
|
|
793
|
+
|
|
794
|
+
.. code-block::
|
|
795
|
+
|
|
796
|
+
wss = list(a.workspaces.list())
|
|
797
|
+
if len(wss) == 0:
|
|
798
|
+
pytest.skip("no workspaces")
|
|
799
|
+
w = a.get_workspace_client(wss[0])
|
|
800
|
+
assert w.current_user.me().active
|
|
801
|
+
|
|
802
|
+
:param workspace: The workspace to construct a client for.
|
|
803
|
+
:return: A ``WorkspaceClient`` for the given workspace.
|
|
804
|
+
"""
|
|
805
|
+
config = self._config.copy()
|
|
806
|
+
config.host = config.environment.deployment_url(workspace.deployment_name)
|
|
807
|
+
config.azure_workspace_resource_id = azure.get_azure_resource_id(workspace)
|
|
808
|
+
config.account_id = None
|
|
809
|
+
return WorkspaceClient(config=config)
|
|
810
|
+
|
|
775
811
|
def __repr__(self):
|
|
776
812
|
return f"AccountClient(account_id='{self._config.account_id}', auth_type='{self._config.auth_type}', ...)"
|
|
@@ -2,6 +2,7 @@ from dataclasses import dataclass
|
|
|
2
2
|
from typing import Dict
|
|
3
3
|
|
|
4
4
|
from .oauth import TokenSource
|
|
5
|
+
from .service.provisioning import Workspace
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
@dataclass
|
|
@@ -15,19 +16,15 @@ class AzureEnvironment:
|
|
|
15
16
|
ARM_DATABRICKS_RESOURCE_ID = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d"
|
|
16
17
|
|
|
17
18
|
ENVIRONMENTS = dict(
|
|
18
|
-
PUBLIC=AzureEnvironment(name="
|
|
19
|
+
PUBLIC=AzureEnvironment(name="PUBLIC",
|
|
19
20
|
service_management_endpoint="https://management.core.windows.net/",
|
|
20
21
|
resource_manager_endpoint="https://management.azure.com/",
|
|
21
22
|
active_directory_endpoint="https://login.microsoftonline.com/"),
|
|
22
|
-
|
|
23
|
-
service_management_endpoint="https://management.core.cloudapi.de/",
|
|
24
|
-
resource_manager_endpoint="https://management.microsoftazure.de/",
|
|
25
|
-
active_directory_endpoint="https://login.microsoftonline.de/"),
|
|
26
|
-
USGOVERNMENT=AzureEnvironment(name="AzureUSGovernmentCloud",
|
|
23
|
+
USGOVERNMENT=AzureEnvironment(name="USGOVERNMENT",
|
|
27
24
|
service_management_endpoint="https://management.core.usgovcloudapi.net/",
|
|
28
25
|
resource_manager_endpoint="https://management.usgovcloudapi.net/",
|
|
29
26
|
active_directory_endpoint="https://login.microsoftonline.us/"),
|
|
30
|
-
CHINA=AzureEnvironment(name="
|
|
27
|
+
CHINA=AzureEnvironment(name="CHINA",
|
|
31
28
|
service_management_endpoint="https://management.core.chinacloudapi.cn/",
|
|
32
29
|
resource_manager_endpoint="https://management.chinacloudapi.cn/",
|
|
33
30
|
active_directory_endpoint="https://login.chinacloudapi.cn/"),
|
|
@@ -42,3 +39,16 @@ def add_workspace_id_header(cfg: 'Config', headers: Dict[str, str]):
|
|
|
42
39
|
def add_sp_management_token(token_source: 'TokenSource', headers: Dict[str, str]):
|
|
43
40
|
mgmt_token = token_source.token()
|
|
44
41
|
headers['X-Databricks-Azure-SP-Management-Token'] = mgmt_token.access_token
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_azure_resource_id(workspace: Workspace):
|
|
45
|
+
"""
|
|
46
|
+
Returns the Azure Resource ID for the given workspace, if it is an Azure workspace.
|
|
47
|
+
:param workspace:
|
|
48
|
+
:return:
|
|
49
|
+
"""
|
|
50
|
+
if workspace.azure_workspace_info is None:
|
|
51
|
+
return None
|
|
52
|
+
return (f'/subscriptions/{workspace.azure_workspace_info.subscription_id}'
|
|
53
|
+
f'/resourceGroups/{workspace.azure_workspace_info.resource_group}'
|
|
54
|
+
f'/providers/Microsoft.Databricks/workspaces/{workspace.workspace_name}')
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Clock(metaclass=abc.ABCMeta):
|
|
6
|
+
|
|
7
|
+
@abc.abstractmethod
|
|
8
|
+
def time(self) -> float:
|
|
9
|
+
"""
|
|
10
|
+
Return the current time in seconds since the Epoch.
|
|
11
|
+
Fractions of a second may be present if the system clock provides them.
|
|
12
|
+
|
|
13
|
+
:return: The current time in seconds since the Epoch.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@abc.abstractmethod
|
|
17
|
+
def sleep(self, seconds: float) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Delay execution for a given number of seconds. The argument may be
|
|
20
|
+
a floating point number for subsecond precision.
|
|
21
|
+
|
|
22
|
+
:param seconds: The duration to sleep in seconds.
|
|
23
|
+
:return:
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class RealClock(Clock):
|
|
28
|
+
"""
|
|
29
|
+
A real clock that uses the ``time`` module to get the current time and sleep.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def time(self) -> float:
|
|
33
|
+
"""
|
|
34
|
+
Return the current time in seconds since the Epoch.
|
|
35
|
+
Fractions of a second may be present if the system clock provides them.
|
|
36
|
+
|
|
37
|
+
:return: The current time in seconds since the Epoch.
|
|
38
|
+
"""
|
|
39
|
+
return time.time()
|
|
40
|
+
|
|
41
|
+
def sleep(self, seconds: float) -> None:
|
|
42
|
+
"""
|
|
43
|
+
Delay execution for a given number of seconds. The argument may be
|
|
44
|
+
a floating point number for subsecond precision.
|
|
45
|
+
|
|
46
|
+
:param seconds: The duration to sleep in seconds.
|
|
47
|
+
:return:
|
|
48
|
+
"""
|
|
49
|
+
time.sleep(seconds)
|