On 04/10/2010 22:53, Bryan wrote:
I'm having trouble converting this SQL into an ORM statement.

DATE_ADD(datecol, INTERVAL(1 - DAYOFWEEK(datecol)) DAY)

This is as far as I can get, which is basically nowhere.  The second
argument to date_add requires literal strings "INTERVAL" and "DAY",
but I also need to insert a function in the middle there.  Any help is
appreciated.

func.date_add(Class.dateAttr, INTERVAL(1 - DAYOFWEEK(Class.dateAttr))  DAY)

Are you looking for something database agnostic or something that just works for MySQL?

If the latter, look at text:
http://www.sqlalchemy.org/docs/core/tutorial.html#using-text

If the former, then you'll want a database agnostic implementation. So, what's the above sql actually trying to achieve?

Chris

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to