Return Custom Date objects instead of python inbuilt datetime.datetime objects

11 views
Skip to first unread message

bool

unread,
Jan 12, 2011, 6:24:01 AM1/12/11
to sqlalchemy
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?

Michael Bayer

unread,
Jan 12, 2011, 8:49:49 AM1/12/11
to sqlal...@googlegroups.com

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 sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
>

Reply all
Reply to author
Forward
0 new messages