Populating database

19 views
Skip to first unread message

harshit agrawal

unread,
Nov 22, 2009, 4:47:23 AM11/22/09
to web2py-users
sir,
I am populating my database by filling forms. But I don't want to fill
long forms again and again. Is there a way to populate the database in
one shot . If Yes, please explain...

Thank You
waiting for response
harshit

mdipierro

unread,
Nov 22, 2009, 10:19:14 AM11/22/09
to web2py-users
With random data or with your own data?

1) With random data:

from gluon.contrib.populate import populate
populate(db.table,1000) # will fill db.table with 1000 records

2) With your own data
I depends on where the data is. You can create a controller action
that loops and
db.table.insert(field='value',...)


On Nov 22, 3:47 am, harshit agrawal <harsh.agrawal2...@gmail.com>
wrote:

mr.freeze

unread,
Nov 22, 2009, 4:39:29 PM11/22/09
to web2py-users
Any chance you could add populate to svn?

mdipierro

unread,
Nov 22, 2009, 5:50:23 PM11/22/09
to web2py-users
done.

harshit agrawal

unread,
Nov 23, 2009, 7:27:35 AM11/23/09
to web2py-users
I got it.
Thank You
Reply all
Reply to author
Forward
0 new messages