btw: sqlite has a pretty "deep" default value that should handle 1000 of 
those "or". but or the sake of your app.... is it reaally necessary to 
fetch records in a single query asking for 1000 specific values ?

On Saturday, March 28, 2015 at 6:37:03 PM UTC+1, Anthony wrote:
>
> In this particular case, you should instead use .belongs():
>
> query = db.product.id.belongs([list of ids])
>
> It's an interesting problem, though. A somewhat hackish solution would be:
>
> query = ' OR '.join(str(db.product.id == i) for i in [list of ids])
>
> The problem is that OR and AND operators always wrap the operands in 
> parentheses, even when not necessary. The result is the nesting you observe 
> when using reduce() or appending in a loop. Perhaps there should be a way 
> to suppress the parentheses when not needed.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to