9.5 Class cursor.MySQLCursor

9.5.1 Constructor cursor.MySQLCursor
9.5.2 Method MySQLCursor.callproc()
9.5.3 Method MySQLCursor.close()
9.5.4 Method MySQLCursor.execute()
9.5.5 Method MySQLCursor.executemany()
9.5.6 Method MySQLCursor.fetchall()
9.5.7 Method MySQLCursor.fetchmany()
9.5.8 Method MySQLCursor.fetchone()
9.5.9 Method MySQLCursor.fetchwarnings()
9.5.10 Method MySQLCursor.stored_results()
9.5.11 Property MySQLCursor.column_names
9.5.12 Property MySQLCursor.description
9.5.13 Property MySQLCursor.lastrowid
9.5.14 Property MySQLCursor.statement
9.5.15 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():