{"id":23509,"library":"databend-driver","title":"Databend Driver Python Binding","description":"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.","status":"active","version":"0.33.7","language":"python","source_language":"en","source_url":"https://github.com/databendlabs/bendsql","tags":["databend","database","driver","sql","async","arrow"],"install":[{"cmd":"pip install databend-driver","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for columnar data transfer and Arrow IPC format","package":"pyarrow","optional":true}],"imports":[{"note":"connect is a top-level function; no need to import DatabendDriver directly.","symbol":"connect","correct":"from databend_driver import connect"},{"note":"DatabendDriver is the async driver class; the sync driver is BlockingDatabendDriver.","wrong":"from databend_driver import DatabendDriver","symbol":"BlockingDatabendDriver","correct":"from databend_driver import BlockingDatabendDriver"},{"note":"AsyncDatabendDriver is the async driver class; DatabendDriver does not exist in recent versions.","wrong":"from databend_driver import DatabendDriver","symbol":"AsyncDatabendDriver","correct":"from databend_driver import AsyncDatabendDriver"}],"quickstart":{"code":"import os\nfrom databend_driver import BlockingConnector\n\ndsn = os.environ.get('DATABEND_DSN', 'databend://user:password@host:443/database')\nconn = BlockingConnector(dsn).connect()\nresult = conn.query('SELECT version()')\nprint(result)\nconn.close()","lang":"python","description":"Connect to Databend using a DSN string and execute a synchronous query."},"warnings":[{"fix":"Ensure your application handles Datetime objects for timestamp columns with timezone.","message":"In 0.31.0, the internal DataType 'TimestampTz' was added, changing how timestamps with timezone are returned. Code relying on previous behavior may break.","severity":"breaking","affected_versions":">=0.31.0"},{"fix":"Use BlockingConnector for synchronous code and AsyncConnector for async code. Do not mix.","message":"The async driver and sync driver have different method signatures. AsyncDriver uses await, while BlockingDriver uses blocking calls. Mixing them leads to runtime errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace any use of 'body_format' in DSN options with 'result_format'.","message":"The 'body_format' option was renamed to 'result_format' in 0.33.1. Using the old name may be silently ignored or cause errors.","severity":"deprecated","affected_versions":">=0.33.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from databend_driver import AsyncDatabendDriver' or 'from databend_driver import BlockingDatabendDriver'.","cause":"The class is now named AsyncDatabendDriver or BlockingDatabendDriver; DatabendDriver was removed.","error":"ImportError: cannot import name 'DatabendDriver' from 'databend_driver'"},{"fix":"Ensure you use BlockingConnector for sync, AsyncConnector for async, and call the correct methods (e.g., await conn.query() for async).","cause":"Attempting to use await on a blocking driver method, or calling connect() on an uninitialized connector.","error":"TypeError: 'NoneType' object is not callable"},{"fix":"Use DSN format: databend://user:password@host:port/database","cause":"DSN must start with 'databend://' or 'databend+http://' prefix. Missing or wrong scheme.","error":"ValueError: Unsupported DSN scheme"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}