I have an sqlite query that looks like this:
db_rows = db_cursor.execute(
"SELECT * FROM my_table"
)
# check1
for row in db_rows:
print(row)
# check2
for row in db_rows:
print(row)
What happens is that the first for loop outputs all the rows, and the second does not output anythng at all which I find strange. Why is that? Is there a way for me to re-use db_rows multiple times? Perhaps this is a bug?
I need this because I have some nested code (for's and if's) which is supposed to re-use db_rows and believe it should be faster to just re-use db_rows that should be already in memory instead of executing the query again and again for each itteration of an inner loop.
Thank you.