The method fetches all or remaining rows of a query result set, returning a list of tuples. When no more rows are available, it returns an empty list.
The following example shows how to retrieve the first two 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()
You must fetch all rows before being able to execute new queries using the same connection.