Am Freitag, 14. September 2007 23:52 schrieb jason kirtland: > 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_overri >ding
Perfect, thanks! Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---