No, the database is queried when you call the .select() or .executesql() 
method. The former returns a Rows object and the latter a list of tuples, 
so when you loop over your "query" object (which is confusingly named), you 
are simply looping over a Python data structure.

Anthony

On Thursday, March 30, 2017 at 11:51:00 AM UTC-4, Richard wrote:
>
> Hello,
>
> I would like to clarify how DAL handle backend query.
>
> For instance, if I assign a db().select() or executesql to a var like so :
>
> query = db().select() 
> or
> query = db.executesql() 
>
> Is the backend query occurs then or it occurs when I use the query var in 
> a for loop for instance.
>
> And if I am loop 2-3 differents times over the same query var does that 
> trigger backend query each time?
>
> Thanks
>
> Richard
>

-- 
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