{"id":18400637,"url":"https://github.com/databricks/databricks-sql-python","last_synced_at":"2026-01-08T11:12:26.302Z","repository":{"id":40817219,"uuid":"493695132","full_name":"databricks/databricks-sql-python","owner":"databricks","description":"Databricks SQL Connector for Python","archived":false,"fork":false,"pushed_at":"2025-04-08T07:17:16.000Z","size":2208,"stargazers_count":185,"open_issues_count":92,"forks_count":102,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-04-10T06:52:20.385Z","etag":null,"topics":["databricks","dwh","python3","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/databricks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-18T14:20:03.000Z","updated_at":"2025-04-04T03:59:13.000Z","dependencies_parsed_at":"2023-09-27T01:14:53.948Z","dependency_job_id":"9c4b00c6-788d-45d8-8865-0f655ea06dd6","html_url":"https://github.com/databricks/databricks-sql-python","commit_stats":{"total_commits":269,"total_committers":46,"mean_commits":"5.8478260869565215","dds":0.5985130111524164,"last_synced_commit":"ecdddba46a49c5122a5f8d5694b6b148466165d5"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/databricks","download_url":"https://codeload.github.com/databricks/databricks-sql-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248173856,"owners_count":21059594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["databricks","dwh","python3","sql"],"created_at":"2024-11-06T02:35:33.449Z","updated_at":"2026-01-08T11:12:26.297Z","avatar_url":"https://github.com/databricks.png","language":"Python","readme":"# Databricks SQL Connector for Python\n\n[![PyPI](https://img.shields.io/pypi/v/databricks-sql-connector?style=flat-square)](https://pypi.org/project/databricks-sql-connector/)\n[![Downloads](https://pepy.tech/badge/databricks-sql-connector)](https://pepy.tech/project/databricks-sql-connector)\n\nThe Databricks SQL Connector for Python allows you to develop Python applications that connect to Databricks clusters and SQL warehouses. It is a Thrift-based client with no dependencies on ODBC or JDBC. It conforms to the [Python DB API 2.0 specification](https://www.python.org/dev/peps/pep-0249/).\n\nThis connector uses Arrow as the data-exchange format, and supports APIs (e.g. `fetchmany_arrow`) to directly fetch Arrow tables. Arrow tables are wrapped in the `ArrowQueue` class to provide a natural API to get several rows at a time. [PyArrow](https://arrow.apache.org/docs/python/index.html) is required to enable this and use these APIs, you can install it via  `pip install pyarrow` or `pip install databricks-sql-connector[pyarrow]`.\n\nThe connector includes built-in support for HTTP/HTTPS proxy servers with multiple authentication methods including basic authentication and Kerberos/Negotiate authentication. See `docs/proxy.md` and `examples/proxy_authentication.py` for details.\n\nYou are welcome to file an issue here for general use cases. You can also contact Databricks Support [here](help.databricks.com).\n\n## Requirements\n\nPython 3.9 or above is required.\n\n## Documentation\n\nFor the latest documentation, see\n\n- [Databricks](https://docs.databricks.com/dev-tools/python-sql-connector.html)\n- [Azure Databricks](https://docs.microsoft.com/en-us/azure/databricks/dev-tools/python-sql-connector)\n\n## Quickstart\n\n### Installing the core library\nInstall using `pip install databricks-sql-connector`\n\n### Installing the core library with PyArrow\nInstall using `pip install databricks-sql-connector[pyarrow]`\n\n\n```bash\nexport DATABRICKS_HOST=********.databricks.com\nexport DATABRICKS_HTTP_PATH=/sql/1.0/endpoints/****************\n```\n\nExample usage:\n```python\nimport os\nfrom databricks import sql\n\nhost = os.getenv(\"DATABRICKS_HOST\")\nhttp_path = os.getenv(\"DATABRICKS_HTTP_PATH\")\n\nconnection = sql.connect(\n  server_hostname=host,\n  http_path=http_path)\n\ncursor = connection.cursor()\ncursor.execute('SELECT :param `p`, * FROM RANGE(10)', {\"param\": \"foo\"})\nresult = cursor.fetchall()\nfor row in result:\n  print(row)\n\ncursor.close()\nconnection.close()\n```\n\nIn the above example:\n- `server-hostname` is the Databricks instance host name.\n- `http-path` is the HTTP Path either to a Databricks SQL endpoint (e.g. /sql/1.0/endpoints/1234567890abcdef),\nor to a Databricks Runtime interactive cluster (e.g. /sql/protocolv1/o/1234567890123456/1234-123456-slid123)\n\n\u003e Note: This example uses [Databricks OAuth U2M](https://docs.databricks.com/en/dev-tools/auth/oauth-u2m.html) \n\u003e to authenticate the target Databricks user account and needs to open the browser for authentication. So it \n\u003e can only run on the user's machine.\n\n## Transaction Support\n\nThe connector supports multi-statement transactions with manual commit/rollback control. Set `connection.autocommit = False` to disable autocommit mode, then use `connection.commit()` and `connection.rollback()` to control transactions.\n\nFor detailed documentation, examples, and best practices, see **[TRANSACTIONS.md](TRANSACTIONS.md)**.\n\n## SQLAlchemy\nStarting from `databricks-sql-connector` version 4.0.0 SQLAlchemy support has been extracted to a new library `databricks-sqlalchemy`.\n\n- Github repository [databricks-sqlalchemy github](https://github.com/databricks/databricks-sqlalchemy)\n- PyPI [databricks-sqlalchemy pypi](https://pypi.org/project/databricks-sqlalchemy/)\n\n### Quick SQLAlchemy guide\nUsers can now choose between using the SQLAlchemy v1 or SQLAlchemy v2 dialects with the connector core\n\n- Install the latest SQLAlchemy v1 using `pip install databricks-sqlalchemy~=1.0`\n- Install SQLAlchemy v2 using `pip install databricks-sqlalchemy`\n\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## License\n\n[Apache License 2.0](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatabricks%2Fdatabricks-sql-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-python/lists"}