Re: [sqlalchemy] extract the WEEK off a timestamp across multiple database backends

2016-04-03 Thread Jonathan Vanasco
Thanks! This works like a charm. For the next person... `year_week(column)` turns a timestamp into "{Year}.{week of year}". I should probably 0pad the week , but not now. -- from sqlalchemy.sql import expression from sqlalchemy.ext.compiler import compiles import sqlalchemy.types

Re: [sqlalchemy] extract the WEEK off a timestamp across multiple database backends

2016-04-03 Thread Mike Bayer
On 04/02/2016 05:12 PM, Jonathan Vanasco wrote: I need to extract the week of the year across multiple databases (this needs to work on at-least sqlite and postgres, though mysql would be good too.) the problem? this operation isn't standard: sqlite: select strftime('%W',

[sqlalchemy] extract the WEEK off a timestamp across multiple database backends

2016-04-02 Thread Jonathan Vanasco
I need to extract the week of the year across multiple databases (this needs to work on at-least sqlite and postgres, though mysql would be good too.) the problem? this operation isn't standard: sqlite: select strftime('%W', cast(timestamp_event as text)) from table_a; postgres: