loading objects from ZODB

John J. Lee jjl at pobox.com
Sat Jul 5 03:26:52 CEST 2003

"Gilles Lenfant" <glenfant at NOSPAM.bigfoot.com> writes:

> "Achim Domma" <domma at procoders.net> a écrit dans le message de news:
> be47oo$621$05$1 at news.t-online.com...
> > I'm playing around with ZODB but I don't understand when objects are loaded
> > from the DB. Assume I have an object containing a list of other objects. If
> > this object is loaded from ZODB, when is the list filled? Only on demand? I
> > think yes, because otherwise reading the top node would result in loading
> > the whole database. But I wanted to be sure!

BTrees (OOBTree, IOBTree, OITree, IITree) load contained objects on
demand, most other data structures (including PersistentList and
PersistentMapping) don't.

> It seems you don't need to care about this. The persistence of objects is
> (almost) transparent.
> You get/set the objects through a transparent cache to the database.
> The only rule : all objects must be picklable, and watch the doc about
> _v_xxx and p_xxx attributes.

That's not the only rule.  Documentation is thin, of course.  Andrew
Kuchling's intro is required reading, as is Jim Fulton's (though the
latter is particularly out of date, IIRC).  There is some useful info
on BTrees and associated data structures on the Zope wiki.


More information about the Python-list mailing list