[web2py] Re: insert into web2py tablel with field indices

2012-04-29 Thread Anthony
If you're using Python 2.7, you can use a dictionary comprehension: db.Account_Master.insert(**{f: 'somevalue' for f in db.MyTable.fields}) otherwise, a generator expression passed to dict: db.Account_Master.insert(**dict((f, 'somevalue') for f in db.MyTable.fields )) Anthony On Sunday, April

[web2py] Re: insert into web2py tablel with field indices

2012-04-29 Thread simon
You could do: for field in db.mytable: field.default=somevalue db.mytable.insert() However why would you want to do this? On Sunday, 29 April 2012 08:08:44 UTC+1, rahulserver wrote: > > The insert function in web2py expects db.tablename.insert(...) with column > name and value pairs. What