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 Distributions
Built Distributions
Hashes for adbc_driver_postgresql-0.11.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e469332c22b7f8ab4f6af141fa0264fb999ab051b867c125e6db3caf1c488a3b |
|
MD5 | af51b3528b580dc0f7555fe03c6dcbca |
|
BLAKE2b-256 | 8ae98c6ee2ef8db63f6a5dfbe5e1e0c57e9043f8daaba997f010afce2dc86f5b |
Hashes for adbc_driver_postgresql-0.11.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ea34271dd0e5e2816c97ecb2fa2fc7f796d89dd33fb7bf9750b57545f5724ba |
|
MD5 | 1a006b21f0c5fb21a5273960bde97501 |
|
BLAKE2b-256 | bdda758f53b17c2d7513002fe77957ee7e03989d466efb0ef0ef32902d643ab6 |
Hashes for adbc_driver_postgresql-0.11.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 628876dbdcea3e22b43d13f3a0221de1634882307168f67e0f65dd18f9a1c901 |
|
MD5 | b6be66c4287a2a5cce169a6439911b76 |
|
BLAKE2b-256 | 554d9edff62d1cc3b4f3e61b7aa8e1dbc72b257e8b228dd1fc7a0b0f41614873 |
Hashes for adbc_driver_postgresql-0.11.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6dfaf56092f21282781ee389aefee66c4e02066258c1ebdae1b826eea61098f |
|
MD5 | 340a867e0e0a687965eb4e1d784b74a5 |
|
BLAKE2b-256 | fa92cf1e882c66c38c72823acb2a7d7d06010f66aa70c3fe10508f070525ff18 |
Hashes for adbc_driver_postgresql-0.11.0-py3-none-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b647623cb81e3820369ef73ad6cf2ff75cf243664a6762fb262626404bcbc46 |
|
MD5 | 4d414b308cf55ce8a467617becea8d9c |
|
BLAKE2b-256 | 47285e50e945fc18650a91a071efe88100a485e482dc5b083888f2212007d8ec |