Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.7Mb
PDF (A4) - 0.7Mb


10.6.2 cursor.MySQLCursorRaw Class

TheMySQLCursorRaw class inherits fromMySQLCursor.

AMySQLCursorRaw cursor skips the conversion from MySQL data types to Python types when fetching rows. A raw cursor is usually used to get better performance or when you want to do the conversion yourself.

To create a raw cursor, use theraw argument when calling a connection'scursor() method. Alternatively, to make all cursors created from the connection raw by default, use therawconnection argument.

Example:

import mysql.connectorcnx = mysql.connector.connect()# Only this particular cursor will be rawcursor = cnx.cursor(raw=True)# All cursors created from cnx2 will be raw by defaultcnx2 = mysql.connector.connect(raw=True)