10.5 cursor.MySQLCursor Class

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

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():