Re: [sqlalchemy] Retrieve Dates as UTC

2013-06-06 Thread Owen M
As far as I can tell that is just for setting the time. By the linked documentation, using server_default. Postgres stores all datetimes as UTC and then does the conversion on query, depending on the timezone set in the connection. This defaults to the computer's timezone. In my submission it

Re: [sqlalchemy] Retrieve Dates as UTC

2013-06-05 Thread Michael Bayer
we do this (for PG and SQL Server): class utcnow(expression.FunctionElement): key = 'utcnow' type = DateTime() @compiles(utcnow, 'postgresql') def _pg_utcnow(element, compiler, **kw): return "TIMEZONE('utc', CURRENT_TIMESTAMP)" @compiles(utcnow, 'mssql') def _ms_utcnow(element, compi