On Jan 17, 2012, at 1:35 PM, Mason wrote: > This is great!! Wasn't aware of this at all. Is the <something that > does utc> part db dependent? I am only familiar with mysql, so if I > change to other db in the future, and the <convert to utc> function is > called 'convert_to_tz' instead of 'convert_tz', will this break? I > know I can access the named tuple using the following before. > > for r in rows > print r.event_ts >
The more involved time functions like TZ conversion and date arithmetic are database dependent. When you need to do things with dates in a platform-agnostic way, usually using the @compiles system to construct the set of functions that you need is the most direct route. In fact there's an example regarding UTC right here: http://www.sqlalchemy.org/docs/core/compiler.html#utc-timestamp-function > Now with the func.convert_tz(), can I use something like > func.convert_tz() AS ts, so I can reference it with r.ts? func. returns a column expression just like a column itself, all of which have label(), so func.convert_tz(mycolumn, ..., ..).label('ts') -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.