[ZODB-Dev] Broken instances after refactoring in ZODB

Adam adamauckland at gmail.com
Sat Oct 4 11:28:10 EDT 2008


On Fri, 2008-10-03 at 14:24 -0600, Shane Hathaway wrote:
> Marius Gedminas wrote:
> >   1. create modules in their old locations that import all the classes
> >      from the new locations (and do nothing else).
> >   2. write a script that opens the DB, iterates over all persistent
> >      objects in it, touches every single one of them (obj._p_activate()
> >      followed by obj._p_changed = True) and commits the transaction.
> 
> Marius said it correctly, but I'd like to emphasize that it's not enough
> to touch just the objects whose class changed, since persistent
> references encode the module and class name.  It's best to just touch
> everything.  You will have to use multiple transactions to touch
> everything in a large database.

Thanks for that, guys, I've not used a mailing list like this before so
unsure how to respond. 

If ZODB stores the Package.Module.Class name in the pickle would it be
possible for me to simply rename them in the binary file?

My confusion here is that I've globally imported everything from the
packages into the current namespace of my main module. ZODB shouldn't be
aware I've moved the modules since for all intents and purposes to
Python, they are still there.

Does ZODB do something crazy with the __import__ function? I have a
feeling the Persistent module must be imported in a certain order with
the rest of the classes.

There seems to be a dearth of documentation for the ZODB recently so I'm
just going by what I can figure out. It's quite annoying really because
the ZODB is the most obvious database choice to use and I've been
banging on to all who'll listen about OODBs. Ideally I'd like to
understand it enough to document it for other people.

Thanks for replying.

Adam

> 
> Shane
> 
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev



More information about the ZODB-Dev mailing list