On Jan 12, 2011, at 6:24 AM, bool wrote: > Sql alchemy returns datetime.datetime objects upon querying a datetime > column. We have our own custom datetime classes and I would like Sql > alchemy to understand or return these custom datetime objects instead > of datetime.datetime objects. I would also like sql alchemy to > understand our custom datetime objects while constructing the query. > > How can I teach sql alchemy to do all these?
Usage of user-defined types, specifically TypeDecorator which augments the Python data handled by a native type, is described at http://www.sqlalchemy.org/docs/core/types.html#augmenting-existing-types. You'd specify these types when defining Table metadata. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > 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. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
