This is a collection of tips extracted in part by reading the Web2py code.
Get DAL object given a Table object (in
Get names of fields in a table:
Get Field objects from a table (field name in
Read out the whole table:
Clear the table (caution, requires foreign key constraints turned off):
Load table from a Rows object (e.g. as obtained by reading out the table as above) or from a list of dicts:
table.truncate() for row in rows: if isinstance(row, Row): row = row.as_dict() table.insert(**row)