[ZODB-Dev] Iterating over large ZODB

Chris Withers chris at simplistix.co.uk
Wed Feb 9 05:12:46 EST 2005


Hi All,

I want to do something like the following in an external method:

stack = [container.getPhysicalRoot()]

while True:
    object = stack.pop(0)
    print object.getPhysicalPath()
    print object.meta_type
    if object._isPrinicipiaFolderish:
       stack.extend(object.objectValues())
    if not stack:
        break

...but I'm worried that will drag all the objects in the ZODB into memory.

Now, given the ZODB in question is Zope.org, that's something i'd like 
not to do ;-)

How can I dump objects out of memory every 1000 or so times round the loop?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the ZODB-Dev mailing list