Cursor.fetchall

Fetch all (remaining) rows of a query result.

For an overview see page Python Cursor Class

Prototype

 
    Cursor.fetchall()
 

Arguments

void No arguments

Description

This method returns all (remaining) rows of a query result, returning a list. This is a DB API compliant call. An empty list is returned when no rows are available. Note that the cursor’s arraysize attribute can affect the performance of this operation.

Returns

list The set of rows remaining or an empty list

Example

     
    conn = db.connect()
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM Metatable WHERE TableName='%s'" % clsname)
    res = cursor.fetchall()
    ...
    cursor.close()
    conn.rollback()