[ZODB-Dev] Migrating classes in ZODB 3.5.1

David Binger dbinger at mems-exchange.org
Wed Nov 9 10:11:46 EST 2005


On Nov 9, 2005, at 9:21 AM, Syver Enstad wrote:

>>> What I want to do is just update the persistent instance so that  
>>> it will
>>> load from the new module/ new class after I have done a one time  
>>> update
>>> of the database.
>>>
>>
>> I fear this will not work.
>>
>> For efficiency reasons, the class designator (usually a
>> module, classname tuple) is stored both in the object itself
>> and in persistent references. While you will be able
>> to modify the object's class the persistent references will
>> only change when the containers are stored into the ZODB.

Is there something to prevent your update script from
setting _p_changed = 1 on every persistent object that contains
a reference to an instance of the moved class?
I think that if you do that and commit and pack the database, the
old module/class references will be purged.

If you do this, the sys.modules hacking only has to happen
in the update script.






More information about the ZODB-Dev mailing list