On Mon, Sep 22, 2014 at 11:12 PM, Carlos Sanchez
<carlos.sanc...@nextthought.com> wrote:
> Hi,
> I was wondering if there is an official API and/or a way to iterate through
> all objects in a ZODB database.

In general, official interfaces are found in ZODB.interfaces.

IStorageCurrentRecordIteration lets you iterate over meta data about
objects in the database, including oid, tid and pickle. Both
FileStorage and ZEO implement this interface.

You can pass the oid to a connection's get method to get the object.
Iterating over the entire database requires some care to avoid
exceeding RAM.  After dealing with each object, you'll probably want
to call cacheGC on the connection to free unneeded memory.


> We are using RelStorage (MySQL) and ZEO (4 Dev)

I don't know if RelStorage implements IStorageCurrentRecordIteration.


Jim Fulton
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to