[ZODB-Dev] Support for graceful ZODB Class renaming

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 17 Jan 2003 09:22:16 +0000


On Thursday 16 January 2003 8:14 pm, Jim Fulton wrote:

>    3. A more sophisticated approach is to build a table, stored in the
>       database providing a two-way mapping between a unique id and a
>       class module and name.  The ids could be assigned automatically.

I dislike the idea that independant storages will use different ids for t=
he=20
same class. It complicates storage hacking.

> I'm inclined to go with option 2 because it is:
>
> - Overall, it is simpler, although the conversion aspect is more
>    complicated.

Option 1 describes two techniques. 1a uses hard coded sys.modules aliases=
, and=20
1b uses an aliases file. A third variant (1c) is when a class moves from =
one=20
module to another, and the old module imports the class into its namespac=
e to=20
preserve the old name.

The option 2 conversion utility could work with all three variants if it=20
worked by importing the object using the old dotted name, then looking up=
 the=20
new dotted name from the object. Shortcutting this by looking direct in t=
he=20
aliases file would be faster, but less useful.


--=20
Toby Dickenson
http://www.geminidataloggers.com/people/tdickenson