I am developing a plugin that connects to a spatialite DB , do some queries and outputs the results to a spatialite table. I had tried with the below code to connect to the DB and print the queried result to the console as first step.

from pyspatialite import dbapi2 as db
conn = db.connect('/home/farook/DB/cities.sqlite')
cur = conn.cursor()
sql = 'select * from test_pt'
rs = cur.execute(sql)

I could not see anything printed for the given query. Please tell me where i am wrong.

rows = cur.fetchall()
for row in rows:
     print row

or for one record:

row = cur.fetchone()
print row

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.