Tim Peters wrote:

[Tim Peters]
Stephan Richter was wrestling with a migration script a couple months
ago. I don't know whether he packaged the code he ended up with for
reuse. Here's a record of the IRC chat in which details got worked out:


[Stephan Richter]
The resulting code from the discussion is publically available in the
SchoolTool source:


[Syver Enstad]
Thank you Stefan. I am right if I suppose that the reason this fixes all
references is that it saves all persistent objects in the database?

Basically, but read the IRC log for details:  it (re)saves the current
revision of all objects not in a version.  It does not change non-current
revisions of objects, nor any revisions of objects in a version.  This is
because the FileStorage iterator only knows about current non-version

I don't use versions so that's fine. The IRC log was very illuminating BTW. It seemed to basically be going through exactly the same issues that I have been going through.

Will this also fix references to persistent objects in non persistent
objects stored in the database?

If (and only if) they're reachable from the root object following a chain of
non-version current revisions.  You can't store a non-persistent object N
directly in ZODB -- the only way N can get in is by being attached to a
persistent object P.  Then N's entire state is included in the pickle for P.
So when P is (re)saved, the entire state of N is recomputed, including (of
course) all references to persistent objects (if any) contained in N.

I see, that sounds good to me.

For now I am basically one happy guy. Thanks to everyone for responding and helping me out with my problem migrating.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to