Postgres with Plone

How to connect postgres with plone . Default usage is ZODB. How can I combine Postgres with it?

1 Like

There is also

for ZSQL methods in Zope/Plone (possibly outdated on Plone 5)

SQLAlchemy and related zope/plone packages are useful for integrators/developers wanting to talk to an existing Postgres database which is totally separate from their current ZODB.

But you can also store the ZODB itself in Postgres, and I wonder if that is what you mean.

By default, the ZODB is stored in FileStorage (usually a file var/filestorage/Data.fs). If you want to store the complete ZODB in Postgres instead, you can use RelStorage. See which says: "RelStorage is a storage implementation for ZODB that stores pickles in a relational database."

Don't expect to be able to do SELECT or other statements yourself though. Something like SELECT id from document where title = 'Welcome to Plone' is totally impossible. Just let RelStorage handle it.

(Note that files and images that you upload to Plone are not stored in the ZODB directly, but in a blobstorage, for Binary Large OBjects. That can stay the same when using RelStorage.)