You can do <begin script.py> from gluon import DAL, Field db=DAL("sqlite://storage.sqlite", path='/path/to/app/databases') db.define_table('content', Field('author'), Field('time', 'datetime', update=request.now), Field('text', 'text')) db.content.insert(....) </end> $ pyhton script.py
or <begin script.py> db.content.insert(....) </end> $ pyhton web2py.py -S yourapp -M -R script.py On Tuesday, 8 January 2013 05:07:08 UTC-6, sasogeek wrote: > > I have a database table shown below: > > db=DAL("sqlite://storage.sqlite") > > db.define_table('content', > Field('author'), > Field('time', 'datetime', update=request.now), > Field('text', 'text')) > > Question is, how do I connect to the database via a script, and what is > the syntax for inserting data into a web2py database table via a script? I > want to know this because I'll be looping through a list and inserting data > from the list to the database as I loop through... > --