The method fetches all or remaining rows of a query result set, returning a list of tuples. An empty list is returned when no rows are (anymore) available.
The following examples shows how to retrieve the first 2 rows of a result set, and then retrieve the remaining rows:
>>> cursor.execute("SELECT * FROM employees ORDER BY emp_no")
>>> head_rows = cursor.fetchmany(size=2)
>>> remaining_rows = cursor.fetchall()
Note that you have to fetch all rows before being able to execute new queries using the same connection.
Returns a list of tuples or empty list when no rows available.

User Comments
Add your own comment.