Chapter 10 Connector/Python API Reference

Table of Contents

10.1 Module mysql.connector
10.1.1 Method mysql.connector.connect()
10.1.2 Property mysql.connector.apilevel
10.1.3 Property mysql.connector.paramstyle
10.1.4 Property mysql.connector.threadsafety
10.1.5 Property mysql.connector.__version__
10.1.6 Property mysql.connector.__version_info__
10.2 Class connection.MySQLConnection
10.2.1 Constructor connection.MySQLConnection(**kwargs)
10.2.2 Method MySQLConnection.close()
10.2.3 Method MySQLConnection.commit()
10.2.4 Method MySQLConnection.config(**kwargs)
10.2.5 Method MySQLConnection.connect()
10.2.6 Method MySQLConnection.cursor()
10.2.7 Method MySQLConnection.cmd_change_user(username='', password='', database='', charset=33)
10.2.8 Method MySQLConnection.cmd_debug()
10.2.9 Method MySQLConnection.cmd_init_db(database)
10.2.10 Method MySQLConnection.cmd_ping()
10.2.11 Method MySQLConnection.cmd_process_info()
10.2.12 Method MySQLConnection.cmd_process_kill(mysql_pid)
10.2.13 Method MySQLConnection.cmd_query(statement)
10.2.14 Method MySQLConnection.cmd_query_iter(statement)
10.2.15 Method MySQLConnection.cmd_quit()
10.2.16 Method MySQLConnection.cmd_refresh(options)
10.2.17 Method MySQLConnection.cmd_reset_connection()
10.2.18 Method MySQLConnection.cmd_shutdown()
10.2.19 Method MySQLConnection.cmd_statistics()
10.2.20 Method MySQLConnection.disconnect()
10.2.21 Method MySQLConnection.get_row()
10.2.22 Method MySQLConnection.get_rows(count=None)
10.2.23 Method MySQLConnection.get_server_info()
10.2.24 Method MySQLConnection.get_server_version()
10.2.25 Method MySQLConnection.is_connected()
10.2.26 Method MySQLConnection.isset_client_flag(flag)
10.2.27 Method MySQLConnection.ping(attempts=1, delay=0)
10.2.28 Method MySQLConnection.reconnect(attempts=1, delay=0)
10.2.29 Method MySQLConnection.reset_session()
10.2.30 Method MySQLConnection.rollback()
10.2.31 Method MySQLConnection.set_charset_collation(charset=None, collation=None)
10.2.32 Method MySQLConnection.set_client_flags(flags)
10.2.33 Method MySQLConnection.shutdown()
10.2.34 Method MySQLConnection.start_transaction()
10.2.35 Property MySQLConnection.autocommit
10.2.36 Property MySQLConnection.charset_name
10.2.37 Property MySQLConnection.collation_name
10.2.38 Property MySQLConnection.connection_id
10.2.39 Property MySQLConnection.database
10.2.40 Property MySQLConnection.get_warnings
10.2.41 Property MySQLConnection.in_transaction
10.2.42 Property MySQLConnection.raise_on_warnings
10.2.43 Property MySQLConnection.server_host
10.2.44 Property MySQLConnection.server_port
10.2.45 Property MySQLConnection.sql_mode
10.2.46 Property MySQLConnection.time_zone
10.2.47 Property MySQLConnection.unix_socket
10.2.48 Property MySQLConnection.user
10.3 Class pooling.MySQLConnectionPool
10.3.1 Constructor pooling.MySQLConnectionPool
10.3.2 Method MySQLConnectionPool.add_connection()
10.3.3 Method MySQLConnectionPool.get_connection()
10.3.4 Method MySQLConnectionPool.set_config()
10.3.5 Property MySQLConnectionPool.pool_name
10.4 Class pooling.PooledMySQLConnection
10.4.1 Constructor pooling.PooledMySQLConnection
10.4.2 Method PooledMySQLConnection.close()
10.4.3 Method PooledMySQLConnection.config()
10.4.4 Property PooledMySQLConnection.pool_name
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
10.6 cursor.MySQLCursor Subclasses
10.6.1 Class cursor.MySQLCursorBuffered
10.6.2 Class cursor.MySQLCursorRaw
10.6.3 Class cursor.MySQLCursorBufferedRaw
10.6.4 Class cursor.MySQLCursorDict
10.6.5 Class cursor.MySQLCursorBufferedDict
10.6.6 Class cursor.MySQLCursorNamedTuple
10.6.7 Class cursor.MySQLCursorBufferedNamedTuple
10.6.8 Class cursor.MySQLCursorPrepared
10.7 Class constants.ClientFlag
10.8 Class constants.FieldType
10.9 Class constants.SQLMode
10.10 Class constants.CharacterSet
10.11 Class constants.RefreshOption
10.12 Errors and Exceptions
10.12.1 Module errorcode
10.12.2 Exception errors.Error
10.12.3 Exception errors.DataError
10.12.4 Exception errors.DatabaseError
10.12.5 Exception errors.IntegrityError
10.12.6 Exception errors.InterfaceError
10.12.7 Exception errors.InternalError
10.12.8 Exception errors.NotSupportedError
10.12.9 Exception errors.OperationalError
10.12.10 Exception errors.PoolError
10.12.11 Exception errors.ProgrammingError
10.12.12 Exception errors.Warning
10.12.13 Function errors.custom_error_exception(error=None, exception=None)

This chapter contains the public API reference for Connector/Python. Examples should be considered working for Python 2.7, and Python 3.1 and greater. They might also work for older versions (such as Python 2.4) unless they use features introduced in newer Python versions. For example, exception handling using the as keyword was introduced in Python 2.6 and will not work in Python 2.4.

The following overview shows the mysql.connector package with its modules. Currently, only the most useful modules, classes, and methods for end users are documented.

mysql.connector
  errorcode
  errors
  connection
  constants
  conversion
  cursor
  dbapi
  locales
    eng
      client_error
  protocol
  utils