The Python Cursor Class

The Cursor class represents a cursor to iterate through instances of a specified class, the result set of a find/search operation, or the result set from SQL queries. It provides the following methods:

find(cls, idx, value) Find a database object of class cls by an index idx and key value (a DB API compliant call)
search(cls, idx, op, value) Locate the position of a database object of class cls in an index idx and key value using the operation op (a DB API compliant call)
checkpoint() Checkpoint the cursor; this updates the index for the any updated objects previously returned by the methods first(), last(), next(), prev() or skip().
close() Close the cursor
getAutoId() Get the autoid of the current object
first() Move cursor to the first position
last() Move cursor to the last position
next() Move cursor to the next position
prev() Move cursor to the previous position
skip() Move cursor to the next position without retrieving the element
reset() Reset (rewind) the cursor
current() Return the object to which the cursor is referring
execute(query [,args]) Execute a SQL query against the database substituting arguments args for format specifiers in the query string (a DB API compliant call)
execute_many(query, args) Execute a SQL query against the database applying a set of parameters args (a DB API compliant call)
fetchone() Return the next row of result set (a DB API compliant call)
fetchmany([size=cursor.arraysize]) Fetch the next set of rows from a result set optionally specifying the size of the resutl set (a DB API compliant call)
fetchall() Fetch all (remaining) rows of a query result (a DB API compliant call)
rowcount The Read-Only property that indicates the number of rows affected