[storm] Compiling python list comprehensions into SQL

Mark Ramm mark.mchristensen at gmail.com
Sun Aug 12 03:02:48 BST 2007


I believe Robert Brewer is doing something like this in his SQL
Construction library.

http://projects.amor.org/geniusql

--Mark Ramm

On 8/9/07, Johan Dahlin <jdahlin at async.com.br> wrote:
> Hi
>
> I few weeks ago I decided to spend a little time on an small hack which
> would make it possible to use python list comprehensions and avoid
> the penalty imposed when executing logic on the client side.
>
> Eg, Why shouldn't it be possible to write this kind of code:
>
>    cost = sum(e.salary * e.comission for e in company.employees)
>
> instead of;
>
>    result = company.employees.find(Employee.company_id == Company.id)
>    cost = result.sum(Employee.salary * Employee.comission)
>
> The former version is far more readable but unfortunately a lot slower
> when the size of the database increases.
>
> Attached is a small proof of concept I wrote which with help of a
> decorator and a meta class makes it possible to mark methods which
> then will be optimized.
>
> I'm not suggesting that this should be included in Storm itself, it's
> pretty hackish as it is right now. I'm just proving that it can be done
> and making sure that this can be found by anyone having similar ideas.
>
> Johan
>
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
>
>
>


-- 
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog



More information about the storm mailing list