You don’t have to use a loop whileat all because cursors are iterable:
for row in cursor:
print(row)
In the "Links and Cursors" section of the Django Documentation :
the connection and cursor basically implement the standard Python DB-API described in PEP 249, except when it comes to transaction processing.
From the mentioned PEP 249 :
Cursor.next ()
Returns the next line from the currently executing SQL statement using the same semantics as .fetchone ()
Cursor .__ ITER __ ()
self,