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 -DADBC_DRIVER_POSTSGRESQL=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.5.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distributions

adbc_driver_postgresql-1.5.0-py3-none-win_amd64.whl (2.7 MB view details)

Uploaded Python 3 Windows x86-64

adbc_driver_postgresql-1.5.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.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

adbc_driver_postgresql-1.5.0-py3-none-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

adbc_driver_postgresql-1.5.0-py3-none-macosx_10_15_x86_64.whl (2.7 MB view details)

Uploaded Python 3 macOS 10.15+ x86-64

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0.tar.gz
Algorithm Hash digest
SHA256 3fc569ecd816838529e4778d5a5bd3678b6e35204d0b6428335e6bb3549312e8
MD5 47735f3746fde577d8cbb2ed882e332c
BLAKE2b-256 b5617e6b9fc03fc294bcb9f18495a1f157bb6ee4f365a14d526dfc9977ecef72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 251674ada39becb6ae86949c4d0987950d18c9b9ff6a941ff7a96f6eba2e4365
MD5 d97fada58b8e5905aecddd2bce1effff
BLAKE2b-256 cd9de34bafc8e99c93fd42227ec1bb15d80f5f661beefc30e98b4e3b54ce0792

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39b955dc6a53e3f01875659637d875b46bd04bf1ec361524c326c6963f5bc48a
MD5 206006ff11ed570260f4aaf64a913f4c
BLAKE2b-256 22dd5335cee201c4f3e9cc3a101f306d1a09cf5956d44de8c80850bc958b7cd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3dfe69557d1af24d0d6c05085f91df825f02ac837f0861528ba5c7aa79e0cf0d
MD5 71bc3208c432de4ca40ab184f3e096d7
BLAKE2b-256 39c9add6659f0df14d001d2933dbbf94511ea507c6a94fd4ae09aed9ab1f1b78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f3e3a9b75c735eb79042e5f393f7b8aa699b3fe4c474b13871f85db7ad43eb3
MD5 2221b939ae38119d0d2903cda69f8f2b
BLAKE2b-256 a48a6995f1746ea4db7456699e36c973ac9ddd87f7acbda939c0ca2b01189ded

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adbc_driver_postgresql-1.5.0-py3-none-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 fb359d9a735090f8267b01f455c6ac4646e6595b4c9d4acea5764e77630c86c2
MD5 1d511a3752e9b73eaec9f323a5d305fb
BLAKE2b-256 6ec48f239c5047640bf15971c34b74c56d190be20c2841c11a196ea63241d360

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