ZODB PersistentLists loading lazily?

If I load an object with multiple PersistentList attributes - do lists load automatically? Or does ZODB wait until I get access to the list item to load it? If the latter, does it load the entire list whenever an item is accessed, or only part of the list?

+4
source share
1 answer

If your items within the list themselves inherit from persistent.Persistent , they will load on demand.

Primitive types and classes that are not inherited from Persistent , however, are loaded into memory along with an instance of PersistentList.

PersistentList is basically a subclass of UserList (and Persistent ) that sets self._p_changed on change, so the change to the list is translated into a ZODB commit for writing.

+4
source

Source: https://habr.com/ru/post/1391948/


All Articles