If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
Hi Jose,
That sounds really nice! Question, how does it differ with lazy table loading option in the core framework. Does it replace it or does it go in parallel with it?
best regards
Patrick
Hi Buezi,It works in the same way if you have the table definition in the models. To use lazy tables you can check the db.py and use: DAL(...,lazy_tables=True). The way I have described it is only to reduce code in models in case you have a big number of tables. This case is described on http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=lazy#Model-less-applicationsTo use the web2py shell: python web2py.py -M --shell appname DataBase(db=db, auth=auth, request=request) print db.tables()This module can be used as well from other apps, so it is compatible with cooperation: http://web2py.com/books/default/chapter/29/04/the-core?search=Cooperation#CooperationI hope I have been able to answer your question...
Hi Buezi,
It works in the same way if you have the table definition in the models. To use lazy tables you can check the db.py and use: DAL(...,lazy_tables=True). The way I have described it is only to reduce code in models in case you have a big number of tables. This case is described on http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=lazy#Model-less-applications
To use the web2py shell: python web2py.py -M --shell appname DataBase(db=db, auth=auth, request=request) print db.tables()
This module can be used as well from other apps, so it is compatible with cooperation: http://web2py.com/books/default/chapter/29/04/the-core?search=Cooperation#Cooperation
I hope I have been able to answer your question...
Define tables into modules to minimize the code in models
0
buezi 9 years ago
Hi Jose,
That sounds really nice! Question, how does it differ with lazy table loading option in the core framework. Does it replace it or does it go in parallel with it?
best regards
Patrick
replies (1)