[web2py] Standalone DAL Usiage - Insert from a Dictionary (vs bulk_insert)

2012-01-26 Thread BrendanC
I'm testing standalone DAL usage - basically using the DAL to help move/convert some tables from an external db. Basically I'm trying to populate a dictionary with a subset of data from an external database and then insert a series of data records into a new table. I expected to be able to

Re: [web2py] Standalone DAL Usiage - Insert from a Dictionary (vs bulk_insert)

2012-01-26 Thread Bruno Rocha
You have to unpack the dictionary with ** ddb.mytbl.insert*(***ddict) In Python dictionaries can be unpacked using ** and lists are unpacked with *, it is knows as *args and **kwargs optionally you can use the db.mytbl.filter_fields to remove the unknown fields from the dict. -- Bruno Rocha