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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for adbc_driver_postgresql-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e65aa104d1fd33a2b2d9dff1fe34dac124b09e99780826f86955a864971775 |
|
MD5 | 00f11be42eb74bd2456f56c9b7d18054 |
|
BLAKE2b-256 | cdbe11c7c41bd366147d371e2810ad5696e0c98aa7429baf9f8af39f3dfb1970 |
Hashes for adbc_driver_postgresql-1.1.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c297a559128ec41bd7f4aaf0854acbfa996f1083f591b668b2538a713fabb2a9 |
|
MD5 | b04e0d640c63ac931515f32c9644544f |
|
BLAKE2b-256 | d24c85060fca9aff17fe6e2212803dc4c031d93d0d5bb9a19c7bb72b46601936 |
Hashes for adbc_driver_postgresql-1.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333add92822b4bc7a5d765f6098c7fd1089c53fd2643de87c5e9123b1e164e60 |
|
MD5 | e276dd28daf026289078ec625622778b |
|
BLAKE2b-256 | 71751a11c416dcf12e8ad09c420edc0e0621b0d5b6ac8196104e358be6e2070a |
Hashes for adbc_driver_postgresql-1.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72e4781c3888ae31d1162f6b967a867a00ecfd02c1f21c8abd3befe90777db8e |
|
MD5 | 734cccb251647d4b26c75b65a58510db |
|
BLAKE2b-256 | 71ed5e1c1e7926b9ad92fb5a56fd0e03577514fe27048e19763973bda372a601 |
Hashes for adbc_driver_postgresql-1.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc3d75c515ec81bf8214d84d2410600534c9e46d114c17e9f1dd9732b0186e71 |
|
MD5 | cef67fc99ea7c6da90dc9b26f19fbd34 |
|
BLAKE2b-256 | 6f8d40abb94ee3db87ad9ef15eec297aa495e4110eefecfa5bd24a5c6e71ccd6 |
Hashes for adbc_driver_postgresql-1.1.0-py3-none-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96ab6f727009b5ba7927ba32f11f6bb91c4693737c5ada1b0061632d9292e484 |
|
MD5 | 29a21296110ba668e40d4fc184ba7114 |
|
BLAKE2b-256 | 166b8673f59b764e8cdc4cb226282858efab060dbcbe2fca826c782d1d5f2d77 |