‘Seamless object persistence with ZODB’ session notes

Rambling notes made during this talk in EuroPython 2007, please take with a pinch of salt.

  • ZODB can be used standalone
  • Persistence class is used as base class
  • transaction.about() = rollback
  • root[] = dictionary like object
  • root[‘app’] = root object

Storage options

  • Filesystem
  • Access to DB
  • Pickle
  • Serialise
  • MappingStorage
  • DemoStorage [reads live DB; writes to demo]
  • ZEO database
  • Can wrap with BlobStorage

Eggs:- EasyInstall ZODB

NB: Mutable objects need extra care; e.g. Preserving changes in a list after creation. Where possible use PersistentList, PersistentDict, …

If you have a handler on an object you can mark it’s parent as changed; e.g.root._p_changed.

Files

ZODB (verify: 3.8 beta blogs)

Transactions

  • commit
  • abort
  • doom (delay abort; use value after marked not to commit)
  • save points [Can stack, e.g. If processing a file or a a loop of actions]
  • undo

Standalone querying tool for ZODB

  • zope.index
  • zope.catalog

Backup

  • Hotcopy
  • Incremental backup possible

Look up