Databend Driver Python Binding

raw JSON →
0.33.7 verified Fri May 01 auth: no python

Official Python driver for Databend, providing a DB-API 2.0 interface and async SQL execution. Current version 0.33.7, requires Python >=3.8 and <3.14. Released roughly weekly via bendsql monorepo.

pip install databend-driver
error ImportError: cannot import name 'DatabendDriver' from 'databend_driver'
cause The class is now named AsyncDatabendDriver or BlockingDatabendDriver; DatabendDriver was removed.
fix
Use 'from databend_driver import AsyncDatabendDriver' or 'from databend_driver import BlockingDatabendDriver'.
error TypeError: 'NoneType' object is not callable
cause Attempting to use await on a blocking driver method, or calling connect() on an uninitialized connector.
fix
Ensure you use BlockingConnector for sync, AsyncConnector for async, and call the correct methods (e.g., await conn.query() for async).
error ValueError: Unsupported DSN scheme
cause DSN must start with 'databend://' or 'databend+http://' prefix. Missing or wrong scheme.
fix
Use DSN format: databend://user:password@host:port/database
breaking In 0.31.0, the internal DataType 'TimestampTz' was added, changing how timestamps with timezone are returned. Code relying on previous behavior may break.
fix Ensure your application handles Datetime objects for timestamp columns with timezone.
gotcha The async driver and sync driver have different method signatures. AsyncDriver uses await, while BlockingDriver uses blocking calls. Mixing them leads to runtime errors.
fix Use BlockingConnector for synchronous code and AsyncConnector for async code. Do not mix.
deprecated The 'body_format' option was renamed to 'result_format' in 0.33.1. Using the old name may be silently ignored or cause errors.
fix Replace any use of 'body_format' in DSN options with 'result_format'.

Connect to Databend using a DSN string and execute a synchronous query.

import os
from databend_driver import BlockingConnector

dsn = os.environ.get('DATABEND_DSN', 'databend://user:password@host:443/database')
conn = BlockingConnector(dsn).connect()
result = conn.query('SELECT version()')
print(result)
conn.close()