10.5 Class cursor.MySQLCursor

10.5.1 Constructor cursor.MySQLCursor
10.5.2 Method MySQLCursor.callproc()
10.5.3 Method MySQLCursor.close()
10.5.4 Method MySQLCursor.execute()
10.5.5 Method MySQLCursor.executemany()
10.5.6 Method MySQLCursor.fetchall()
10.5.7 Method MySQLCursor.fetchmany()
10.5.8 Method MySQLCursor.fetchone()
10.5.9 Method MySQLCursor.fetchwarnings()
10.5.10 Method MySQLCursor.stored_results()
10.5.11 Property MySQLCursor.column_names
10.5.12 Property MySQLCursor.description
10.5.13 Property MySQLCursor.lastrowid
10.5.14 Property MySQLCursor.rowcount
10.5.15 Property MySQLCursor.statement
10.5.16 Property MySQLCursor.with_rows

The MySQLCursor class instantiates objects that can execute operations such as SQL statements. Cursor objects interact with the MySQL server using a MySQLConnection object.

To create a cursor, use the cursor() method of a connection object:

import mysql.connector

cnx = mysql.connector.connect(database='world')
cursor = cnx.cursor()

Several related classes inherit from MySQLCursor. To create a cursor of one of these types, pass the appropriate arguments to cursor():