[ZODB-Dev] Support for graceful ZODB Class renaming

Greg Ward gward@mems-exchange.org
Thu, 16 Jan 2003 15:38:05 -0500


On 16 January 2003, Jim Fulton said:
>   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.
>      When pickling a class, we'd pickle the id, rather than the module
>      and class name. When unpickling a class, we'd lookup the module
>      and class name in the table.

This appeals to me for several reasons.  Obviously, making it easier to
rename classes is a good thing; making this a constant-time operation
with no complicated/time-consuming database churning is even better.

What I like even more, though, is that it adds an explicit catalog of
all classes in the database to the database itself.  This appeals to my
type-safety, bondage-and-discipline side.  (See
http://www.mems-exchange.org/software/grouch/ .)

Having a class catalog is nice in itself. But it is also a natural place
to hang schema information (class x.y.z.C has attributes a, b, and c; a
is an int, b a list of str, and c an instance of foo.bar.FooBar) or
other class-centric meta-data (eg. the set of all instances of x.y.z.C).

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org