New feature lazy_table doesn't help? I would go with lazy_table before use sub-directory since if you use sub-directory depending of your app design your code will be less DRY. You need to have the same function in controller sub-directory for each table. So if all your table use the same function create() you will have 20 create functions and the pain comes when you refactor these 20 functions. Maybe if you have a single function per controller file it could be possible to make symblinks and have only one master file, but I didn't try that and I don't know how web2py would react.
Also, there is many other thing to optimize, like the length of your models and controllers files. For example, let say you have create(), update(), select() functions, you can split them in there own controller file and it should speed up your app since there will be only a few lines of code to be parsed when calling create() for example. Use cache.ram() were it is possible, that speed up thing a lot. Good luck. Richard On Thu, Oct 18, 2012 at 10:20 AM, Don_X <don.clerm...@gmail.com> wrote: > hello web2py users, > > I am looking for specifics when it comes to creating additional tables > within a sub-directory of MODELS ! > > I am making significant progress on my app ! and I know that I will > certainly have an overhead issue because in my db.py file I have about 20 > tables defined and some tables have more than 20 fields in them ! > My approach was to build the app.. simply with no consideration for > performance .. but as I am moving along ... considering how far I have gone > ... it is time that I do go back and move a few things around. > > I really need to avoid the load of all these tables from the start and few > variables that are only pertinent to specific tables in there ! .. > so I'm thinking to only keep the auth_user table in my db.py file with > certain important global variables ( it is safe to assume that it is the > only table that will need to be loaded throughout ) > > The other tables, I want to move them to sub directories below the MODELS > with their corresponding controller names in the CONTROLLERS and > corresponding VIEWS ! > > As soon as I have started ... > > I get the error : > > <class '_mysql_exceptions.OperationalError'> (1005, "Can't create table > .......bla bla bla .. > > My Question or concern is this : > when using sub directories in MODELS, > Do I need to redo these instructions ? from (....) import ( > ..*..) > > Aren't they loaded already from db.py ? ... > what do I need to declare before defining the tables I want in the > MODELS/directoryname/file.py for example ? > what does the file.py in MODELS sub directory look like, I have looked at > various examples, even in the book, and even throughout the threads here > and could not find any suitable example > > please enlighten me ... > > please advise > > thank you > > -- > > > > --