Name
fetchmany( )
Signature
rows = cursor.fetchmany
([size])
Synopsis
Fetches the next set of rows of a result set as a sequence of sequences. If no more rows are available, this method returns an empty sequence.
If specified, the size
parameter dictates
how many rows should be fetched. The default value for this parameter
is the cursor’s arraysize
value. If the size
parameter is larger
than the number of rows left, the resulting sequence will contain all
remaining rows.
Example
connection = MySQLdb.connect(host='carthage', user='test', passwd='test', db='test'); cursor = connection.cursor( ); cursor.execute("SELECT * FROM TNAME"); rows = cursor.fetchmany(5);
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.