Skip to main content

A libpq-based ADBC driver for working with PostgreSQL.

Project description

ADBC PostgreSQL Driver for Python

This package contains bindings for the PostgreSQL driver, using the driver manager to provide a DBAPI 2.0/PEP 249-compatible interface on top.

Example

import adbc_driver_postgresql.dbapi

uri = "postgresql://postgres:password@localhost:5432/postgres"
with adbc_driver_postgresql.dbapi.connect(uri) as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT 1")
        print(cur.fetch_arrow_table())

Building

Dependencies: a build of the PostgreSQL driver, and the adbc-driver-manager Python package. Optionally, install PyArrow to use the DBAPI 2.0-compatible interface.

Set the environment variable ADBC_POSTGRESQL_LIBRARY to the path to libadbc_driver_postgresql.{dll,dylib,so} before running pip install.

# If not already installed
pip install -e ../adbc_driver_manager

export ADBC_POSTGRESQL_LIBRARY=/path/to/libadbc_driver_postgresql.so
pip install --no-deps -e .

For users building from the arrow-adbc source repository, you can alternately use CMake to manage library dependencies and set environment variables for you. Assuming you specify -DADBC_DRIVER_POSTGRESQL=ON you can also add -DADBC_BUILD_PYTHON=ON to define a python target.

For example, assuming you run cmake from the project root:

cmake -S c -B build --preset debug -DADBC_BUILD_PYTHON=ON
cmake --build build --target python

will properly build and install the Python library for you.

See CONTRIBUTING.md for details on the general build process.

Testing

A running instance of PostgreSQL is required. For example, using Docker:

$ docker run -it --rm \
    -e POSTGRES_PASSWORD=password \
    -e POSTGRES_DB=tempdb \
    -p 5432:5432 \
    postgres

Then, to run the tests, set the environment variable specifying the PostgreSQL URI before running tests:

$ export ADBC_POSTGRESQL_TEST_URI=postgresql://localhost:5432/postgres?user=postgres&password=password
$ pytest -vvx

See CONTRIBUTING.md for details on the general test process.

Project details


Download files

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

Source Distribution

adbc_driver_postgresql-1.2.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distributions

adbc_driver_postgresql-1.2.0-py3-none-win_amd64.whl (2.5 MB view details)

Uploaded Python 3 Windows x86-64

adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

adbc_driver_postgresql-1.2.0-py3-none-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

adbc_driver_postgresql-1.2.0-py3-none-macosx_10_15_x86_64.whl (2.5 MB view details)

Uploaded Python 3 macOS 10.15+ x86-64

File details

Details for the file adbc_driver_postgresql-1.2.0.tar.gz.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1bf66beaf0a57d66fac642b95f97565bd5f47cddb52ae3c8f92b14925253d6df
MD5 586792864bf414c47b795164827b2177
BLAKE2b-256 78a7775299e9bc7388458433c17ebb27ad4dc12465e61e44204d7505ade082cb

See more details on using hashes here.

File details

Details for the file adbc_driver_postgresql-1.2.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c996faf71776c80a9f92f4a13650b30bed4f462fcd787f0bf5fa25493c51302b
MD5 1e94df3b4c7c8f091bb7ff0adf2036cb
BLAKE2b-256 5d8667c8925b7b437d0a3b95c483b659f84235698e030c831d5eb6a75b94c549

See more details on using hashes here.

File details

Details for the file adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce1a0a9eb5e2f572e937019f70be3176eb9feaf8f6544ac01eed51a89b4593a9
MD5 3c0c673ec338127248c4baaf0e5a34dc
BLAKE2b-256 de842db20ac0484aa78adabe03a59b7d89883e68c872815ef6c067f6942c98d9

See more details on using hashes here.

File details

Details for the file adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ba9ca7422564d4936bb11bc7c1a0f4bbebf96e413b2b25b0672d5c1155d2ceea
MD5 27df331853490bc44f17196c009e5a58
BLAKE2b-256 48d007d10213b4bd77255711e160ab46b0b1957e3a26a8c9226c86682dbf2359

See more details on using hashes here.

File details

Details for the file adbc_driver_postgresql-1.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16968814e56f1e5451ee5289a6ebdf51a9164e64d8582aec28350708e37663b6
MD5 2c87a48875d7014c36a92546572b266a
BLAKE2b-256 4b61cd1e3df08697946564fd022c06cd61bfdf1ee1ae38218255e40ba1ec7cf5

See more details on using hashes here.

File details

Details for the file adbc_driver_postgresql-1.2.0-py3-none-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.2.0-py3-none-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 2a7eee1f6c2ad0d3c1174ec8cbd87294d7c75dac17dd33e8bd15e6bba1bdd4fb
MD5 b6e3e4f1608e37d4476070f08c45f33f
BLAKE2b-256 a246f031434c2925f691bfa6b340e8594abe48e464c915dfad0b990c8cd1ee79

See more details on using hashes here.

Supported by

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