ZODB storage adapter for PostgreSQL using JSONB, powered by zodb-json-codec.
zodb-pgjsonb stores object state as queryable JSONB instead of opaque pickle bytea.
ZODB sees pickle bytes at its boundaries; PostgreSQL sees queryable JSON internally.
- SQL Queryability -- query ZODB objects directly with PostgreSQL JSONB operators and GIN indexes
- Performance -- Rust-based codec, psycopg3 pipelined writes, pure SQL pack/GC (15-28x faster than RelStorage)
- Tiered Blobs -- small blobs in PG bytea, large blobs in S3 (configurable threshold)
- Full ZODB Compatibility -- IStorage, IMVCCStorage, IBlobStorage, IStorageUndoable, IStorageIteration, IStorageRestoreable
- Security -- JSON has no code execution attack surface (unlike pickle deserialization)
Requires Python 3.12+, PostgreSQL 15+ (tested with 17).
%import zodb_pgjsonb
<zodb_db main>
<pgjsonb>
dsn dbname=zodb user=zodb password=zodb host=localhost port=5432
</pgjsonb>
</zodb_db>pip install zodb-pgjsonb # or: pip install zodb-pgjsonb[s3]Full documentation: https://bluedynamics.github.io/zodb-pgjsonb/
- Quickstart (Docker) -- Plone + PostgreSQL + MinIO in 5 minutes
- Migration guide -- migrate from FileStorage or RelStorage
- Configuration reference -- all ZConfig and Python API options
- Architecture -- design decisions and data flow
- Performance benchmarks -- detailed comparison with RelStorage
- SQL query examples -- querying ZODB data with SQL
- State processor plugins -- writing extra columns alongside object state
The source code is managed in a Git repository, with its main branches hosted on GitHub. Issues can be reported there too.
We'd be happy to see many forks and pull requests to make this package even better. We welcome AI-assisted contributions, but expect every contributor to fully understand and be able to explain the code they submit. Please don't send bulk auto-generated pull requests.
Maintainers are Jens Klein and the BlueDynamics Alliance developer team. We appreciate any contribution and if a release on PyPI is needed, please just contact one of us. We also offer commercial support if any training, coaching, integration or adaptations are needed.
ZPL-2.1 (Zope Public License)