This commit is contained in:
Christian Mantha
2026-03-02 19:10:52 -05:00
commit 2ca0b9ef7c
28907 changed files with 5233713 additions and 0 deletions

View File

@@ -0,0 +1,695 @@
Metadata-Version: 2.4
Name: databricks-sdk
Version: 0.94.0
Summary: Databricks SDK for Python (Beta)
Project-URL: Documentation, https://databricks-sdk-py.readthedocs.io
Keywords: databricks,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: requests<3,>=2.28.1
Requires-Dist: google-auth~=2.0
Requires-Dist: protobuf!=5.26.*,!=5.27.*,!=5.28.*,!=5.29.0,!=5.29.1,!=5.29.2,!=5.29.3,!=5.29.4,!=6.30.0,!=6.30.1,!=6.31.0,<7.0,>=4.25.8
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-xdist<4.0,>=3.6.1; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: black==24.8.0; extra == "dev"
Requires-Dist: pycodestyle; extra == "dev"
Requires-Dist: autoflake==2.3.1; extra == "dev"
Requires-Dist: isort==5.13.2; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: ipython; extra == "dev"
Requires-Dist: ipywidgets; extra == "dev"
Requires-Dist: requests-mock; extra == "dev"
Requires-Dist: pyfakefs; extra == "dev"
Requires-Dist: databricks-connect; extra == "dev"
Requires-Dist: pytest-rerunfailures; extra == "dev"
Requires-Dist: openai; extra == "dev"
Requires-Dist: langchain-openai; python_version > "3.7" and extra == "dev"
Requires-Dist: httpx; extra == "dev"
Requires-Dist: build; extra == "dev"
Provides-Extra: notebook
Requires-Dist: ipython<10,>=8; extra == "notebook"
Requires-Dist: ipywidgets<9,>=8; extra == "notebook"
Provides-Extra: openai
Requires-Dist: openai; extra == "openai"
Requires-Dist: langchain-openai; python_version > "3.7" and extra == "openai"
Requires-Dist: httpx; extra == "openai"
Dynamic: license-file
# Databricks SDK for Python (Beta)
[![PyPI - Downloads](https://img.shields.io/pypi/dw/databricks-sdk)](https://pypistats.org/packages/databricks-sdk)
[![PyPI - License](https://img.shields.io/pypi/l/databricks-sdk)](https://github.com/databricks/databricks-sdk-py/blob/main/LICENSE)
[![databricks-sdk](https://snyk.io/advisor/python/databricks-sdk/badge.svg)](https://snyk.io/advisor/python/databricks-sdk)
![PyPI](https://img.shields.io/pypi/v/databricks-sdk)
[![codecov](https://codecov.io/gh/databricks/databricks-sdk-py/branch/main/graph/badge.svg?token=GU63K7WDBE)](https://codecov.io/gh/databricks/databricks-sdk-py)
[![lines of code](https://tokei.rs/b1/github/databricks/databricks-sdk-py)]([https://codecov.io/github/databricks/databricks-sdk-py](https://github.com/databricks/databricks-sdk-py))
[Beta](https://docs.databricks.com/release-notes/release-types.html): This SDK is supported for production use cases,
but we do expect future releases to have some interface changes; see [Interface stability](#interface-stability).
We are keen to hear feedback from you on these SDKs. Please [file issues](https://github.com/databricks/databricks-sdk-py/issues), and we will address them.
| See also the [SDK for Java](https://github.com/databricks/databricks-sdk-java)
| See also the [SDK for Go](https://github.com/databricks/databricks-sdk-go)
| See also the [Terraform Provider](https://github.com/databricks/terraform-provider-databricks)
| See also cloud-specific docs ([AWS](https://docs.databricks.com/dev-tools/sdk-python.html),
[Azure](https://learn.microsoft.com/en-us/azure/databricks/dev-tools/sdk-python),
[GCP](https://docs.gcp.databricks.com/dev-tools/sdk-python.html))
| See also the [API reference on readthedocs](https://databricks-sdk-py.readthedocs.io/en/latest/)
The Databricks SDK for Python includes functionality to accelerate development with [Python](https://www.python.org/) for the Databricks Lakehouse.
It covers all public [Databricks REST API](https://docs.databricks.com/dev-tools/api/index.html) operations.
The SDK's internal HTTP client is robust and handles failures on different levels by performing intelligent retries.
## Contents
- [Getting started](#getting-started)
- [Code examples](#code-examples)
- [Authentication](#authentication)
- [Long-running operations](#long-running-operations)
- [Paginated responses](#paginated-responses)
- [Retries](#retries)
- [Single-sign-on with OAuth](#single-sign-on-sso-with-oauth)
- [User Agent Request Attribution](#user-agent-request-attribution)
- [Error handling](#error-handling)
- [Logging](#logging)
- [Integration with `dbutils`](#interaction-with-dbutils)
- [Interface stability](#interface-stability)
## Getting started<a id="getting-started"></a>
1. Please install Databricks SDK for Python via `pip install databricks-sdk` and instantiate `WorkspaceClient`:
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
for c in w.clusters.list():
print(c.cluster_name)
```
Databricks SDK for Python is compatible with Python 3.7 _(until [June 2023](https://devguide.python.org/versions/))_, 3.8, 3.9, 3.10, and 3.11.
**Note:** Databricks Runtime starting from version 13.1 includes a bundled version of the Python SDK.
It is highly recommended to upgrade to the latest version which you can do by running the following in a notebook cell:
```python
%pip install --upgrade databricks-sdk
```
followed by
```python
dbutils.library.restartPython()
```
## Code examples<a id="code-examples"></a>
The Databricks SDK for Python comes with a number of examples demonstrating how to use the library for various common use-cases, including
* [Using the SDK with OAuth from a webserver](https://github.com/databricks/databricks-sdk-py/blob/main/examples/flask_app_with_oauth.py)
* [Using long-running operations](https://github.com/databricks/databricks-sdk-py/blob/main/examples/starting_job_and_waiting.py)
* [Authenticating a client app using OAuth](https://github.com/databricks/databricks-sdk-py/blob/main/examples/local_browser_oauth.py)
These examples and more are located in the [`examples/` directory of the Github repository](https://github.com/databricks/databricks-sdk-py/tree/main/examples).
Some other examples of using the SDK include:
* [Unity Catalog Automated Migration](https://github.com/databricks/ucx) heavily relies on Python SDK for working with Databricks APIs.
* [ip-access-list-analyzer](https://github.com/alexott/databricks-playground/tree/main/ip-access-list-analyzer) checks & prunes invalid entries from IP Access Lists.
## Authentication<a id="authentication"></a>
If you use Databricks [configuration profiles](https://docs.databricks.com/dev-tools/auth.html#configuration-profiles)
or Databricks-specific [environment variables](https://docs.databricks.com/dev-tools/auth.html#environment-variables)
for [Databricks authentication](https://docs.databricks.com/dev-tools/auth.html), the only code required to start
working with a Databricks workspace is the following code snippet, which instructs the Databricks SDK for Python to use
its [default authentication flow](#default-authentication-flow):
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
w. # press <TAB> for autocompletion
```
The conventional name for the variable that holds the workspace-level client of the Databricks SDK for Python is `w`, which is shorthand for `workspace`.
### In this section
- [Default authentication flow](#default-authentication-flow)
- [Databricks native authentication](#databricks-native-authentication)
- [Azure native authentication](#azure-native-authentication)
- [Overriding .databrickscfg](#overriding-databrickscfg)
- [Additional authentication configuration options](#additional-authentication-configuration-options)
### Default authentication flow
If you run the [Databricks Terraform Provider](https://registry.terraform.io/providers/databrickslabs/databricks/latest),
the [Databricks SDK for Go](https://github.com/databricks/databricks-sdk-go), the [Databricks CLI](https://docs.databricks.com/dev-tools/cli/index.html),
or applications that target the Databricks SDKs for other languages, most likely they will all interoperate nicely together.
By default, the Databricks SDK for Python tries the following [authentication](https://docs.databricks.com/dev-tools/auth.html) methods,
in the following order, until it succeeds:
1. [Databricks native authentication](#databricks-native-authentication)
2. [Azure native authentication](#azure-native-authentication)
4. If the SDK is unsuccessful at this point, it returns an authentication error and stops running.
You can instruct the Databricks SDK for Python to use a specific authentication method by setting the `auth_type` argument
as described in the following sections.
For each authentication method, the SDK searches for compatible authentication credentials in the following locations,
in the following order. Once the SDK finds a compatible set of credentials that it can use, it stops searching:
1. Credentials that are hard-coded into configuration arguments.
:warning: **Caution**: Databricks does not recommend hard-coding credentials into arguments, as they can be exposed in plain text in version control systems. Use environment variables or configuration profiles instead.
2. Credentials in Databricks-specific [environment variables](https://docs.databricks.com/dev-tools/auth.html#environment-variables).
3. For Databricks native authentication, credentials in the `.databrickscfg` file's `DEFAULT` [configuration profile](https://docs.databricks.com/dev-tools/auth.html#configuration-profiles) from its default file location (`~` for Linux or macOS, and `%USERPROFILE%` for Windows).
4. For Azure native authentication, the SDK searches for credentials through the Azure CLI as needed.
Depending on the Databricks authentication method, the SDK uses the following information. Presented are the `WorkspaceClient` and `AccountClient` arguments (which have corresponding `.databrickscfg` file fields), their descriptions, and any corresponding environment variables.
### Databricks native authentication
By default, the Databricks SDK for Python initially tries [Databricks token authentication](https://docs.databricks.com/dev-tools/api/latest/authentication.html) (`auth_type='pat'` argument). If the SDK is unsuccessful, it then tries Workload Identity Federation (WIF). See [Supported WIF](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation-provider) for the supported JWT token providers.
- For Databricks token authentication, you must provide `host` and `token`; or their environment variable or `.databrickscfg` file field equivalents.
- For Databricks OIDC authentication, you must provide the `host`, `client_id` and `token_audience` _(optional)_ either directly, through the corresponding environment variables, or in your `.databrickscfg` configuration file.
- For Azure DevOps OIDC authentication, the `token_audience` is irrelevant as the audience is always set to `api://AzureADTokenExchange`. Also, the `System.AccessToken` pipeline variable required for OIDC request must be exposed as the `SYSTEM_ACCESSTOKEN` environment variable, following [Pipeline variables](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#systemaccesstoken)
| Argument | Description | Environment variable |
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
| `host` | _(String)_ The Databricks host URL for either the Databricks workspace endpoint or the Databricks accounts endpoint. | `DATABRICKS_HOST` |
| `account_id` | _(String)_ The Databricks account ID for the Databricks accounts endpoint. Only has effect when `Host` is either `https://accounts.cloud.databricks.com/` _(AWS)_, `https://accounts.azuredatabricks.net/` _(Azure)_, or `https://accounts.gcp.databricks.com/` _(GCP)_. | `DATABRICKS_ACCOUNT_ID` |
| `token` | _(String)_ The Databricks personal access token (PAT) _(AWS, Azure, and GCP)_ or Azure Active Directory (Azure AD) token _(Azure)_. | `DATABRICKS_TOKEN` |
| `client_id` | _(String)_ The Databricks Service Principal Application ID. | `DATABRICKS_CLIENT_ID` |
| `token_audience` | _(String)_ When using Workload Identity Federation, the audience to specify when fetching an ID token from the ID token supplier. | `TOKEN_AUDIENCE` |
For example, to use Databricks token authentication:
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient(host=input('Databricks Workspace URL: '), token=input('Token: '))
```
### Azure native authentication
By default, the Databricks SDK for Python first tries Azure client secret authentication (`auth_type='azure-client-secret'` argument). If the SDK is unsuccessful, it then tries Azure CLI authentication (`auth_type='azure-cli'` argument). See [Manage service principals](https://learn.microsoft.com/azure/databricks/administration-guide/users-groups/service-principals).
The Databricks SDK for Python picks up an Azure CLI token, if you've previously authenticated as an Azure user by running `az login` on your machine. See [Get Azure AD tokens for users by using the Azure CLI](https://learn.microsoft.com/azure/databricks/dev-tools/api/latest/aad/user-aad-token).
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):
- `azure_workspace_resource_id`, `azure_client_secret`, `azure_client_id`, and `azure_tenant_id`; or their environment variable or `.databrickscfg` file field equivalents.
- `azure_workspace_resource_id` and `azure_use_msi`; or their environment variable or `.databrickscfg` file field equivalents.
| Argument | Description | Environment variable |
|-----------------------|-------------|----------------------|
| `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` |
| `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` |
| `azure_client_secret` | _(String)_ The Azure AD service principal's client secret. | `ARM_CLIENT_SECRET` |
| `azure_client_id` | _(String)_ The Azure AD service principal's application ID. | `ARM_CLIENT_ID` |
| `azure_tenant_id` | _(String)_ The Azure AD service principal's tenant ID. | `ARM_TENANT_ID` |
| `azure_environment` | _(String)_ The Azure environment type (such as Public, UsGov, China, and Germany) for a specific set of API endpoints. Defaults to `PUBLIC`. | `ARM_ENVIRONMENT` |
For example, to use Azure client secret authentication:
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient(host=input('Databricks Workspace URL: '),
azure_workspace_resource_id=input('Azure Resource ID: '),
azure_tenant_id=input('AAD Tenant ID: '),
azure_client_id=input('AAD Client ID: '),
azure_client_secret=input('AAD Client Secret: '))
```
Please see more examples in [this document](./docs/azure-ad.md).
### Google Cloud Platform native authentication
By default, the Databricks SDK for Python first tries GCP credentials authentication (`auth_type='google-credentials'`, argument). If the SDK is unsuccessful, it then tries Google Cloud Platform (GCP) ID authentication (`auth_type='google-id'`, argument).
The Databricks SDK for Python picks up an OAuth token in the scope of the Google Default Application Credentials (DAC) flow. This means that if you have run `gcloud auth application-default login` on your development machine, or launch the application on the compute, that is allowed to impersonate the Google Cloud service account specified in `google_service_account`. Authentication should then work out of the box. See [Creating and managing service accounts](https://cloud.google.com/iam/docs/creating-managing-service-accounts).
To authenticate as a Google Cloud service account, you must provide one of the following:
- `host` and `google_credentials`; or their environment variable or `.databrickscfg` file field equivalents.
- `host` and `google_service_account`; or their environment variable or `.databrickscfg` file field equivalents.
| Argument | Description | Environment variable |
|--------------------------|-------------|--------------------------------------------------|
| `google_credentials` | _(String)_ GCP Service Account Credentials JSON or the location of these credentials on the local filesystem. | `GOOGLE_CREDENTIALS` |
| `google_service_account` | _(String)_ The Google Cloud Platform (GCP) service account e-mail used for impersonation in the Default Application Credentials Flow that does not require a password. | `DATABRICKS_GOOGLE_SERVICE_ACCOUNT` |
For example, to use Google ID authentication:
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient(host=input('Databricks Workspace URL: '),
google_service_account=input('Google Service Account: '))
```
### Overriding `.databrickscfg`
For [Databricks native authentication](#databricks-native-authentication), you can override the default behavior for using `.databrickscfg` as follows:
| Argument | Description | Environment variable |
|---------------|-------------|----------------------|
| `profile` | _(String)_ A connection profile specified within `.databrickscfg` to use instead of `DEFAULT`. | `DATABRICKS_CONFIG_PROFILE` |
| `config_file` | _(String)_ A non-default location of the Databricks CLI credentials file. | `DATABRICKS_CONFIG_FILE` |
For example, to use a profile named `MYPROFILE` instead of `DEFAULT`:
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient(profile='MYPROFILE')
# Now call the Databricks workspace APIs as desired...
```
### Additional authentication configuration options
For all authentication methods, you can override the default behavior in client arguments as follows:
| Argument | Description | Environment variable |
|-------------------------|-------------|------------------------|
| `auth_type` | _(String)_ When multiple auth attributes are available in the environment, use the auth type specified by this argument. This argument also holds the currently selected auth. | `DATABRICKS_AUTH_TYPE` |
| `http_timeout_seconds` | _(Integer)_ Number of seconds for HTTP timeout. Default is _60_. | _(None)_ |
| `retry_timeout_seconds` | _(Integer)_ Number of seconds to keep retrying HTTP requests. Default is _300 (5 minutes)_. | _(None)_ |
| `debug_truncate_bytes` | _(Integer)_ Truncate JSON fields in debug logs above this limit. Default is 96. | `DATABRICKS_DEBUG_TRUNCATE_BYTES` |
| `debug_headers` | _(Boolean)_ `true` to debug HTTP headers of requests made by the application. Default is `false`, as headers contain sensitive data, such as access tokens. | `DATABRICKS_DEBUG_HEADERS` |
| `rate_limit` | _(Integer)_ Maximum number of requests per second made to Databricks REST API. | `DATABRICKS_RATE_LIMIT` |
For example, here's how you can update the overall retry timeout:
```python
from databricks.sdk import WorkspaceClient
from databricks.sdk.core import Config
w = WorkspaceClient(config=Config(retry_timeout_seconds=300))
# Now call the Databricks workspace APIs as desired...
```
## Long-running operations<a id="long-running-operations"></a>
When you invoke a long-running operation, the SDK provides a high-level API to _trigger_ these operations and _wait_ for the related entities
to reach the correct state or return the error message in case of failure. All long-running operations return generic `Wait` instance with `result()`
method to get a result of long-running operation, once it's finished. Databricks SDK for Python picks the most reasonable default timeouts for
every method, but sometimes you may find yourself in a situation, where you'd want to provide `datetime.timedelta()` as the value of `timeout`
argument to `result()` method.
There are a number of long-running operations in Databricks APIs such as managing:
* Clusters,
* Command execution
* Jobs
* Libraries
* Delta Live Tables pipelines
* Databricks SQL warehouses.
For example, in the Clusters API, once you create a cluster, you receive a cluster ID, and the cluster is in the `PENDING` state Meanwhile
Databricks takes care of provisioning virtual machines from the cloud provider in the background. The cluster is
only usable in the `RUNNING` state and so you have to wait for that state to be reached.
Another example is the API for running a job or repairing the run: right after
the run starts, the run is in the `PENDING` state. The job is only considered to be finished when it is in either
the `TERMINATED` or `SKIPPED` state. Also you would likely need the error message if the long-running
operation times out and fails with an error code. Other times you may want to configure a custom timeout other than
the default of 20 minutes.
In the following example, `w.clusters.create` returns `ClusterInfo` only once the cluster is in the `RUNNING` state,
otherwise it will timeout in 10 minutes:
```python
import datetime
import logging
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
info = w.clusters.create_and_wait(cluster_name='Created cluster',
spark_version='12.0.x-scala2.12',
node_type_id='m5d.large',
autotermination_minutes=10,
num_workers=1,
timeout=datetime.timedelta(minutes=10))
logging.info(f'Created: {info}')
```
Please look at the `examples/starting_job_and_waiting.py` for a more advanced usage:
```python
import datetime
import logging
import time
from databricks.sdk import WorkspaceClient
import databricks.sdk.service.jobs as j
w = WorkspaceClient()
# create a dummy file on DBFS that just sleeps for 10 seconds
py_on_dbfs = f'/home/{w.current_user.me().user_name}/sample.py'
with w.dbfs.open(py_on_dbfs, write=True, overwrite=True) as f:
f.write(b'import time; time.sleep(10); print("Hello, World!")')
# trigger one-time-run job and get waiter object
waiter = w.jobs.submit(run_name=f'py-sdk-run-{time.time()}', tasks=[
j.RunSubmitTaskSettings(
task_key='hello_world',
new_cluster=j.BaseClusterInfo(
spark_version=w.clusters.select_spark_version(long_term_support=True),
node_type_id=w.clusters.select_node_type(local_disk=True),
num_workers=1
),
spark_python_task=j.SparkPythonTask(
python_file=f'dbfs:{py_on_dbfs}'
),
)
])
logging.info(f'starting to poll: {waiter.run_id}')
# callback, that receives a polled entity between state updates
def print_status(run: j.Run):
statuses = [f'{t.task_key}: {t.state.life_cycle_state}' for t in run.tasks]
logging.info(f'workflow intermediate status: {", ".join(statuses)}')
# If you want to perform polling in a separate thread, process, or service,
# you can use w.jobs.wait_get_run_job_terminated_or_skipped(
# run_id=waiter.run_id,
# timeout=datetime.timedelta(minutes=15),
# callback=print_status) to achieve the same results.
#
# Waiter interface allows for `w.jobs.submit(..).result()` simplicity in
# the scenarios, where you need to block the calling thread for the job to finish.
run = waiter.result(timeout=datetime.timedelta(minutes=15),
callback=print_status)
logging.info(f'job finished: {run.run_page_url}')
```
## Paginated responses<a id="paginated-responses"></a>
On the platform side the Databricks APIs have different wait to deal with pagination:
* Some APIs follow the offset-plus-limit pagination
* Some start their offsets from 0 and some from 1
* Some use the cursor-based iteration
* Others just return all results in a single response
The Databricks SDK for Python hides this complexity
under `Iterator[T]` abstraction, where multi-page results `yield` items. Python typing helps to auto-complete
the individual item fields.
```python
import logging
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
for repo in w.repos.list():
logging.info(f'Found repo: {repo.path}')
```
Please look at the `examples/last_job_runs.py` for a more advanced usage:
```python
import logging
from collections import defaultdict
from datetime import datetime, timezone
from databricks.sdk import WorkspaceClient
latest_state = {}
all_jobs = {}
durations = defaultdict(list)
w = WorkspaceClient()
for job in w.jobs.list():
all_jobs[job.job_id] = job
for run in w.jobs.list_runs(job_id=job.job_id, expand_tasks=False):
durations[job.job_id].append(run.run_duration)
if job.job_id not in latest_state:
latest_state[job.job_id] = run
continue
if run.end_time < latest_state[job.job_id].end_time:
continue
latest_state[job.job_id] = run
summary = []
for job_id, run in latest_state.items():
summary.append({
'job_name': all_jobs[job_id].settings.name,
'last_status': run.state.result_state,
'last_finished': datetime.fromtimestamp(run.end_time/1000, timezone.utc),
'average_duration': sum(durations[job_id]) / len(durations[job_id])
})
for line in sorted(summary, key=lambda s: s['last_finished'], reverse=True):
logging.info(f'Latest: {line}')
```
## Retries<a id="retries"></a>
The SDK automatically retries failed requests that are safe to retry. This includes HTTP 429 (Too Many Requests) and 503 (Service Unavailable) responses, as well as network-level errors such as connection resets and timeouts. The SDK uses a backoff strategy with jitter between retry attempts to avoid overwhelming the service. Retry behavior can be adjusted through the SDK configuration.
## Single-Sign-On (SSO) with OAuth<a id="single-sign-on-sso-with-oauth"></a>
### Authorization Code flow with PKCE
For a regular web app running on a server, it's recommended to use the Authorization Code Flow to obtain an Access Token
and a Refresh Token. This method is considered safe because the Access Token is transmitted directly to the server
hosting the app, without passing through the user's web browser and risking exposure.
To enhance the security of the Authorization Code Flow, the PKCE (Proof Key for Code Exchange) mechanism can be
employed. With PKCE, the calling application generates a secret called the Code Verifier, which is verified by
the authorization server. The app also creates a transform value of the Code Verifier, called the Code Challenge,
and sends it over HTTPS to obtain an Authorization Code. By intercepting the Authorization Code, a malicious attacker
cannot exchange it for a token without possessing the Code Verifier.
The [presented sample](https://github.com/databricks/databricks-sdk-py/blob/main/examples/flask_app_with_oauth.py)
is a Python3 script that uses the Flask web framework along with Databricks SDK for Python to demonstrate how to
implement the OAuth Authorization Code flow with PKCE security. It can be used to build an app where each user uses
their identity to access Databricks resources. The script can be executed with or without client and secret credentials
for a custom OAuth app.
Databricks SDK for Python exposes the `oauth_client.initiate_consent()` helper to acquire user redirect URL and initiate
PKCE state verification. Application developers are expected to persist `RefreshableCredentials` in the webapp session
and restore it via `RefreshableCredentials.from_dict(oauth_client, session['creds'])` helpers.
Works for both AWS and Azure. Not supported for GCP at the moment.
```python
from databricks.sdk.oauth import OAuthClient
oauth_client = OAuthClient(host='<workspace-url>',
client_id='<oauth client ID>',
redirect_url=f'http://host.domain/callback',
scopes=['clusters'])
import secrets
from flask import Flask, render_template_string, request, redirect, url_for, session
APP_NAME = 'flask-demo'
app = Flask(APP_NAME)
app.secret_key = secrets.token_urlsafe(32)
@app.route('/callback')
def callback():
from databricks.sdk.oauth import Consent
consent = Consent.from_dict(oauth_client, session['consent'])
session['creds'] = consent.exchange_callback_parameters(request.args).as_dict()
return redirect(url_for('index'))
@app.route('/')
def index():
if 'creds' not in session:
consent = oauth_client.initiate_consent()
session['consent'] = consent.as_dict()
return redirect(consent.auth_url)
from databricks.sdk import WorkspaceClient
from databricks.sdk.oauth import SessionCredentials
credentials_provider = SessionCredentials.from_dict(oauth_client, session['creds'])
workspace_client = WorkspaceClient(host=oauth_client.host,
product=APP_NAME,
credentials_provider=credentials_provider)
return render_template_string('...', w=workspace_client)
```
### SSO for local scripts on development machines
For applications, that do run on developer workstations, Databricks SDK for Python provides `auth_type='external-browser'`
utility, that opens up a browser for a user to go through SSO flow. Azure support is still in the early experimental
stage.
```python
from databricks.sdk import WorkspaceClient
host = input('Enter Databricks host: ')
w = WorkspaceClient(host=host, auth_type='external-browser')
clusters = w.clusters.list()
for cl in clusters:
print(f' - {cl.cluster_name} is {cl.state}')
```
### Creating custom OAuth applications
In order to use OAuth with Databricks SDK for Python, you should use `account_client.custom_app_integration.create` API.
```python
import logging, getpass
from databricks.sdk import AccountClient
account_client = AccountClient(host='https://accounts.cloud.databricks.com',
account_id=input('Databricks Account ID: '),
username=input('Username: '),
password=getpass.getpass('Password: '))
logging.info('Enrolling all published apps...')
account_client.o_auth_enrollment.create(enable_all_published_apps=True)
status = account_client.o_auth_enrollment.get()
logging.info(f'Enrolled all published apps: {status}')
custom_app = account_client.custom_app_integration.create(
name='awesome-app',
redirect_urls=[f'https://host.domain/path/to/callback'],
confidential=True)
logging.info(f'Created new custom app: '
f'--client_id {custom_app.client_id} '
f'--client_secret {custom_app.client_secret}')
```
## User Agent Request Attribution<a id="user-agent-request-attribution"></a>
The Databricks SDK for Python uses the `User-Agent` header to include request metadata along with each request. By default, this includes the version of the Python SDK, the version of the Python language used by your application, and the underlying operating system. To statically add additional metadata, you can use the `with_partner()` and `with_product()` functions in the `databricks.sdk.useragent` module. `with_partner()` can be used by partners to indicate that code using the Databricks SDK for Go should be attributed to a specific partner. Multiple partners can be registered at once. Partner names can contain any number, digit, `.`, `-`, `_` or `+`.
```python
from databricks.sdk import useragent
useragent.with_product("partner-abc")
useragent.with_partner("partner-xyz")
```
`with_product()` can be used to define the name and version of the product that is built with the Databricks SDK for Python. The product name has the same restrictions as the partner name above, and the product version must be a valid [SemVer](https://semver.org/). Subsequent calls to `with_product()` replace the original product with the new user-specified one.
```go
from databricks.sdk import useragent
useragent.with_product("databricks-example-product", "1.2.0")
```
If both the `DATABRICKS_SDK_UPSTREAM` and `DATABRICKS_SDK_UPSTREAM_VERSION` environment variables are defined, these will also be included in the `User-Agent` header.
If additional metadata needs to be specified that isn't already supported by the above interfaces, you can use the `with_user_agent_extra()` function to register arbitrary key-value pairs to include in the user agent. Multiple values associated with the same key are allowed. Keys have the same restrictions as the partner name above. Values must be either as described above or SemVer strings.
Additional `User-Agent` information can be associated with different instances of `DatabricksConfig`. To add metadata to a specific instance of `DatabricksConfig`, use the `with_user_agent_extra()` method.
## Error handling<a id="error-handling"></a>
The Databricks SDK for Python provides a robust error-handling mechanism that allows developers to catch and handle API errors. When an error occurs, the SDK will raise an exception that contains information about the error, such as the HTTP status code, error message, and error details. Developers can catch these exceptions and handle them appropriately in their code.
```python
from databricks.sdk import WorkspaceClient
from databricks.sdk.errors import ResourceDoesNotExist
w = WorkspaceClient()
try:
w.clusters.get(cluster_id='1234-5678-9012')
except ResourceDoesNotExist as e:
print(f'Cluster not found: {e}')
```
The SDK handles inconsistencies in error responses amongst the different services, providing a consistent interface for developers to work with. Simply catch the appropriate exception type and handle the error as needed. The errors returned by the Databricks API are defined in [databricks/sdk/errors/platform.py](https://github.com/databricks/databricks-sdk-py/blob/main/databricks/sdk/errors/platform.py).
## Logging<a id="logging"></a>
The Databricks SDK for Python seamlessly integrates with the standard [Logging facility for Python](https://docs.python.org/3/library/logging.html).
This allows developers to easily enable and customize logging for their Databricks Python projects.
To enable debug logging in your Databricks Python project, you can follow the example below:
```python
import logging, sys
logging.basicConfig(stream=sys.stderr,
level=logging.INFO,
format='%(asctime)s [%(name)s][%(levelname)s] %(message)s')
logging.getLogger('databricks.sdk').setLevel(logging.DEBUG)
from databricks.sdk import WorkspaceClient
w = WorkspaceClient(debug_truncate_bytes=1024, debug_headers=False)
for cluster in w.clusters.list():
logging.info(f'Found cluster: {cluster.cluster_name}')
```
In the above code snippet, the logging module is imported and the `basicConfig()` method is used to set the logging level to `DEBUG`.
This will enable logging at the debug level and above. Developers can adjust the logging level as needed to control the verbosity of the logging output.
The SDK will log all requests and responses to standard error output, using the format `> ` for requests and `< ` for responses.
In some cases, requests or responses may be truncated due to size considerations. If this occurs, the log message will include
the text `... (XXX additional elements)` to indicate that the request or response has been truncated. To increase the truncation limits,
developers can set the `debug_truncate_bytes` configuration property or the `DATABRICKS_DEBUG_TRUNCATE_BYTES` environment variable.
To protect sensitive data, such as authentication tokens, passwords, or any HTTP headers, the SDK will automatically replace these
values with `**REDACTED**` in the log output. Developers can disable this redaction by setting the `debug_headers` configuration property to `True`.
```text
2023-03-22 21:19:21,702 [databricks.sdk][DEBUG] GET /api/2.0/clusters/list
< 200 OK
< {
< "clusters": [
< {
< "autotermination_minutes": 60,
< "cluster_id": "1109-115255-s1w13zjj",
< "cluster_name": "DEFAULT Test Cluster",
< ... truncated for brevity
< },
< "... (47 additional elements)"
< ]
< }
```
Overall, the logging capabilities provided by the Databricks SDK for Python can be a powerful tool for monitoring and troubleshooting your
Databricks Python projects. Developers can use the various logging methods and configuration options provided by the SDK to customize
the logging output to their specific needs.
## Interaction with `dbutils`<a id="interaction-with-dbutils"></a>
You can use the client-side implementation of [`dbutils`](https://docs.databricks.com/dev-tools/databricks-utils.html) by accessing `dbutils` property on the `WorkspaceClient`.
Most of the `dbutils.fs` operations and `dbutils.secrets` are implemented natively in Python within Databricks SDK. Non-SDK implementations still require a Databricks cluster,
that you have to specify through the `cluster_id` configuration attribute or `DATABRICKS_CLUSTER_ID` environment variable. Don't worry if cluster is not running: internally,
Databricks SDK for Python calls `w.clusters.ensure_cluster_is_running()`.
```python
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
dbutils = w.dbutils
files_in_root = dbutils.fs.ls('/')
print(f'number of files in root: {len(files_in_root)}')
```
Alternatively, you can import `dbutils` from `databricks.sdk.runtime` module, but you have to make sure that all configuration is already [present in the environment variables](#default-authentication-flow):
```python
from databricks.sdk.runtime import dbutils
for secret_scope in dbutils.secrets.listScopes():
for secret_metadata in dbutils.secrets.list(secret_scope.name):
print(f'found {secret_metadata.key} secret in {secret_scope.name} scope')
```
## Interface stability<a id="interface-stability"></a>
Databricks is actively working on stabilizing the Databricks SDK for Python's interfaces.
API clients for all services are generated from specification files that are synchronized from the main platform.
You are highly encouraged to pin the exact dependency version and read the [changelog](https://github.com/databricks/databricks-sdk-py/blob/main/CHANGELOG.md)
where Databricks documents the changes. Databricks may have minor [documented](https://github.com/databricks/databricks-sdk-py/blob/main/CHANGELOG.md)
backward-incompatible changes, such as renaming some type names to bring more consistency.

View File

@@ -0,0 +1,168 @@
databricks/__init__.py,sha256=CF2MJcZFwbpn9TwQER8qnCDhkPooBGQNVkX4v7g6p3g,537
databricks/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/__init__.py,sha256=yP_tRSSYWZGkCOp5eGcBmjpFIQdcFwRNio6ttXFEZ98,69668
databricks/sdk/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/__pycache__/_base_client.cpython-39.pyc,,
databricks/sdk/__pycache__/_property.cpython-39.pyc,,
databricks/sdk/__pycache__/azure.cpython-39.pyc,,
databricks/sdk/__pycache__/casing.cpython-39.pyc,,
databricks/sdk/__pycache__/client_types.cpython-39.pyc,,
databricks/sdk/__pycache__/clock.cpython-39.pyc,,
databricks/sdk/__pycache__/config.cpython-39.pyc,,
databricks/sdk/__pycache__/core.cpython-39.pyc,,
databricks/sdk/__pycache__/credentials_provider.cpython-39.pyc,,
databricks/sdk/__pycache__/data_plane.cpython-39.pyc,,
databricks/sdk/__pycache__/dbutils.cpython-39.pyc,,
databricks/sdk/__pycache__/environments.cpython-39.pyc,,
databricks/sdk/__pycache__/oauth.cpython-39.pyc,,
databricks/sdk/__pycache__/oidc.cpython-39.pyc,,
databricks/sdk/__pycache__/oidc_token_supplier.cpython-39.pyc,,
databricks/sdk/__pycache__/retries.cpython-39.pyc,,
databricks/sdk/__pycache__/useragent.cpython-39.pyc,,
databricks/sdk/__pycache__/version.cpython-39.pyc,,
databricks/sdk/_base_client.py,sha256=EjFRrACf_uj1KFVDBx3pIkn2HFnFpXjW2tvCj70nQPY,15914
databricks/sdk/_property.py,sha256=ccbxhkXZmZOxbx2sqKMTzhVZDuvWXG0WPHFRgac6JAM,1701
databricks/sdk/_widgets/__init__.py,sha256=VhI-VvLlr3rKUT1nbROslHJIbmZX_tPJ9rRhrdFsYUA,2811
databricks/sdk/_widgets/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/_widgets/__pycache__/default_widgets_utils.cpython-39.pyc,,
databricks/sdk/_widgets/__pycache__/ipywidgets_utils.cpython-39.pyc,,
databricks/sdk/_widgets/default_widgets_utils.py,sha256=_hwCbptLbRzWEmknco0H1wQNAYcuy2pjFO9NiRbvFeo,1127
databricks/sdk/_widgets/ipywidgets_utils.py,sha256=mg3rEPG9z76e0yVjGgcLybUvd_zSuN5ziGeKiZ-c8Ew,2927
databricks/sdk/azure.py,sha256=sN_ARpmP9h1JovtiHIsDLtrVQP_K11eNDDtHS6PD19k,1015
databricks/sdk/casing.py,sha256=gZy-FlI7og5WNVX88Vb_7S1WeInwJLGws80CGj_9s48,1137
databricks/sdk/client_types.py,sha256=HsE0La_p3tcoSfIXQ2XxB0SmLG7khRuxz9GhUpgINHA,323
databricks/sdk/clock.py,sha256=Ivlow0r_TkXcTJ8UXkxSA0czKrY0GvwHAeOvjPkJnAQ,1360
databricks/sdk/common/__pycache__/lro.cpython-39.pyc,,
databricks/sdk/common/lro.py,sha256=82aRQxW7dH022TagaQtF3klRcdw9oMWEDLXnRSHGLh8,535
databricks/sdk/common/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
databricks/sdk/common/types/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/common/types/__pycache__/fieldmask.cpython-39.pyc,,
databricks/sdk/common/types/fieldmask.py,sha256=Hnl5Z56tYajCkrDNoyGkI3WFb3xaOD8lEnoeSxM39dc,1454
databricks/sdk/config.py,sha256=UjZqB2yxWgprVYliq7cV5OwSbc2_4FgM9j0cIqIMfpE,35477
databricks/sdk/core.py,sha256=GaLGj3fLuCX-vvfd-HyzdhsxL3T9XYfUZQ9wBv14XBg,3920
databricks/sdk/credentials_provider.py,sha256=6_4V1-xTizPL6z63Jk1MXhLs4PrFb87IfBCGNKqivJg,47488
databricks/sdk/data_plane.py,sha256=br5IPnOdE611IBubxP8xkUR9_qzbSRSYyVWSua6znWs,3109
databricks/sdk/dbutils.py,sha256=BOHZaZXg8R-wHrahOdzSqLd1ionRCl2nZFFuYJqAr38,16835
databricks/sdk/environments.py,sha256=9eVeb68cksqY2Lqwth2PJNmK0JEGdIjh-ebrrmUbqCc,3963
databricks/sdk/errors/__init__.py,sha256=WBEGgTRWM41A8VPGzIg59Ph5EVIH7n3rR3Jq3wa88A8,212
databricks/sdk/errors/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/base.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/customizer.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/deserializer.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/details.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/mapper.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/overrides.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/parser.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/platform.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/private_link.cpython-39.pyc,,
databricks/sdk/errors/__pycache__/sdk.cpython-39.pyc,,
databricks/sdk/errors/base.py,sha256=a6LymHcon3xq6FNNnpQRH5LgYNYvkLw9slWFQb_FOFM,4419
databricks/sdk/errors/customizer.py,sha256=6udVruRDB08VPy5oKn5kaHDqWQI4cwHVOzxU6MsgpOc,2211
databricks/sdk/errors/deserializer.py,sha256=yW0y9W4_lRySntCppoig2mWdWNXkp3VxXJrrRwGLfbU,4160
databricks/sdk/errors/details.py,sha256=jmH16Hp3tpjNt50YmjJaUJd4Apj2EPWTJGkMUltgnFk,12607
databricks/sdk/errors/mapper.py,sha256=yLjORwsIKK8EEOFXICpuPIO6Uq05dr4hXrucWPfT38s,1162
databricks/sdk/errors/overrides.py,sha256=UsHxtmPxODxbo10jFkErmpp1Y2HNBje4guv7GRgK68w,1433
databricks/sdk/errors/parser.py,sha256=V3SzX7q_W4OwBkQdlZ30Mqzi_GhXpiTNR7lF9hs0qHQ,4852
databricks/sdk/errors/platform.py,sha256=cDpdXbl5R9B-8tGotDzSp0KxIHUtY-b49qJziTEqreg,3113
databricks/sdk/errors/private_link.py,sha256=hte6AZKH262Fz2I2rsMHr0J_MJHOFrHExdFXY7SOh-k,2193
databricks/sdk/errors/sdk.py,sha256=_euMruhvquB0v_SKtgqxJUiyXHWuTb4Jl7ji6_h0E_A,109
databricks/sdk/logger/__init__.py,sha256=0_sSQfDkaFGqMHZUVw-g_Ax-RFmOv0Z6NjxCVAeUSO0,41
databricks/sdk/logger/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/logger/__pycache__/round_trip_logger.cpython-39.pyc,,
databricks/sdk/logger/round_trip_logger.py,sha256=H2YhxUPZpWSwAwCdfa03D5vRUFxsV73bbM8eF_l9QrQ,4873
databricks/sdk/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
databricks/sdk/mixins/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/compute.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/files.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/files_utils.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/jobs.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/open_ai_client.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/sharing.cpython-39.pyc,,
databricks/sdk/mixins/__pycache__/workspace.cpython-39.pyc,,
databricks/sdk/mixins/compute.py,sha256=76Fhc7cDQfOf2IHkPtHZpAnxNfrSLMKl9dbQ6KswXaM,11066
databricks/sdk/mixins/files.py,sha256=4GAeZq3cjLsZ7K-JiVaTZpwPFGC7V3cSFY6a7Ldg_Pc,108389
databricks/sdk/mixins/files_utils.py,sha256=mF1FMuPj3-m5qdOrGTolVM8rCFhLyGYw_LBktszP_Ls,11198
databricks/sdk/mixins/jobs.py,sha256=4ywi0dZ8mEN8KZWLmZBFfdbejTP6JATvf9wCCRkdJBw,11558
databricks/sdk/mixins/open_ai_client.py,sha256=H-D3jV3oahNEnNI-NLT01lUvcnIam-6MmpfWFJhXv4M,9501
databricks/sdk/mixins/sharing.py,sha256=5XMiZb-bh5DqmJe-E6J44tuf7TYkcMZUHI41ZubKjFo,2132
databricks/sdk/mixins/workspace.py,sha256=sgahprJIPLAxTvikHd9Wq2ifBW1Mcc5qz9u6EB-qm7w,4958
databricks/sdk/oauth.py,sha256=n9nAbZXPIpxl6weq_s7Pb3VvXMkno1qv6PqjFVYWvbs,34362
databricks/sdk/oidc.py,sha256=DjIrcsZITcHXHsSBjquVx-J7GnRcIYLjGScwd8e7gYY,6042
databricks/sdk/oidc_token_supplier.py,sha256=2cpcmcfVNF6KXD9mBXFWV9IpH2gNTF7ITUBkJP-BcUg,5040
databricks/sdk/py.typed,sha256=pSvaHpbY1UPNEXyVFUjlgBhjPFZMmVC_UNrPC7eMOHI,74
databricks/sdk/retries.py,sha256=md0zsIgp8bodMGdwbLADqSDltLXHNapyznGuI0l70qc,6058
databricks/sdk/runtime/__init__.py,sha256=6nthZxeYY1HjHieQcP7kXVLIId7w2yfHpZRXXtDLDAc,7333
databricks/sdk/runtime/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/runtime/__pycache__/dbutils_stub.cpython-39.pyc,,
databricks/sdk/runtime/dbutils_stub.py,sha256=S_pgWyGmwp3Ay-pMDEXccYsPwNVqCtz7MpD3fZVlHUA,11408
databricks/sdk/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
databricks/sdk/service/__pycache__/__init__.cpython-39.pyc,,
databricks/sdk/service/__pycache__/_internal.cpython-39.pyc,,
databricks/sdk/service/__pycache__/agentbricks.cpython-39.pyc,,
databricks/sdk/service/__pycache__/apps.cpython-39.pyc,,
databricks/sdk/service/__pycache__/billing.cpython-39.pyc,,
databricks/sdk/service/__pycache__/catalog.cpython-39.pyc,,
databricks/sdk/service/__pycache__/cleanrooms.cpython-39.pyc,,
databricks/sdk/service/__pycache__/compute.cpython-39.pyc,,
databricks/sdk/service/__pycache__/dashboards.cpython-39.pyc,,
databricks/sdk/service/__pycache__/database.cpython-39.pyc,,
databricks/sdk/service/__pycache__/dataquality.cpython-39.pyc,,
databricks/sdk/service/__pycache__/files.cpython-39.pyc,,
databricks/sdk/service/__pycache__/iam.cpython-39.pyc,,
databricks/sdk/service/__pycache__/iamv2.cpython-39.pyc,,
databricks/sdk/service/__pycache__/jobs.cpython-39.pyc,,
databricks/sdk/service/__pycache__/marketplace.cpython-39.pyc,,
databricks/sdk/service/__pycache__/ml.cpython-39.pyc,,
databricks/sdk/service/__pycache__/networking.cpython-39.pyc,,
databricks/sdk/service/__pycache__/oauth2.cpython-39.pyc,,
databricks/sdk/service/__pycache__/pipelines.cpython-39.pyc,,
databricks/sdk/service/__pycache__/postgres.cpython-39.pyc,,
databricks/sdk/service/__pycache__/provisioning.cpython-39.pyc,,
databricks/sdk/service/__pycache__/qualitymonitorv2.cpython-39.pyc,,
databricks/sdk/service/__pycache__/serving.cpython-39.pyc,,
databricks/sdk/service/__pycache__/settings.cpython-39.pyc,,
databricks/sdk/service/__pycache__/settingsv2.cpython-39.pyc,,
databricks/sdk/service/__pycache__/sharing.cpython-39.pyc,,
databricks/sdk/service/__pycache__/sql.cpython-39.pyc,,
databricks/sdk/service/__pycache__/tags.cpython-39.pyc,,
databricks/sdk/service/__pycache__/vectorsearch.cpython-39.pyc,,
databricks/sdk/service/__pycache__/workspace.cpython-39.pyc,,
databricks/sdk/service/_internal.py,sha256=DQ-S6QxJUzzQO-fEmgs3z24_cKsFlT0CPDVTP3-ERCU,5192
databricks/sdk/service/agentbricks.py,sha256=KtZ3c1x5v1qQ98tBA2pUfGLyyDeEQ2AeLDxmuhOEll8,12733
databricks/sdk/service/apps.py,sha256=TESQ581pA-pRfkr-6BeggrqSdsZXCXFb8e4g7vMGQAY,140909
databricks/sdk/service/billing.py,sha256=PARsxBPzcMwCHJ3jEoAvGssSLzHer-I6VQbwsFLvgNE,91573
databricks/sdk/service/catalog.py,sha256=EPgewClact55Tw3HkrelTHWdXhmauVHW3caMHvGoOnw,715479
databricks/sdk/service/cleanrooms.py,sha256=OpWjOkXpGc5thqAGaLpvl7ko2p_9Lbf0rnEnLNmIvwk,84449
databricks/sdk/service/compute.py,sha256=np2_Eqnbbzj0Uw5f-6mfalNuLWfI3wsW4m2aBwW1v9A,490751
databricks/sdk/service/dashboards.py,sha256=ROx7LKxVFKINQa1e36Vd3oMNN90FgCrddow0txmlag0,123952
databricks/sdk/service/database.py,sha256=-9-EL8UrwexLUEs9LB98B9GPMqIcipO-DxLvEiRgaBc,96296
databricks/sdk/service/dataquality.py,sha256=jb_RBlkRXiCrvXU_lqJJcUN8bZIo4R6YNztvGY9api8,59722
databricks/sdk/service/files.py,sha256=AQG7P0BLtmxjg6hg6mX80FmaXANFSFe2NjjYi069pSA,38994
databricks/sdk/service/iam.py,sha256=fpBAu1EMditeIaMSC022Xuo_45RvSs4Fjo0BjCK9GOA,252128
databricks/sdk/service/iamv2.py,sha256=-Iu1UffdPHTeeFL4JKKT8fQnrq1U1xSm6Q3x4BpkTQs,24812
databricks/sdk/service/jobs.py,sha256=E7MycYsIyHfW_gmABrjOtDPLWFP9Fxp5HWKKWdJqgBc,445625
databricks/sdk/service/marketplace.py,sha256=TYqAkOv98W1vCCTUtnyxq3X1PxVGYnoHoU8fRz1up3w,161277
databricks/sdk/service/ml.py,sha256=DSpDl8DXMpQiXxTEwxpxw5rSUaFm1QGWF9uRJvqdZSM,377655
databricks/sdk/service/networking.py,sha256=NCAJCqmOD0FlpL3C2hmJgorB_C2KQKpz6-Wv1-9RuhA,11710
databricks/sdk/service/oauth2.py,sha256=obMOU5ndpxnhdVxyCnCrqR-kiZktdwiWaKf3LpdhlnI,77391
databricks/sdk/service/pipelines.py,sha256=83klHezPwcGE11WQJafvHlDS2lndRP5Cn_wH6JK9VqY,196755
databricks/sdk/service/postgres.py,sha256=4-X2A1O3rk9FKx8JNkr2v2lT_f26wWcAHv0oxU0c8u4,132040
databricks/sdk/service/provisioning.py,sha256=c6Qe3lURPU442pnerg28HZ88JHgH9-nmPor9rMiMKMo,123904
databricks/sdk/service/qualitymonitorv2.py,sha256=qwYijCmy2Bqsn2KNTqyo2dp52YIUHfzAo64KrkzKJwM,17600
databricks/sdk/service/serving.py,sha256=ViZhisG4Qntxq1yHGTP4iuWpvqKXdb-D_EMpWDh0oTI,222874
databricks/sdk/service/settings.py,sha256=4xSnnSTMJlM0WFCZxvDTu3-lAUAx1UhRciFuYg_YjHk,386076
databricks/sdk/service/settingsv2.py,sha256=rzlXboQ7HfhkoKQawjXqGlmEfB0R9DsXfi5RfgNuG6M,49909
databricks/sdk/service/sharing.py,sha256=r65lalAG9_Pu8c0TeSMceFN1qX71-CXkBmZ0gJDDV5M,142601
databricks/sdk/service/sql.py,sha256=jFMOItbpHtqoRFwL35c_MHpG_jkcSn-fUFOr38BxiG0,428502
databricks/sdk/service/tags.py,sha256=h9Eg8RlveLjk6_Nnl_3xEEeI_UMUVZAYMAuBWJI4L50,21793
databricks/sdk/service/vectorsearch.py,sha256=X-s9y_HJ00ycO6fUV72RzUyIeoBk-4GZaKCsFZEqzI8,87289
databricks/sdk/service/workspace.py,sha256=Cg7LJb6AuDpWNc9agxAepKEPIXVq8HvUqeW25-7HjjE,120074
databricks/sdk/useragent.py,sha256=4u6VyMDRkFqasZhbhOskDNaQQfChlm2M9U745UGXh34,7407
databricks/sdk/version.py,sha256=BbCpQB0IaKmq_fOtysTb_iVtvqbH-vHS1DoS1eLd4w8,23
databricks_sdk-0.94.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
databricks_sdk-0.94.0.dist-info/METADATA,sha256=45CufkIbAvfAoxsUgVUsqJu3G8wFabAcKUmK2usF1D8,40588
databricks_sdk-0.94.0.dist-info/RECORD,,
databricks_sdk-0.94.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
databricks_sdk-0.94.0.dist-info/licenses/LICENSE,sha256=afBgTZo-JsYqj4VOjnejBetMuHKcFR30YobDdpVFkqY,11411
databricks_sdk-0.94.0.dist-info/licenses/NOTICE,sha256=tkRcQYA1k68wDLcnOWbg2xJDsUOJw8G8DGBhb8dnI3w,1588
databricks_sdk-0.94.0.dist-info/top_level.txt,sha256=7kRdatoSgU0EUurRQJ_3F1Nv4EOSHWAr6ng25tJOJKU,11

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (82.0.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1,203 @@
Copyright 2023 Databricks, Inc. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,33 @@
Copyright (2023) Databricks, Inc.
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
This Software contains code from the following open source projects, licensed under the Apache 2.0 license:
psf/requests - https://github.com/psf/requests
Copyright 2019 Kenneth Reitz
License - https://github.com/psf/requests/blob/main/LICENSE
googleapis/google-auth-library-python - https://github.com/googleapis/google-auth-library-python/tree/main
Copyright google-auth-library-python authors
License - https://github.com/googleapis/google-auth-library-python/blob/main/LICENSE
openai/openai-python - https://github.com/openai/openai-python
Copyright 2024 OpenAI
License - https://github.com/openai/openai-python/blob/main/LICENSE
This software contains code from the following open source projects, licensed under the BSD (3-clause) license.
x/oauth2 - https://cs.opensource.google/go/x/oauth2/+/master:oauth2.go
Copyright 2014 The Go Authors. All rights reserved.
License - https://cs.opensource.google/go/x/oauth2/+/master:LICENSE
encode/httpx - https://github.com/encode/httpx
Copyright 2019, Encode OSS Ltd
License - https://github.com/encode/httpx/blob/master/LICENSE.md
This software contains code from the following open source projects, licensed under the MIT license:
langchain-ai/langchain - https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai
Copyright 2023 LangChain, Inc.
License - https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/LICENSE

View File

@@ -0,0 +1 @@
databricks