Skip to main content

adbcBridge (Python)

Thin Python wrapper around adbcBridge, the ADBC driver for any ODBC data source. It finds the libadbc_driver_odbc shared library and hands it to adbc_driver_manager, so every ODBC driver on the machine becomes an Arrow-native ADBC database.

pip install adbcbridge
import adbcbridge

with adbcbridge.connect(uri="Driver=SQLite3;Database=my.db;") as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT * FROM t")
        table = cur.fetch_arrow_table()   # pyarrow.Table

connect() returns a plain adbc_driver_manager.dbapi.Connection, so the whole ADBC DBAPI surface (cursor(), fetch_arrow_table(), adbc_ingest(), adbc_get_objects(), …) is available.

API

adbcbridge.connect(uri=None, dsn=None, username=None, password=None,
                   driver_path=None, *, autocommit=False, conn_kwargs=None,
                   **options) -> adbc_driver_manager.dbapi.Connection
adbcbridge.driver_path() -> str            # path of libadbc_driver_odbc.so
adbcbridge.odbc_drivers() -> list[OdbcDriver]   # from odbcinst.ini
adbcbridge.odbcinst_ini() -> pathlib.Path | None
adbcbridge.odbc_driver_library(driver=None, *, uri=None, dsn=None) -> str | None
adbcbridge.preload_odbc_driver(driver=None, *, uri=None, dsn=None,
                               strict=False) -> str | None

import adbcbridge does not import pyarrow: adbc_driver_manager.dbapi is imported inside connect(), after the ODBC driver named in the connection string has been opened. A few ODBC drivers — MySQL Connector/ODBC is the one in the wild — can only be loaded while libstdc++ has not yet been pinned to dynamic thread-local storage, which importing pyarrow does. preload_odbc_driver() is that step on its own, for programs that drive adbc_driver_manager or pyodbc themselves; ADBCBRIDGE_PRELOAD=0 disables the automatic one in connect(). See docs/TROUBLESHOOTING.md.

Extra **options become database options: a bare name is prefixed with adbc.odbc. (batch_size=4096adbc.odbc.batch_size), a dotted name is passed through as given, and True/False become "true"/"false".

conn = adbcbridge.connect(
    uri="Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so;Server=127.0.0.1;Database=app;",
    username="app", password="secret",
    batch_size=4096, decimal_as_string=True,   # adbc.odbc.*
)

Finding the driver library

driver_path() looks, in order, at

  1. the ADBC_ODBC_DRIVER environment variable (an explicit value that does not exist is an error, not a silent fallback);
  2. a copy bundled inside this package (see below);
  3. the ADBC driver manifest named odbcodbc.toml under $ADBC_DRIVER_PATH, <sys.prefix>/etc/adbc/drivers, ~/.config/adbc/drivers, /etc/adbc/drivers, … — as installed by cmake --install build --prefix "$VIRTUAL_ENV";
  4. common install locations: <sys.prefix>/lib, /usr/local/lib, /usr/lib, /usr/lib/<arch>-linux-gnu, and a build/ tree next to a source checkout (so pip install -e python works right after cmake --build build).

If nothing matches it raises adbcbridge.DriverNotFoundError.

Command line

adbcbridge query "Driver=SQLite3;Database=my.db;" "SELECT * FROM t"
adbcbridge query "Driver=SQLite3;Database=my.db;" "SELECT * FROM t WHERE i > ?" -p 3
adbcbridge query ... --format csv > out.csv     # or --format schema, --limit N
adbcbridge drivers            # ODBC drivers from odbcinst -j / odbcinst.ini
adbcbridge driver-path        # which libadbc_driver_odbc.so would be used

Building a wheel with the driver bundled

The wheel is pure Python unless a driver library is around at build time, in which case setup.py copies it into the package and tags the wheel for the current platform:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build
python -m pip install build
python -m build --wheel python          # picks up ./build/libadbc_driver_odbc.so

Point it somewhere else with ADBCBRIDGE_LIBRARY=/path/to/libadbc_driver_odbc.so (or ADBCBRIDGE_BUILD_DIR=/path/to/cmake-build-tree). Without either, and with no build/ tree, the wheel contains no binary and driver_path() falls back to the manifest or a system-wide install at run time.

Tests

pip install -e python
SQLITE_ODBC_DRIVER=/path/to/libsqlite3odbc.so \
ADBC_ODBC_DRIVER=$PWD/build/libadbc_driver_odbc.so \
  pytest python/tests

Apache-2.0.

Download files

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

Source Distribution

adbcbridge-0.1.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

adbcbridge-0.1.0-py3-none-win_amd64.whl (149.7 kB view details)

Uploaded Python 3Windows x86-64

adbcbridge-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (226.9 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

adbcbridge-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (221.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

adbcbridge-0.1.0-py3-none-macosx_14_0_arm64.whl (174.5 kB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file adbcbridge-0.1.0.tar.gz.

File metadata

  • Download URL: adbcbridge-0.1.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adbcbridge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74f4a5727ad9d3a0923fce946284a931894f2286fd4c15730b77ec876b2ed409
MD5 1f8bff5bf13a89452aad32918f6ff19b
BLAKE2b-256 62148ffa8dea9ef19ab61a5706a265b90a257dcfec7272f41d7bd8f40619c2ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbcbridge-0.1.0.tar.gz:

Publisher: publish-pypi.yml on singhpratech/adbcbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbcbridge-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: adbcbridge-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 149.7 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adbcbridge-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1c9a054f6669ab293b90878071ba1ec956a73dac06644efedd7679de0897231f
MD5 7f8cfa4359c64676568ae20cfcc53da4
BLAKE2b-256 0dc3acae9598aaef51d0058f45cd83dc52c5f7328423ab417a9586033255d8cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbcbridge-0.1.0-py3-none-win_amd64.whl:

Publisher: publish-pypi.yml on singhpratech/adbcbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbcbridge-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for adbcbridge-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1ef77f206d1e017d01f2cfe9c43ef8c8f53a510b631cd3c8ce588d2e27ad8fe9
MD5 b98476409713d79ef2240e4ec82302f0
BLAKE2b-256 fafc0d364f9a340ef479e4a2ebeb6983ad55de062a4cbb62188ab93482033290

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbcbridge-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on singhpratech/adbcbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbcbridge-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for adbcbridge-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 283f4d97a0b0f86a64d79ecc1bb5c3894d123bf543ae357b30dbbf0c73ef240c
MD5 d7b89ce584f9fb1d64f7462aa46180a9
BLAKE2b-256 6845a27ad9996aa7bfe180ebef6fc2bc7e6470077fe36a3635e1aef6bc6058e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbcbridge-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish-pypi.yml on singhpratech/adbcbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbcbridge-0.1.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for adbcbridge-0.1.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7e7b922406b84d9cb5081f6995f074fea721982ed6a9e82ae04c0273b6353aa0
MD5 f64ebbbaeeeccb8392c6fb9e7c345933
BLAKE2b-256 ab9fc6232cd66382627f5d60354cbb3b4d17abdcff5f0421c42c7f31edab3ed7

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbcbridge-0.1.0-py3-none-macosx_14_0_arm64.whl:

Publisher: publish-pypi.yml on singhpratech/adbcbridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page