Thanks Anthony, I was looking at the DAL code and it is kind
intimidating (at least for me)... Is out there some example of using the
"processor" argument?
Greetings.
El 04/07/16 a las 23:19, Anthony escribió:
I'd say the first option is "lazy", as it defers the query until the
data are requested, but terminology aside, the DAL does not have
built-in functionality to handle the second option. Note, on the
developers list, Massimo has just proposed a .join method on Rows that
would do something similar, but with two queries instead of 3+.
Alternatively, note that .select() takes a "processor" argument, so I
suppose you could implement a custom processor that takes a query
involving a join and instead of returning the typical join result set
returns a set of rows with nested records.
Anthony
On Monday, July 4, 2016 at 2:14:14 PM UTC-4, Carlos Cesar Caballero
wrote:
Hi, some ORMs have a lazy option for reduce queries when we ask for
references, for example, something like:
rows = db(db.mytable.id <http://db.mytable.id> > 0).select()
relation_name1 = rows[0].id_relation.name <http://id_relation.name>
relation_name2 = rows[1].id_relation.name <http://id_relation.name>
Will generate 3 querys, but with the lazy option, something like:
rows = db(db.mytable.id <http://db.mytable.id> > 0).select(lazy=true)
relation_name1 = rows[0].id_relation.name <http://id_relation.name>
relation_name2 = rows[1].id_relation.name <http://id_relation.name>
Will generate only one query, and in that way the DAL will make the
joins in the query and populate the reference rows.
Is posible do something like this with pyDAL?
Greetings.
--
Este mensaje le ha llegado mediante el servicio de correo
electronico que ofrece Infomed para respaldar el cumplimiento de
las misiones del Sistema Nacional de Salud. La persona que envia
este correo asume el compromiso de usar el servicio a tales fines
y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/
--
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
<mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
Este mensaje le ha llegado mediante el servicio de correo electronico que
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema
Nacional de Salud. La persona que envia este correo asume el compromiso de usar
el servicio a tales fines y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/
--
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.