{"id":21100,"library":"databricks-sql-connector-core","title":"Databricks SQL Connector Core","description":"The core library for connecting Python to Databricks SQL, providing a DB-API 2.0 interface. Currently at version 4.2.6, released frequently (multiple releases per month). Supports Python 3.8 to 3.14. Built on Thrift and Arrow for efficient data transfer.","status":"active","version":"4.2.6","language":"python","source_language":"en","source_url":"https://github.com/databricks/databricks-sql-python","tags":["databricks","sql","database","connector","thrift","arrow"],"install":[{"cmd":"pip install databricks-sql-connector-core","lang":"bash","label":"Install core library"},{"cmd":"pip install databricks-sql-connector","lang":"bash","label":"Install full library (includes pandas extras)"}],"dependencies":[{"reason":"Optional for DataFrame result sets; required for fetchall_arrow() with pandas integration","package":"pandas","optional":true},{"reason":"Optional for SQLAlchemy dialect support","package":"sqlalchemy","optional":true}],"imports":[{"note":"The main package is 'databricks.sql', not the internal core module.","wrong":"from databricks_sql_connector_core import connect","symbol":"connect","correct":"from databricks import sql"}],"quickstart":{"code":"import os\nfrom databricks import sql\n\nconnection = sql.connect(\n    server_hostname=os.environ.get('DATABRICKS_SERVER_HOSTNAME', ''),\n    http_path=os.environ.get('DATABRICKS_HTTP_PATH', ''),\n    access_token=os.environ.get('DATABRICKS_TOKEN', ''),\n)\nwith connection.cursor() as cursor:\n    cursor.execute(\"SELECT 1 as col\")\n    result = cursor.fetchall()\n    print(result)\nconnection.close()","lang":"python","description":"Connect to Databricks SQL with personal access token and run a query."},"warnings":[{"fix":"Update any custom thrift code to be compatible with thrift 0.19.0. If you encounter 'thrift.protocol.TProtocolException', check your thrift version.","message":"Thrift dependency upgrade in 4.x: The library switched from thrift 0.16.0 to 0.19.0. Code that directly imports thrift or uses custom thrift transports may break.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Replace cursor.fetchall_arrow() with cursor.fetchall(). The returned type is now pyarrow.Table.","message":"fetchall_arrow() and fetchmany_arrow() are deprecated in favor of fetchall() and fetchmany() which return Arrow-backed results by default in v4.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Do not use SQLAlchemy connection strings directly; use databricks-sql-connector with SQLAlchemy dialect for that.","message":"Connection string format: 'databricks-sql-connector-core' does not support connection strings like 'databricks+pyodbc://...'. Use the programmatic connect() method with server_hostname, http_path, and access_token.","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":"Install the package and use 'from databricks import sql'.","cause":"Installed 'databricks-sql-connector-core' but importing incorrectly such as 'import databricks_sql_connector_core'.","error":"ModuleNotFoundError: No module named 'databricks'"},{"fix":"Set environment variables or pass non-None strings: server_hostname='abc.cloud.databricks.com', http_path='/sql/1.0/warehouses/...'.","cause":"Passing None for server_hostname or http_path in connect().","error":"pyarrow.lib.ArrowTypeError: Expected a string or bytes, got a 'NoneType'"},{"fix":"Verify server_hostname is correct (e.g., 'adb-...azuredatabricks.net') and that your network can reach the Databricks workspace. Check firewall/proxy settings.","cause":"Invalid server_hostname or network connectivity issue, or wrong port (default 443 but custom allowed).","error":"thrift.transport.TTransport.TTransportException: Could not connect to..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}