{"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,"search_vec":"'2.0':19 '3.14':35 '3.8':33 '4.2.6':24 'api':18 'arrow':40,50 'built':36 'connect':9 'connector':3,48 'core':4,6 'current':21 'data':43 'databas':47 'databrick':1,12,45 'db':17 'db-api':16 'effici':42 'frequent':26 'interfac':20 'librari':7 'month':30 'multipl':27 'per':29 'provid':14 'python':10,32 'releas':25,28 'sql':2,13,46 'support':31 'thrift':38,49 'transfer':44 'version':23","created_at":"2026-04-27T16:58:05.370307+00:00","updated_at":"2026-04-27T16:58:05.370307+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"4.0.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/databricks/databricks-sql-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/databricks-sql-connector-core/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","data","aws","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}