On Sun, Sep 9, 2012 at 9:27 PM, Andrew W <[email protected]> wrote:
> (although I still don't quite really understand what a lazy table is).
imagine you have
models/db.py
db = DAL(...)
db.define_table("table1".....)
db.define_table("table2".....)
...
...
db.define_table("table30".....)
So, for each request (I mean every time user hits an url or click on
something) all that 30 tables will be imeddiatelly instantiated even if the
requested page does not need to all the 30 tables.
The process of table definition involves some logic such as instantiate a
new Table object, check all the fields, do migrations, check reserved
keywords, check the tablename atc...
Now if you turn
db = DAL(... lazy_tables=True)
for each request web2py will just store some data in a dictionary
{"tablename": {"fields": ....., "options":....}, no table will be
instantiated ultil needed.
So when in your program you do
db(db.table1),select() # in this time web2py will fire the table
instantiation and all the process, so it will happen only for the table you
need and you saved 29.
Thats it.
--