Driver Manager¶
The driver manager is a library that provides bindings to the ADBC C API. It delegates to dynamically-loaded drivers. This allows applications to use multiple drivers simultaneously, and decouple themselves from the specific driver.
The Python driver manager provides both low-level bindings that are essentially the same as the C API. If PyArrow is installed, it also provides high-level bindings that implement the DBAPI (PEP 249) standard.
Installation¶
pip install adbc_driver_manager
Usage¶
Warning
This API is for low level usage only. You almost certainly should not use this, instead use the entrypoints provided by driver packages, for example:
The Python bindings for each driver abstract the steps here for you behind a
convenient connect
function. For example, prefer
adbc_driver_sqlite.connect()
or adbc_driver_postgresql.connect()
to manually constructing the connection as demonstrated here.
To manually create a connection: first, create a AdbcDatabase
,
passing driver
and (optionally) entrypoint
. driver
must be the
name of a library to load, or the path to a library to load. entrypoint
,
if provided, should be the name of the symbol that serves as the ADBC
entrypoint (see AdbcDriverInitFunc
). Then, create a
AdbcConnection
.
import adbc_driver_manager
# You must build/locate the driver yourself
with adbc_driver_manager.AdbcDatabase(driver="PATH/TO/libadbc_driver_sqlite.so") as db:
with adbc_driver_manager.AdbcConnection(db) as conn:
pass
API Reference¶
See the API reference: adbc_driver_manager.