[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony
> > Hm, but how does it know to return a set object from the product_filter > table rather than the product or filter table? Set objects are not associated with a particular table -- they represent a set of records to be returned by the db, which may involve a join of multiple tables. Basical

[web2py] Re: Please explain how this query works

2013-05-21 Thread Robin Manoli
it's explained here: http://web2py.com/books/default/chapter/29/06#Many-to-many Den tisdagen den 21:e maj 2013 kl. 22:02:00 UTC+2 skrev brac...@gmail.com: > > Is there a section in the online web2py book that explains Niphlod's way > to building a query? > > Near the bottom of this > thread

[web2py] Re: Please explain how this query works

2013-05-21 Thread Niphlod
all those (query) just add a bit of "where" clause in the select that you pass to the db. you can use them with db((query) & (query) & (query)) or with db(query)(query)(query) ... the resulting select passed to the db would be the same! On Tuesday, May 21, 2013 10:43:48 PM UTC+2, brac...@gmail.

[web2py] Re: Please explain how this query works

2013-05-21 Thread bracquet
Hm, but how does it know to return a set object from the product_filter table rather than the product or filter table? And what does these two queries mean when it comes executing the queries? (db.products.id == db.product_filter.product_id) & (db.filters.id == db.product_filter.filter_id

[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony
Note, I'm not sure the fact that a Set is callable is documented in the book. On Tuesday, May 21, 2013 4:14:48 PM UTC-4, Anthony wrote: > > db(some_query) creates a DAL Set object (on which you can then call > methods such as .select(), .update(), etc.). A Set object is also callable, > and if

[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony
db(some_query) creates a DAL Set object (on which you can then call methods such as .select(), .update(), etc.). A Set object is also callable, and if you call it by passing in another query, it will simply add the new query as an AND condition. So, that code is just equivalent to: db( (db.