I have a table A  that is referenced by another B using the standard 
reference type in web2py.

db.define_table('A',
...
   field('name')
...
)

db.define_table('B',
...
   field('A', db.A)
...
)


 Previously, everything was working fine but after importing a sizeable 
amount of records (>300k rows) into table A, the app stalls when trying to 
load a form generated by 

form = SQLFORM(db.B, record = x)
>
>  Tracing the stall, I found that this occurred at the point where SQLFORM 
tries to build the options widget and populate it with records from table 
A. I have a modest server and hence, this problem may not be noticeable at 
this scale for a more powerful server. 

The workaround I have managed to get working is to override the default 
options widget with

db.define_table('B',
...
   field('A', db.A, widget=SQLFORM.widgets.string.widget)
...
)

The question I have is if there is a better way to overcome this?

-- 



Reply via email to