{"id":21099,"library":"databricks-dbapi","title":"databricks-dbapi","description":"A DBAPI 2.0 interface and SQLAlchemy dialect for Databricks interactive clusters. Current version 0.6.0, supports Python >=2.7 (excludes 3.0-3.4). Release cadence is irregular; latest releases: 0.4.0, 0.5.0, 0.6.0.","status":"active","version":"0.6.0","language":"python","source_language":"en","source_url":"https://github.com/crflynn/databricks-dbapi","tags":["databricks","dbapi","sqlalchemy","hiveserver2","thrift"],"install":[{"cmd":"pip install databricks-dbapi","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Required for Thrift-based HiveServer2 connection","package":"thrift","optional":true},{"reason":"Required for HTTP-based connection","package":"requests","optional":true},{"reason":"Required for SQLAlchemy dialect support","package":"sqlalchemy","optional":true}],"imports":[{"note":"","wrong":"","symbol":"Connection","correct":"from databricks_dbapi import Connection"},{"note":"Use underscore, not dot","wrong":"import databricks.dbapi","symbol":"databricks_dbapi","correct":"import databricks_dbapi"},{"note":"create_engine is from SQLAlchemy; use dialect string 'databricks+http' or 'databricks+thrift'","wrong":"from databricks_dbapi.sqlalchemy import create_engine","symbol":"create_engine","correct":"from sqlalchemy import create_engine"}],"quickstart":{"code":"from databricks_dbapi import Connection\n\nconn = Connection(\n    server_hostname='your-databricks-instance.cloud.databricks.com',\n    http_path='/sql/1.0/warehouses/your-warehouse-id',\n    access_token=os.environ.get('DATABRICKS_TOKEN', '')\n)\ncursor = conn.cursor()\ncursor.execute('SELECT current_timestamp')\nprint(cursor.fetchall())","lang":"python","description":"Connect to Databricks interactive cluster using HTTP (default) with personal access token."},"warnings":[{"fix":"Use Python 3.6+ or pin to databricks-dbapi==0.4.0.","message":"Version 0.5.0 removed support for Python 3.5 and earlier; ensure Python 3.6+.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Connection(..., transport='thrift')","message":"The default connection uses HTTP (REST API), but if you need HiveServer2 Thrift, you must explicitly specify transport='thrift'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'databricks+http://' or 'databricks+thrift://' explicitly.","message":"The SQLAlchemy dialect uses 'databricks+http://' or 'databricks+thrift://'; the plain 'databricks://' prefix may be removed in future.","severity":"deprecated","affected_versions":"all"},{"fix":"Double-check server_hostname (e.g., 'dbc-...cloud.databricks.com') and http_path (from SQL Warehouse settings).","message":"Timeout errors often occur if server_hostname or http_path are incorrect; they are not validated until a query is run.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure you installed 'databricks-dbapi' (pip install databricks-dbapi) and import as 'databricks_dbapi'.","cause":"The package is named 'databricks-dbapi' on PyPI but import uses underscores.","error":"ImportError: No module named 'databricks_dbapi'"},{"fix":"Verify server_hostname includes port: 'host:443'. For HTTP, use transport='http' (default).","cause":"Thrift connection failure due to incorrect server_hostname, port (default 443), or network/firewall blocking.","error":"thrift.transport.TTransport.TTransportException: Could not connect to ..."},{"fix":"Update to >=0.5.0 or use 'token'=... in older versions.","cause":"Access token parameter was introduced in version 0.5.0; using older version expects 'token' instead.","error":"TypeError: __init__() got an unexpected keyword argument 'access_token'"},{"fix":"Use 'databricks+http://token:secret@host:443/path' or 'databricks+thrift://...'","cause":"Using non-standard prefix 'databricks://' without http or thrift.","error":"sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string 'databricks://...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}