{"id":2457,"library":"databricks-api","title":"Databricks API Client (Legacy)","description":"The `databricks-api` package provides a simplified Python interface for the Databricks REST API. It is auto-generated from the underlying client library used in the official `databricks-cli` Python package. This library is now deprecated, and users are strongly advised to migrate to the official `databricks-sdk` for ongoing development and support. The package saw its last release (0.9.0) in June 2023.","status":"deprecated","version":"0.9.0","language":"en","source_language":"en","source_url":"https://github.com/crflynn/databricks-api","tags":["databricks","api-client","cloud","etl","data-engineering","deprecated"],"install":[{"cmd":"pip install databricks-api","lang":"bash","label":"Install databricks-api"}],"dependencies":[{"reason":"This library is auto-generated from and relies on the databricks-cli package for its underlying client functionality.","package":"databricks-cli","optional":false}],"imports":[{"note":"The primary client class is directly available under the top-level package.","wrong":"from databricks_api.sdk import DatabricksAPI","symbol":"DatabricksAPI","correct":"from databricks_api import DatabricksAPI"}],"quickstart":{"code":"import os\nfrom databricks_api import DatabricksAPI\n\n# Databricks host and token should ideally be loaded from environment variables\n# For local testing, replace with your actual values if not set.\nDATABRICKS_HOST = os.environ.get(\"DATABRICKS_HOST\", \"https://<your-workspace-url>.cloud.databricks.com\")\nDATABRICKS_TOKEN = os.environ.get(\"DATABRICKS_TOKEN\", \"dapi<your-personal-access-token>\")\n\ntry:\n    # Initialize the Databricks API client\n    db = DatabricksAPI(host=DATABRICKS_HOST, token=DATABRICKS_TOKEN)\n\n    # Example: List all clusters in the workspace\n    print(\"Listing Databricks clusters...\")\n    clusters_response = db.cluster.list_clusters()\n    \n    if clusters_response and 'clusters' in clusters_response:\n        for cluster in clusters_response['clusters']:\n            print(f\"- {cluster['cluster_name']} (ID: {cluster['cluster_id']})\")\n    else:\n        print(\"No clusters found or error retrieving clusters.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure DATABRICKS_HOST and DATABRICKS_TOKEN environment variables are set correctly,\")\n    print(\"or provided directly to the DatabricksAPI constructor, and that your token has sufficient permissions.\")","lang":"python","description":"Initializes the `DatabricksAPI` client using a Databricks host URL and a Personal Access Token (PAT). It then demonstrates how to interact with a Databricks service (e.g., `cluster`) to list all available clusters in the workspace. Authentication credentials should be managed securely, preferably via environment variables."},"warnings":[{"fix":"Migrate your code to use the `databricks-sdk` by installing it (`pip install databricks-sdk`) and updating your imports and API calls as per its documentation.","message":"This library is deprecated. The project explicitly recommends switching to the official `databricks-sdk` for Python, which is actively maintained and provides comprehensive coverage of Databricks APIs. Continuing to use `databricks-api` may lead to unaddressed issues, lack of new features, or compatibility problems with newer Databricks API versions.","severity":"breaking","affected_versions":"All versions"},{"fix":"Verify that your Databricks host URL is correct and your Personal Access Token is valid and has the necessary permissions (e.g., 'Can Manage' for clusters, 'Can Read' for workspace objects). Set `DATABRICKS_HOST` and `DATABRICKS_TOKEN` environment variables or pass them explicitly.","message":"Authentication relies on providing `host` and `token` (Databricks Personal Access Token) either directly to the `DatabricksAPI` constructor or via environment variables (`DATABRICKS_HOST`, `DATABRICKS_TOKEN`). Incorrect values or insufficient permissions for the PAT will result in authentication or API access errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To use this or any Databricks API client, you typically need a full Databricks workspace on AWS, Azure, or GCP. For Community Edition, consider running ETL/API interaction code locally and uploading results.","message":"The Databricks Community Edition (free tier) has network restrictions that block outbound API calls to external services, including often the Databricks APIs themselves when accessed programmatically from outside the Databricks environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor changes in the Databricks REST API documentation and consider migrating to the official `databricks-sdk` which is actively maintained to stay compatible with the latest API versions.","message":"The `databricks-api` package is auto-generated based on `databricks-cli` version 0.17.0 for API version 2.0. Future changes in the underlying `databricks-cli` or updates to the Databricks API (beyond 2.0) may introduce undocumented breaking changes or inconsistencies in the `databricks-api` interface if it is not updated to reflect them.","severity":"gotcha","affected_versions":"All versions, especially with newer Databricks API features"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}