El domingo, 23 de diciembre de 2012 19:41:52 UTC-3, Alberto Plata 
escribió:I have a table,   db.define_table('schools', Field('school_name', 
'string')).  I've been adding data to the table by,    
db.schools.update_or_insert(
>
> school_name = 'ABC High School'). 
> My question is... Is there anyway I can call my 'schools' table with a 
> variable?? As an example, when I try:
>

web2py comes with a very useful dict notation support for storing and using 
references to tables as strings:

>>> tablename = "schools"
>>> schools_table = db[tablename]
>>> print type(schools_table)
<class 'gluon.dal.Table'>

More about fields, tables and everything on databases here:

http://www.web2py.com/books/default/chapter/29/06

-- 



Reply via email to