Say I have the following code
cursor = connection.cursor()
cursor.execute(query)
after this point I want to iterate over the whole set of results.
What's the difference between
for row in cursor:
print row[0]
for row in cursor.fetchall():
print row[0]
I
I guess the first one uses the fetchone method.
1) First, a query is executed at each iteration. 2) does it use the fetchone method or the fetchall method 3) which is better for great results?
source
share