MySQL Connector/Python 发布说明
MySQLCursorRaw 类继承自 MySQLCursor.
MySQLCursorRaw 游标在获取行时跳过从 MySQL 数据类型到 Python 数据类型的转换。原始游标通常用于获得更好的性能,或者当您想要自己进行转换时。
要创建原始游标,请在调用连接的 cursor() 方法时使用 raw 参数。或者,要使从连接创建的所有游标默认情况下为原始游标,请使用 raw 连接参数.
示例
import mysql.connector
cnx = mysql.connector.connect()
# Only this particular cursor will be raw
cursor = cnx.cursor(raw=True)
# All cursors created from cnx2 will be raw by default
cnx2 = mysql.connector.connect(raw=True)