Re: [sqlalchemy] Use custom datetime type for all datetime column with autoload

2013-07-18 Thread Michael Bayer
the most straightforward way is to use an event: from sqlalchemy.schema import Table from sqlalchemy import event @event.listens_for(Table, column_reflect) def set_utc_date(inspector, table, column_info): if isinstance(column_info['type'], DateTime): column_info['type'] =

Re: [sqlalchemy] Use custom datetime type for all datetime column with autoload

2013-07-18 Thread Rit Li
That works! Thank you, Michael. On Thu, Jul 18, 2013 at 7:02 AM, Michael Bayer mike...@zzzcomputing.comwrote: the most straightforward way is to use an event: from sqlalchemy.schema import Table from sqlalchemy import event @event.listens_for(Table, column_reflect) def

[sqlalchemy] Use custom datetime type for all datetime column with autoload

2013-07-17 Thread Rit Li
How can I make all datetime columns to use my UTCDateTime type by default? from sqlalchemy import types from pytz import utc Base = declarative_base() class UTCDateTime(types.TypeDecorator): impl = types.DateTime def process_bind_param(self, value, engine): if value is not