Robert Leftwich wrote:
SELECT d.date, d.price FROM daily_prices d, yearly_values y
WHERE y.value > 5
AND d.date - y.date BETWEEN '0 months' and '15 months'
Is this achievable in SA (other than by using text() or similar), with
the caveat that this requirement is part of a variable set of user
selected criteria so the select needs to be built up using the
'statement.append_whereclause()' and 'statement.append_from()' functions?
Answering my own question...
Yes, it is doable with something along the lines of :
s.append_whereclause(
and_(yearly_value_table.c.value > 5.0
between_(daily_prices_table.c.date - yearly_value_table.c.date,
"'0 months'", "'15 months'")))
(Note the two sets of quotes).
Robert
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users