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
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',
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: