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', cast(timestamp_event as text)) from table_a;

postgres:
     select extract(week from timestamp_event) from table_a;

mysql: i think extract will work on a timestamp, but it might need to be
cast into a date first.  there is also a WEEK function.

how have others handled a need like this?

I stick with the @compiles approach for that kind of thing, e.g. http://docs.sqlalchemy.org/en/rel_1_0/core/compiler.html#utc-timestamp-function



--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to