[ZODB-Dev] Re: Ape and retrieval of other zodb items
Shane Hathaway
shane at zope.com
Thu May 1 17:21:23 EDT 2003
Rocky Burt wrote:
> What I'm trying to do is provide my own SQLProperties gateway (I have my
> own hooked in and confirmed in-use). This gateway, instead of
> storing/loading to/from a zodb_properties table is instead doing its
> work on a table by the name of whatever class_name its identified by
> from the classifier.
>
> So, instead of saving each property in a id, type, value tuple, I'd be
> storing each property as a column name in the table which represents the
> class I'm dealing with.
>
> In order to do this I need to know beforehand what properties the class
> can possibly have (in order to generate applicable sql). At a minimum,
> during the load/store calls I need to know the name of the
> attribute/property being loaded/stored so I know which table column to
> access.
ZODB loads and stores all attributes of an object at once. If you want
to know which attribute/property is being loaded/stored, the appropriate
answer is "any, and maybe all of them."
I think the limitation here is the schema. A schema of (id, type,
value) allows the serializer to communicate only the properties the
instance, not the properties defined by the class. You either need a
new kind of schema that allows the property schema to be included with
the property values (Ape's standard schemas don't provide this), or you
need to force the serializer to serialize the properties consistently
across all instances of a class. Either way, you'll need to modify a
serializer or provide your own.
I hope this helps. I like the idea of automatically inventing table
names based on class names.
Shane
More information about the ZODB-Dev
mailing list