I'm trying to do some database stuff in Python 2.6 with sqlite3, and am having trouble understanding the basics of the interface between the two. I am able to create database files and retrieve records, but some other commands are mysterious.
Here's a snippet where I'm trying to retrieve the number of records in file "thefile", located in database "mydata" in sister folder "data":
-
conn = sqlite3.connect("../data/mydata")
-
db = conn.cursor()
-
NRecs = db.execute( "SELECT COUNT(*) FROM thefile" )
OK, where do I find the output of the SELECT command? NRecs is a "cursor" object and the number of records is not stored there in any reasonable way I can see. I know this is baby stuff, but without the answer I can't work properly. Thanks for your help.