Using Python 3 and sqlite, I perform a query that gives me results I want to iterate over. But, as part of what I want to do in the iteration, I want to perform a second query. But, when I do the second query, the results from the first query are destroyed by the second query and my script stops iterating over the first query because there is nothing left from the first query to iterate over (hoping this makes sense!). Is it possible to have 2 or more query results in the same script unaffected by each other? Or, what is a good/best way to resolve this issue?
Here's an example of what I mean:
curs.execute('SELECT number1, number2, FROM numbers WHERE ID = 3')
for row in curs:
do this (whatever?)
do this (whatever?)
curs.execute('UPDATE table1 SET ID = "foo" WHERE state = "bar"')
conn.commit()