sqlalchemy-databricks
A SQLAlchemy Dialect for Databricks using the officially supported databricks-sql-connector
dbapi. Compatible with workspace and sql analytics clusters. (Thanks to @Tom-Newton for pointing this out)
Installation
Install using pip.
pip install sqlalchemy-databricks
Usage
Installing registers the databricks+connector
dialect/driver with SQLAlchemy. Fill in the required information when passing the engine URL. The http path can be for either a workspace or sql analytics cluster.
from sqlalchemy import * from sqlalchemy.engine import create_engine engine = create_engine( "databricks+connector://token:@ , connect_args={"http_path": ":443/default" " } ) logs = Table("my_table", MetaData(bind=engine), autoload=True) print(select([func.count("*")], from_obj=logs).scalar())