Databricks SDK for Python

raw JSON →
0.126.0 verified Tue May 12 auth: no python install: verified quickstart: stale

The Databricks SDK for Python is the official client library for interacting with the Databricks Lakehouse platform. It provides a comprehensive interface for all public Databricks REST API operations, designed for robust and intelligent retries, and aims to accelerate development with Python. As of April 2026, it is actively maintained with frequent releases, currently in a Beta status but supported for production use cases.

pip install databricks-sdk
error Error: Unable to parse response
cause This error typically indicates an issue with the Databricks SDK for Python's authentication configuration, where the SDK cannot properly interpret the response from the Databricks API.
fix
Verify that your Databricks host URL is correctly set and that the authentication method (e.g., personal access token, Azure AD credentials, environment variables, or .databrickscfg profile) has the required permissions for the API operation. Ensure no firewalls or private link configurations are redirecting API traffic to login pages.
error ModuleNotFoundError: No module named 'databricks.sdk'
cause This error occurs when the `databricks-sdk` package is not installed in the Python environment where the code is being executed, or the environment is not correctly configured to find the installed package.
fix
Install the Databricks SDK for Python using pip: pip install databricks-sdk. If running in a Databricks notebook, ensure the library is attached to the cluster or upgrade to a Databricks Runtime version where it's pre-installed, then use %pip install --upgrade databricks-sdk and dbutils.library.restartPython() if necessary.
error ImportError: cannot import name '...' from 'databricks.sdk.core'
cause This error often arises due to a version mismatch where your installed `databricks-sdk` version is older or newer than the version expected by the code, meaning the specific object or function you are trying to import has been renamed, moved, or removed in a different SDK version.
fix
Upgrade the databricks-sdk to the latest version using pip install --upgrade databricks-sdk or downgrade to a specific compatible version if your code relies on an older API. Consult the databricks-sdk changelog or documentation for breaking changes related to the imported object.
error AttributeError: 'dict' object has no attribute 'as_dict'
cause This error occurs when you are passing a plain Python dictionary to a Databricks SDK method that expects a specific SDK data class or object, which often has an `as_dict` method for internal serialization.
fix
Instead of passing a dictionary, instantiate the appropriate Databricks SDK data class (e.g., clusters.CreateCluster, statement_execution.Statement, or relevant service-specific request objects) and populate it with your data. Convert your dictionary to the expected SDK object type.
error databricks.sdk.errors.mapping.PermissionDenied: No operations allowed on this path...
cause This `PermissionDenied` error indicates that the authenticated user or service principal lacks the necessary access rights (e.g., 'CAN USE', 'CAN MANAGE', 'EXECUTE') to perform the requested operation on the specified resource or path within Databricks.
fix
Verify that the identity used for authentication has the correct and sufficient permissions (e.g., CAN USE on clusters, EXECUTE on models, or appropriate access on files/paths) configured in Databricks. For service principals, ensure Git credentials and job permissions are also correctly set.
deprecated The older `databricks-api` package is deprecated. Users should switch to the official `databricks-sdk` for all new and existing projects to leverage modern features and continued support.
fix Uninstall `databricks-api` and install `databricks-sdk`: `pip uninstall databricks-api && pip install databricks-sdk`. Update imports from `databricks_api` to `databricks.sdk`.
breaking The `databricks-sdk` is currently in Beta, meaning its interface is subject to change across versions. Numerous breaking changes have been documented in release changelogs.
fix Always consult the official GitHub CHANGELOG or PyPI release history before upgrading to understand API changes and necessary code modifications. Pinning to a specific minor version (`pip install databricks-sdk==X.Y.Z`) is recommended for production environments.
gotcha When deploying Python libraries as part of Databricks jobs, it is highly recommended to specify the exact library version (e.g., `databricks-sdk==0.126.0`). Failing to do so can lead to non-reproducible environments or unexpected breaking changes if a new library version is released between job runs.
fix Explicitly define library versions in your `requirements.txt` or Databricks job configurations. Regularly test upgrades in a staging environment.
gotcha Common issues with installing PyPI libraries on Databricks clusters include network connectivity problems, insufficient cluster resources (disk, memory, CPU), incompatibility with the Databricks Runtime version, issues with private PyPI repository configurations (e.g., authentication, index URLs), or pip caching conflicts.
fix Verify network access, ensure adequate cluster resources, confirm library compatibility with your Databricks Runtime. For private PyPI, use init scripts to configure `pip config` with `extra-index-url` and secure credentials via Databricks Secrets. For persistent issues, clear pip cache using `--no-cache-dir`.
deprecated Storing library files in the DBFS root is deprecated and disabled by default in Databricks Runtime 15.1 and above due to security concerns.
fix Upload all libraries to workspace files, Unity Catalog volumes, or use supported library package repositories (PyPI, Maven, CRAN).
%pip install databricks-sdk
python os / libc status wheel install import disk
3.10 alpine (musl) - - 3.30s 52.8M
3.10 slim (glibc) - - 2.27s 54M
3.11 alpine (musl) - - 6.25s 58.5M
3.11 slim (glibc) - - 5.05s 59M
3.12 alpine (musl) - - 5.22s 49.8M
3.12 slim (glibc) - - 5.05s 51M
3.13 alpine (musl) - - 4.97s 49.5M
3.13 slim (glibc) - - 4.61s 50M
3.9 alpine (musl) - - 2.96s 53.1M
3.9 slim (glibc) - - 2.55s 54M

This quickstart initializes the Databricks SDK's WorkspaceClient and lists available clusters. It assumes Databricks authentication is configured, typically via environment variables (DATABRICKS_HOST, DATABRICKS_TOKEN) or a .databrickscfg file.

import os
from databricks.sdk import WorkspaceClient

# Databricks SDK automatically handles authentication via environment variables
# (DATABRICKS_HOST, DATABRICKS_TOKEN) or .databrickscfg file.
# Ensure these are set in your environment or Databricks workspace.
# For local development, you might set:
# os.environ['DATABRICKS_HOST'] = 'https://<your-databricks-instance>'
# os.environ['DATABRICKS_TOKEN'] = os.environ.get('DATABRICKS_TOKEN', 'YOUR_DATABRICKS_PAT')

w = WorkspaceClient()

print("Listing clusters:")
for c in w.clusters.list():
    print(f"  - {c.cluster_name} (ID: {c.cluster_id})")