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
I'm fine with a MySQL-only solution. The text construct is always the fallback,
but I'm wondering if there is a way that I can use the attributes of my class
for the column name, instead of just a string. My column names are going to
change soon, but my object model will stay the same, so I am trying not to
explicitly use the column names in my code.
Can I do something like this?
'DATE_ADD(' + Class.dateAttr + ', INTERVAL(1 - ' \
+ 'DAYOFWEEK(' + Class.dateAttr + ')) DAY)'
If I can't use my class's attributes, is there a way I can at least use the
table object's columns like this:
'DATE_ADD(' + table.c.date_col.name + ', INTERVAL(1 - ' \
+ 'DAYOFWEEK(' + table.c.date_col.name + ')) DAY)'
I prefer one of these to a string because I will get an error during testing
when the statement is encountered. With a string, I will only get an error if
the statement actually runs in the DB.