pgarrow

A SQLAlchemy PostgreSQL dialect for ADBC (Arrow Database Connectivity)
Contents
Installation
pgarrow can be installed from PyPI using pip:
pip install pgarrow
Usage
pgarrow can be used using the postgresql+pgarrow dialect when creating a SQLAlchemy engine. For example, to create an engine for a PostgreSQL database at 127.0.0.1 (localhost) on port 5432 with user postgres and password password:
engine = sa.create_engine('postgresql+pgarrow://postgres:password@127.0.0.1:5432/')
Query returning built-in Python types
To run a query that returns built-in Python types, as is typical with SQLAlchemy:
import sqlalchemy as sa
engine = sa.create_engine('postgresql+pgarrow://postgres:password@127.0.0.1:5432/')
with engine.connect() as conn:
results = conn.execute(sa.text("SELECT 1")).fetchall()
Query returning an Arrow table
To run a query that returns an Arrow table, which should be the most performant for large datasets, you must use SQLAlchemy's driver_connection to access the ADBC-level connection, create a cursor from it to run the query and fetch the table using fetch_arrow_table:
import sqlalchemy as sa
engine = sa.create_engine('postgresql+pgarrow://postgres:password@127.0.0.1:5432/')
with \
engine.connect() as conn, \
conn.connection.driver_connection.cursor() as cursor:
cursor.execute("SELECT 1 AS a, 2.0::double precision AS b, 'Hello, world!' AS c")
table = cursor.fetch_arrow_table()
Replace PostgreSQL table with an Arrow table
To insert data into the database from an Arrow table, a similar pattern must be used to use adbc_ingest:
import sqlalchemy as sa
engine = sa.create_engine('postgresql+pgarrow://postgres:password@127.0.0.1:5432/')
table = pa.Table.from_arrays([[1,], [2,], ['Hello, world!',]], schema=pa.schema([
('a', pa.int32()),
('b', pa.float64()),
('c', pa.string()),
]))
with \
engine.connect() as conn, \
conn.connection.driver_connection.cursor() as cursor:
cursor.adbc_ingest("my_table", table, mode="create")
conn.commit()
Create a table with SQLAlchemy and append an Arrow table
To create a table using SQLAlchemy, and then append an Arrow table to it:
import sqlalchemy as sa
metadata = sa.MetaData()
sa.Table(
"my_table",
metadata,
sa.Column("a", sa.INTEGER),
sa.Column("b", sa.DOUBLE_PRECISION),
sa.Column("c", sa.TEXT),
schema="public",
)
table = pa.Table.from_arrays([[1,], [2,], ['Hello, world!',]], schema=pa.schema([
('a', pa.int32()),
('b', pa.float64()),
('c', pa.string()),
]))
with \
engine.connect() as conn, \
conn.connection.driver_connection.cursor() as cursor:
metadata.create_all(conn)
cursor.adbc_ingest("my_table", table, mode="append")
conn.commit()
Compatibility
- Python >= 3.10 (tested on 3.10.0, 3.11.1, 3.12.0, and 3.13.0)
- PostgreSQL >= 13.0 (tested on 13.0, 14.0, 15.0, 16.0, 17.0, and 18.0)
- SQLAlchemy >= 2.0.7 on Python < 3.13.0; and >= 2.0.41 on Python >=3.13.0 (tested on 2.0.7 with Python before 3.13.0; and tested on 2.0.41 with Python 3.13.0)
- PyArrow >= 15.0.0 with Python < 3.13, and PyArrow >= 18.0.0 with Python >= 3.13.0 (tested on 15.0.0, 16.0.0, 17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, and 22.0.0 with Python before 3.13.0; and 18.0.0, 19.0.0, 20.0.0, 21.0.0, and 22.0.0 with Python 3.13.0)
- adbc-driver-postgresql >= 1.9.0 (tested on 1.9.0)
Metadata
Release files for pgarrow 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pgarrow-0.0.9.tar.gz | 6.1 kB | With provenance | Details for pgarrow-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pgarrow-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for pgarrow-0.0.9-py3-none-any.whl |
Total release size: 11.5 kB
Release files / pgarrow-0.0.9.tar.gz
| Download URL | pgarrow-0.0.9.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4effb553413f43b9b58430ed5dba908c741edabf5fd7d1845fb5ebc0165d405
|
|
BLAKE2b-256 checksum How to use checksums |
8ceaee69c9a3e8a7a9b45d85aaa6fd888773cc565fddf16aef2dc768eb141cfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logRelease files / pgarrow-0.0.9-py3-none-any.whl
| Download URL | pgarrow-0.0.9-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
353f2796c16830198b1680baa49cbee544f1bb3ae717d9cb902ce91e092611bc
|
|
BLAKE2b-256 checksum How to use checksums |
1ed5cdd10a8834c5b6d98a186e6228070fb85c8c0b5bd77819a72af9833f616f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logSecurity for pgarrow 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pgarrow-0.0.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.