Hi all,
    I have a question related to table definitions in modules. I'm working 
in an app that has more than a hundred tables and I noticed that even using 
lazy tables it took too much for browsing the site.
    I decided to move some of the tables to a module and call them on 
demand, and the performance improved a lot.
    The problem is if there's any way to define new tables from the module.

   Whatever I do, I get the error:

  ProgrammingError: ('ERROR', '42P01', 'relation "test_t" does not exist')

Definition of test_t in module

> from gluon import *
> from gluon.dal import Field
> def defineTEST(db):
>     if 'test_t' not in db:
>         db.define_table('test_t',
>         Field('bid', 'reference b_t', ondelete='CASCADE'),
>         Field('date', 'date'),
>         migrate=app_settings.migrate)


Code added to 10dbmodel.py in models:

> from app.modules import defineTEST
> defineTEST(db)


   And the table is not created.

Thank you!

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

Reply via email to