you can pass a list, http://www.web2py.com/book/default/chapter/06#like,-regexp,-startswith,-contains,-upper,-lower It works fine for a small list, but when you get past a certain number maybe a 100 or a 1000, it gives an error, same thing with belongs. I think the nesting with the parenthesis becomes very high, and the stack overflows, I suspect it is an sqlite problem? To explain what it does, the query is part of a larger dynamic query,
> > x = something > y = something > z = something > queries=[] # an empty query to build a list upon > > queries.append(db.mytable.myfield_1.contains(x)) > queries.append(db.mytable.myfield_2.contains(y)) > queries.append(db.mytable.myfield_3.contains(z)) > . > . > queries.append(db.mytable.myfield_10.contains(a)) > query = reduce(lambda a,b:(a&b),queries) > grid = SQLFORM.grid(query, ...) > return (grid=grid) On Sunday, August 18, 2013 1:06:39 AM UTC-7, Massimo Di Pierro wrote: > > I think by this: > > x = ['a', 'b', 'c', ...] > queries.append(db.mytable.myfield.contains(x)) > > you mean: > > x = ['a', 'b', 'c', ...] > queries.append(db.mytable.myfield.belongs(x)) > > You cannot pass a list to contains. That may part of the problem. > there may be other problems. Can you show more code or explain what the > query is supposed to do? > > Massimo > > > On Saturday, 17 August 2013 21:11:52 UTC-5, dave wrote: >> >> I guess nobody encountered this issue before? >> >> On Thursday, August 15, 2013 11:59:31 AM UTC-7, dave wrote: >>> >>> . >>> . >>> . >>> x = ['a', 'b', 'c', ...] >>> queries.append(db.mytable.myfield.contains(x)) >>> query = reduce(lambda a,b:(a&b),queries) >>> grid = SQLFORM.grid(query, ...) >>> >>> return (grid=grid) >>> >>> gives an error of "Query Not Supported: parser stack overflow", if the >>> list x has too many values, like around 100 or a 1000, I suspect its an >>> sqlite limitation? can anyone suggest another succinct way of passing a >>> list to a contain like operator or method. >>> >> -- --- 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/groups/opt_out.