Skip to main content

Databricks SQL Connector for Python

Project description

Databricks SQL Connector for Python

Status: Public Preview

This library is currently shared as Public Preview. Documentation can be found here: Databricks SQL Connector for Python .

About

The Databricks SQL Connector is a Python library that allows you to use Python code to run SQL commands on Databricks clusters and Databricks SQL endpoints. This library follows PEP 249 -- Python Database API Specification v2.0.

Quickstart

Install the library with pip install databricks-sql-connector

Example usage:

from databricks import sql

connection = sql.connect(
  server_hostname='<server-hostname>',
  http_path='<http-path>',
  access_token='<personal-access-token>')

cursor = connection.cursor()

cursor.execute('SELECT * FROM RANGE(10)')
result = cursor.fetchall()
for row in result:
  print(row)

connection.close()

Where:

  • <server-hostname> is the Databricks instance host name.
  • <http-path> is the HTTP Path either to a Databricks SQL endpoint (e.g. /sql/1.0/endpoints/1234567890abcdef), or to a Databricks Runtime interactive cluster (e.g. /sql/protocolv1/o/1234567890123456/1234-123456-slid123)
  • <personal-access-token> is a HTTP Bearer access token, e.g. a Databricks Personal Access Token.

For more information, see Databricks documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for databricks-sql-connector, version 0.9.1
Filename, size File type Python version Upload date Hashes
Filename, size databricks_sql_connector-0.9.1-py3-none-any.whl (36.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size databricks-sql-connector-0.9.1.tar.gz (32.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page