Registry / database / pgpq
library0.11.1pypypi✓ verified 84d ago

pgpq is a Python library for fast encoding of Apache Arrow data into PostgreSQL-compatible binary format (e.g., COPY with binary format). Version 0.11.1 is the latest, with weekly releases. It requires Python >=3.10.

pip install pgpq
INSTALL
IMPORT
SIG · PGPQ
P
pgpq
databasepythonv0.11.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pq
import pgpq
import pgpq as pq
Common mistake: aliasing module as pq, but pgpq's public API is accessed via pgpq.encode or pgpq.Encoder

Encode a PyArrow table into PostgreSQL binary COPY format.

import pyarrow as pa import pgpq table = pa.table({'x': [1, 2, 3]}) encoded = pgpq.encode(table) print(len(encoded)) # Output: 36 (example binary size)
Debug
Known issues
breakingIn version 0.9.0, the encode() function signature changed; it now only accepts a single pyarrow.Table argument. Previously it accepted (table, format='binary').
fix
Use encode(table) directly; the format is always binary.
affects: >=0.9.0
deprecatedThe Encoder class was deprecated in 0.10.0 in favor of the encode() function.
fix
Replace Encoder(table).encode() with pgpq.encode(table).
affects: >=0.10.0
gotchapgpq only supports PostgreSQL binary COPY format. It does not support text or CSV formats.
fix
Use pgpq solely for binary COPY. For CSV/text, use PyArrow's write_csv or other libraries.
affects: all
Errors
Common errors & fixes
pgpq requires pyarrow to be installed
pgpq does not install pyarrow automatically; it's a required dependency.
fix
pip install pyarrow
AttributeError: module 'pgpq' has no attribute 'Encoder'
The Encoder class was removed in pgpq 0.10.0+.
fix
Use pgpq.encode(table) instead of pgpq.Encoder(table).encode().
Upgrade
Version history
0.11.1latest on PyPI · released Feb 28, 2026
Audit
Dependencies
pyarrowrequiredpgpq processes Arrow tables; pyarrow must be installed separately
Agent activity
2 hits · last 30 days
node
2
Resources
pgpq — pip install pgpq · libregistry