I am using python's sqlite3 module.
I want to iterate through the rows in my table until none are left. I want to do this one at a time instead of using fetchall because the table is quite large. I read in the python sqlite3 documentation that curs.fetchone() returns None when no rows are left in the cursor's selection.
So I had the idea to run my code in a while fetchone(): loop, with the 'actual' fetchone() call occuring inside the loop, like so:
while c.fetchone():
row = c.fetchone()
print(foo(row))
I can't tell if this loop is actually fetching a row once in the while statement and once in the body, or if it is only in the body. Which one is it?
Aucun commentaire:
Enregistrer un commentaire