its in 0.5. Make sure you use the passed in compiler to compile sub-expressions, i.e. compiler.process(expr) instead of str(expr).
On Jun 4, 2010, at 5:45 AM, Jan-Eric wrote: > Thank you for your reply. > Is this available for version 0.6 only ? > > On Jun 3, 5:41 pm, Michael Bayer <[email protected]> wrote: >> On Jun 3, 2010, at 5:06 AM, Jan-Eric wrote: >> >> >> >> >> >>> Hi! >> >>> I have a problem with constructing a custom SQL statement. >>> I would like to create the following SQL >> >>> DATA_SUB( <somefixed-date>, INTERVAL <column-expression> MONTHS) >> >>> I tried the following approach: >> >>> - >>> sqlalchemy.func.DATE_SUB(startDate,sqlalchemy.literal_column("INTERVAL >>> %s MONTHS" % (exprColumn))) >>> this results in the following SQL: >>> DATE_SUB(%s, INTERVAL CASE WHEN (interval = %%s) THEN %%s WHEN >>> (interval = %%s) THEN %%s WHEN (interval = %%s) THEN %%s END MONTHS) >> >>> this doesn't work because % of the expression is escaped. How can I >>> prevent this ? >>> Should I use a different approach ? >> >> yes, you should use the compiler extension. >> http://www.sqlalchemy.org/docs/reference/ext/compiler.html >> >> >> >> >> >>> Thank you in advance! >> >>> Jan-Eric >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "sqlalchemy" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group >>> athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
