Web2py docs have two methods for inserting into a database
db.tbl[0] = newRow
and
db.tbl.insert(newRowAsDict)
The documentation implies that they are synonyms, but they appear to be different. For one, the insert method throws an exception if newRow contains fields that are not in the table. Also the .insert method returns the id of the added row, where the assignment doesn't.
There is also
db.tbl.insert(**db.tbl._filter_fields(newRowAsDict))
which will filter the keys in newRowAsDict ignoring unknown fields.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With