Hermann Himmelbauer wrote: > Hi, > In one of my database tables I have a varchar that is mapped to an object > with > a string attribute. This specific varchar should however be represented by a > certain Python object, therefore it would be very handy, if there would be a > way to automatically load/represent this data. Is there support from > SQLAlchemy? > > I thought about writing a property for my attribute but I'm unsure if this is > compatible with SQLAlchemy, as SA sets up its own properties for attributes > when the object is mapped, so probably mine would be overwritten?
You could either create a custom type for the column to do translation to/from object form or use a property as a proxy to the varchar attribute. They're both pretty easy to implement: http://www.sqlalchemy.org/docs/04/types.html#types_custom http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_overriding -j --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---