[PonyORM-list] Treating Pony Queries as "sets"
    Alexander Kozlovsky 
    alexander.kozlovsky at gmail.com
       
    Thu Jan 30 11:35:13 UTC 2014
    
    
  
Hi Matthew!
Yes, I think it is possible to add such functionality to Pony ORM. This is
not absolutely simple (because queries should be combined in some
intelligent way), but it is doable in all supported SQL engines.
Could you describe your use-case in more detail, for what purpose you plan
to use such query algebra?
On Tue, Jan 28, 2014 at 6:46 PM, Matthew Bell
<matthewrobertbell at gmail.com>wrote:
> Hello,
>
> I think that a useful feature would be treating pony queries as sets,
> which can have set operations applied to them (since they are lazy).
>
> Example:
>
> class Blah(db.Entity):
>   a = Required(int)
>   b = Required(int)
>
> query_1 = Blah.select(lambda blah: blah.a > 5)
> query_2 = Blah.select(lambda blah: blah.b < 10)
>
> Operations could then be possible such as:
>
> query_1 | query_2
> query_1 & query_2
> query_1 - query_2
>
> Is this possible with all SQL engines? I guess a new query object would be
> returned, which can then be executed as normal.
>
> --
> Regards,
>
> Matthew Bell
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.org
> /ponyorm-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20140130/0ddfb8f5/attachment.html>
    
    
More information about the ponyorm-list
mailing list