{"id":2854,"library":"adbc-driver-manager","title":"ADBC Driver Manager for Python","description":"The adbc-driver-manager package provides Python bindings for the Arrow Database Connectivity (ADBC) C API, serving as a generic entrypoint for ADBC drivers. It offers both low-level C API bindings and a higher-level, PEP 249 (DB-API 2.0) compatible interface. Currently at version 1.11.0, the library generally follows a monthly to bi-monthly release cadence, aligning with the broader Apache Arrow project.","status":"active","version":"1.11.0","language":"en","source_language":"en","source_url":"https://github.com/apache/arrow-adbc","tags":["database","adbc","arrow","sql","dbapi","data-connectivity"],"install":[{"cmd":"pip install adbc-driver-manager","lang":"bash","label":"Core library"},{"cmd":"pip install adbc-driver-manager pyarrow","lang":"bash","label":"With PyArrow for DB-API features"}],"dependencies":[{"reason":"Required for the DB-API 2.0 interface and full functionality, including reading/writing Arrow data. Without it, many data-related features will be missing.","package":"pyarrow","optional":true},{"reason":"Commonly a transitive dependency, especially for older Python versions, though 'requires_python >=3.10' suggests it might be less critical now.","package":"typing-extensions","optional":true}],"imports":[{"note":"For low-level ADBC C API bindings.","symbol":"adbc_driver_manager","correct":"import adbc_driver_manager"},{"note":"While `adbc_driver_manager.dbapi` exists, it's generally recommended to use the DB-API 2.0 entrypoint provided by specific driver packages (e.g., `adbc_driver_sqlite.dbapi`) for convenience, as these bundle and load the underlying driver.","wrong":"import adbc_driver_manager.dbapi","symbol":"dbapi","correct":"import adbc_driver_sqlite.dbapi"}],"quickstart":{"code":"import adbc_driver_sqlite.dbapi\nimport pyarrow\n\n# Ensure the SQLite ADBC driver is installed for this example.\n# pip install adbc-driver-sqlite pyarrow\n\ntry:\n    # Connect to a SQLite database using the DB-API 2.0 interface\n    # Use a context manager to ensure proper resource cleanup\n    with adbc_driver_sqlite.dbapi.connect() as conn:\n        with conn.cursor() as cur:\n            # Execute a query\n            cur.execute(\"CREATE TABLE IF NOT EXISTS test (id INTEGER, name TEXT)\")\n            cur.execute(\"INSERT INTO test (id, name) VALUES (?, ?)\", (1, 'Alice'))\n            cur.execute(\"INSERT INTO test (id, name) VALUES (?, ?)\", (2, 'Bob'))\n\n            # Fetch results as an Arrow Table (an ADBC-specific extension)\n            cur.execute(\"SELECT id, name FROM test ORDER BY id\")\n            table = cur.fetch_arrow_table()\n            print(\"Fetched Arrow Table:\\n\", table)\n\n            # Fetch results via standard DB-API row-oriented interface\n            cur.execute(\"SELECT id, name FROM test ORDER BY id\")\n            row = cur.fetchone()\n            print(f\"\\nFetched one row: {row}\")\n            rows = cur.fetchall()\n            print(f\"Fetched remaining rows: {rows}\")\n\n            # Bulk ingest data\n            new_data = pyarrow.table([[3, 4], ['Charlie', 'David']], names=['id', 'name'])\n            cur.adbc_ingest(\"test\", new_data)\n            print(f\"\\nIngested {new_data.num_rows} rows.\")\n\n            cur.execute(\"SELECT COUNT(*) FROM test\")\n            count = cur.fetchone()[0]\n            print(f\"Total rows after ingest: {count}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates connecting to a SQLite database using the recommended DB-API 2.0 interface provided by `adbc_driver_sqlite.dbapi`. It shows how to execute queries, fetch results as both Arrow Tables and standard Python rows, and perform bulk data ingestion. Ensure `adbc-driver-sqlite` and `pyarrow` are installed for this example to run. Connections and cursors should always be managed with context managers or explicitly `close()`d to prevent resource leaks."},"warnings":[{"fix":"Prefer `import adbc_driver_FOO.dbapi` and use `adbc_driver_FOO.dbapi.connect()` for convenience and correct driver loading.","message":"The `adbc-driver-manager` package itself is primarily a low-level interface to the ADBC C API. For most application development, it is strongly recommended to use the DB-API 2.0 interface provided by specific ADBC driver packages (e.g., `adbc_driver_sqlite.dbapi.connect()`) which abstract away the manual loading of driver shared libraries.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `with ... as` context managers for `Connection` and `Cursor` objects, or explicitly call `.close()` on them.","message":"Connections (`adbc_driver_manager.AdbcConnection` or `dbapi.Connection`) and Cursors (`dbapi.Cursor`) *must* be explicitly closed to avoid resource leaks in the underlying C library. Python's garbage collection is not guaranteed to call `__del__` in a timely manner.","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure the necessary ADBC driver shared library is installed and discoverable by the driver manager, or use a driver-specific Python package.","message":"The `adbc-driver-manager` package requires a separately installed ADBC driver shared library (e.g., `libadbc_driver_sqlite.so`) to function. Unlike driver-specific packages (e.g., `adbc-driver-sqlite`) which bundle and load the driver transparently, when using `adbc-driver-manager` directly, you must manage the driver's availability (e.g., via `PATH` or `LD_LIBRARY_PATH`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `pyarrow` alongside `adbc-driver-manager` using `pip install adbc-driver-manager pyarrow`.","message":"The DB-API 2.0 interface and functionality for working with Arrow data (e.g., `fetch_arrow_table`, `adbc_ingest`) requires the `pyarrow` library to be installed. Without `pyarrow`, such features will be unavailable or raise errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your environment meets the updated `manylinux_2_28` or macOS 12+ requirements, or pin to an older `adbc-driver-manager` version if compatibility is needed.","message":"Recent Python wheels for `adbc-driver-manager` (and other Apache Arrow libraries) have increased their minimum system requirements. Specifically, `manylinux_2_28` is now required for Linux wheels (up from `manylinux2010`), and macOS 12 is the minimum supported version for macOS wheels.","severity":"breaking","affected_versions":"Versions 1.11.0 and later"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}