--- id: databricks-sqlalchemy version: "2.0.10" license: Apache-2.0 license_treatment: permissive maintenance: active --- # databricks-sqlalchemy — Databricks SQLAlchemy plugin for Python License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install databricks-sqlalchemy uv add databricks-sqlalchemy poetry add databricks-sqlalchemy ## Description ## Databricks dialect for SQLALchemy 2.0 The Databricks dialect for SQLAlchemy serves as bridge between [SQLAlchemy](https://www.sqlalchemy.org/) and the Databricks SQL Python driver. A working example demonstrating usage can be found in `sqlalchemy_example.py`. ## Installation To install the dialect and its dependencies: ```shell pip install databricks-sqlalchemy ``` If you also plan to use `alembic` you can alternatively run: ```shell pip install alembic ``` ## Connection String Every SQLAlchemy application that connects to a database needs to use an [Engine](https://docs.sqlalchemy.org/en/20/tutorial/engine.html#tutorial-engine), which you can create by passing a connection string to `create_engine`. The connection string must include these components: 1. Host 2. HTTP Path for a compute resource 3. API access token 4. Initial catalog for the connection 5. Initial schema for the connection **Note: Our dialect is built and tested on workspaces with Unity Catalog enabled. Support for the `hive_metastore` catalog is untested.** For example: ```python import os from sqlalchemy import create_engine host = os.getenv("DATABRICKS_SERVER_HOSTNAME") http_path =... ## AI interpretation — verify before relying A SQLAlchemy 2.0 dialect that bridges SQLAlchemy applications to Databricks SQL, enabling ORM and SQL expression language usage against Databricks warehouses and compute resources. Verdict: Active, well-maintained dialect for SQLAlchemy 2.0 on Databricks with low install friction and no known vulnerabilities. Apache-2.0 licensing is permissive. Suitable for production use; note that LargeBinary, PickleType, Enum, and CHECK constraints are not yet supported. [View on SkillFed](https://skillfed.io/packages/databricks-sqlalchemy) · [View on PyPI](https://pypi.org/project/databricks-sqlalchemy/)