Try this

from gluon import DAL
db=DAL('sqlite://fw.db',folder='applications/app/
databases',auto_import=True)

rows = db(db.fw).select()
dest_ip_string ='%s' % rows[1].dst_ip

On Jun 7, 5:22 pm, chewbacca <[email protected]> wrote:
> Hello all.
>
> I am using web2py to generate a form and save the information in a DB.
> User puts the information on the form and the information gets saved
> in the DB sqlite.
> I want to be able query the DB and get the information the from the
> user input.
>
> =================
> file DB.PY looks like this:
> ...
> db=DAL("sqlite://db.db")
>
> db.define_table('fw',
>     Field('dst_ip'),
> ...
> =================
> I am trying to connect to the DB like this:
>
> from gluon.sql import *
> db=DAL('sqlite://fw.db')
>
> but it does not appear to be working
> =================
>
> How do I write a python script to be able to print the information
> from the user input from the form stored in the DB?
>
> it works when I query the DB direclty from inside the Web2py >
> Controllers > Shell >
>
> rows = db(db.fw).select()
> dest_ip_string ='%s' % rows[1]['dst_ip']
>
> Thank You

Reply via email to