Databricks SQL is a Python framework designed for easy interaction with Databricks SQL Endpoints. It provides a fluent API for building and executing SQL queries, simplifying data operations for Python developers. The library recently reached version 1.0.0, indicating a stable API after rapid initial development.
pip install databricks-sqlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to Databricks SQL using environment variables for authentication and perform a simple SELECT query. Replace `your_schema.users` with an actual table in your Databricks workspace. It highlights the fluent API pattern for query construction.
Ensure all imports are `from databricks_sql import ...`.
Verify that `DATABRICKS_SERVER_HOSTNAME`, `DATABRICKS_HTTP_PATH`, and `DATABRICKS_ACCESS_TOKEN` environment variables are correctly set, or pass the credentials directly as arguments to `DatabricksSQL()`.
Always append an execution method at the end of your query chain, e.g., `db_sql.select(...).from_table(...).fetch_all()`.
When debugging connection or low-level API issues, consider reviewing the `databricks-api` documentation or source code.