[storm] SELECT with expressions, how to use new column
Daniel Åkerud
daniel.akerud at gmail.com
Sat Dec 15 20:49:27 UTC 2012
Hello! I'm using Storm with a mysql backend, and I'm doing a select with an expression, like this:
result = self.store.find((Report, SQL("CURRENT_TIMESTAMP") - Report.timestamp as age), SQL("CURRENT_TIMESTAMP") - Report.timestamp < $max_age)
i.e:
SELECT *, (CURRENT_TIMESTAMP - timestamp) AS age FROM report WHERE report.(CURRENT_TIMESTAMP - timestamp) < $max_age;
(notice the "AS age")
So I want to use the new column in Storm, but do not know how to achieve that.
Thanks!
PS: If you know how to optimise away writing "SQL("CURRENT_TIMESTAMP") - Report.timestamp" twice, that would be SUPER :-)
--
BR/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/storm/attachments/20121215/5f36660c/attachment.html>
More information about the storm
mailing list