loading objects from ZODB

A

Achim Domma

Hi,

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!

regards,
Achim
 
G

Gilles Lenfant

Achim Domma said:
Hi,

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!

regards,
Achim

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.

--Gilles
 
J

John J. Lee

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.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top