CURRENT_TIMESTAMP AT TIME ZONE 'UTC'

244 views
Skip to first unread message

Jonathan Vanasco

unread,
Mar 14, 2013, 11:29:18 PM3/14/13
to sqlalchemy
i need to replace my calls to `sqlalchemy.func.current_timestamp()`
with something that generates "CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"

anyone have quick advice ?

Audrius Kažukauskas

unread,
Mar 15, 2013, 4:07:05 AM3/15/13
to sqlalchemy
I have answered this question on StackOverflow, if others are
interested:

http://stackoverflow.com/questions/15424199/howto-current-timestamp-at-time-zone-utc

--
Audrius Kažukauskas
http://neutrino.lt/

Jonathan Vanasco

unread,
Mar 15, 2013, 2:54:26 PM3/15/13
to sqlalchemy
much thanks, Audrius

i ended up doing the following (last night) before i read this in the
morning.

1. s/sqlalchemy\.func\.current_timestamp/sql_now/g
2. def sql_now(): return sqlalchemy.sql.text("(CURRENT_TIMESTAMP AT
TIME ZONE 'UTC')")

i'm working on implementing your more-proper method now. i figured by
creating the sql_now function, i could quickly limit the amount of
future edits. it thankfully worked!
Reply all
Reply to author
Forward
0 new messages