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.0.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distributions

adbc_driver_postgresql-1.0.0-py3-none-win_amd64.whl (2.6 MB view details)

Uploaded Python 3 Windows x86-64

adbc_driver_postgresql-1.0.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

adbc_driver_postgresql-1.0.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.6 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

adbc_driver_postgresql-1.0.0-py3-none-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

adbc_driver_postgresql-1.0.0-py3-none-macosx_10_15_x86_64.whl (2.4 MB view details)

Uploaded Python 3 macOS 10.15+ x86-64

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bebc1352dbeccd096849cf686a1e042425e77691223d6e71d5dce8f329458a1d
MD5 5cd26ac4036cadd42a7f0d9ed9128141
BLAKE2b-256 00708fbac11fe4de8fd0112ee8128901252dad976748d90dc30bf4458123c697

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 836296dd196bdbe3c577b16bd684aede7abe89d123065eba975f706625de4131
MD5 fa0e85c9c6e4a8f8ce42fbb1c05559a2
BLAKE2b-256 209f64ce1a29737ca2d107da39aaaf546a70e645190b58ca11738111a97d3fe2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1033b481d2ee57575ef34ede79c75322c0f641676aef2a0b0016af77e713347f
MD5 8ba35099e40de5107082404ff616640f
BLAKE2b-256 b003c0fb609f4b53df76d6fd440452d6cf311d1b0b53529ac6152c869606afd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7b7dda171ee90bceaef1334ac758aaf4aa5c0592b8f25458fbf7422072cb4879
MD5 6148d588ee1599fa9c52aae461536a90
BLAKE2b-256 e5221554b9a5d2a73ca6997b8ff6bc9cf0811c83068447ae036f65c59771e1cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7796950d9f861e800849ec5f1d5b78b3692c239b108c531dec04002baeb82ea8
MD5 f8bfb9646c4fdcda91e3472b1102bd87
BLAKE2b-256 3deace90bf80e1365fd281bb863974510597beeead0c1d604de4334eea7e53b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.0.0-py3-none-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1ed5648dfdb19ce85b1eeb3e358f6bc7bcd7493a2f2fd002c1d6899db1da5a83
MD5 be981833c817cb7563bef51681eb9a36
BLAKE2b-256 5a598e248ce72e70281eb2ea7598a6f587ddc902919a01ac4b38919d79a14b45

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