Maybe something like that.
You could do the query and save it as a dict and work on it.

result = db(db.table2.id > 0).select().as_dict()
retVal = [entity.name for entity in result]


2013/6/4 guruyaya <guruy...@gmail.com>

> Lets examine this code for a sec:
> db.define_table('table1',Field('name'))
> db.define_table('table2',Field('table1', db.table1), Field('name2'))
>
> Now, if I need a list of all table2 entries, but not the table1 entries,
> I'll do something like this:
>
> retVal = []
> for entity in db(db.table2.id > 0).select():
>     retVal += entity.name2
>
> BUT
> As you well know, web2py acctuall did ask for table1 info, just in case
> I'll do this:
>
> retVal = []
> for entity in db(db.table2.id > 0).select():
>     retVal += entity.table1.name
>
> On a normal hosting, it doesn't matter that much, but on GAE, it does an
> extra query to the datastore, and that's just a waste.
> Is there a way to avoid that?
>
> Thanks in advance
> Yair
>
> --
>
> ---
> 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.
>
>
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 

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


Reply via email to