Hello!
I have a test table with 90 061 rows and I want to fetch rows in batches, so I want to use fetchmany:
cursor = cnx.cursor()
query = "select id from test_table"
cursor.execute(query)
for i in range(105):
rows = cursor.fetchmany(1000)
print("rows returned : {}".format(len(rows)))
if not rows:
break;
Using connector versions 8.0.12 and above, the code do not stops when there is no more rows in cursor, fetchmany returns continously the last row from the set:
(...)
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 61
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
Using the same code with connector v 8.0.11 gets me expected result:
(...)
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 61
rows returned : 0
Python 3.6, MySQL 5.7
Is this a bug?
Best
Marcin
I have a test table with 90 061 rows and I want to fetch rows in batches, so I want to use fetchmany:
cursor = cnx.cursor()
query = "select id from test_table"
cursor.execute(query)
for i in range(105):
rows = cursor.fetchmany(1000)
print("rows returned : {}".format(len(rows)))
if not rows:
break;
Using connector versions 8.0.12 and above, the code do not stops when there is no more rows in cursor, fetchmany returns continously the last row from the set:
(...)
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 61
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
rows returned : 1
Using the same code with connector v 8.0.11 gets me expected result:
(...)
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 1000
rows returned : 61
rows returned : 0
Python 3.6, MySQL 5.7
Is this a bug?
Best
Marcin