Spec-Zone .ru
спецификации, руководства, описания, API

22.6.7.2. Module mysql.connector

The mysql.connector module provides top-level methods and properties.

22.6.7.2.1. Method mysql.connector.connect()

This method sets up a connection, establishing a session with the MySQL server. If no arguments are given, it uses the already configured or default values. For a complete list of possible arguments, see Section 22.6.6, "Connector/Python Connection Arguments".

A connection with the MySQL server can be established using either the mysql.connector.connect() method or the mysql.connector.MySQLConnection() class:

cnx = mysql.connector.connect(user='joe', database='test')cnx = MySQLConnection(user='joe', database='test')

22.6.7.2.2. Property mysql.connector.paramstyle

This property indicates the Connector/Python default parameter style.

>>> mysql.connector.paramstyle'pyformat'

22.6.7.2.3. Property mysql.connector.threadsafety

This property indicates the Connector/Python thread safety value.

>>> mysql.connector.threadsafety1

22.6.7.2.4. Property mysql.connector.__version__

This property indicates the Connector/Python version as a string. It is available as of Connector/Python 1.1.0.

>>> mysql.connector.__version__'1.1.0'

22.6.7.2.5. Property mysql.connector.__version_info__

This property indicates the Connector/Python version as an array of version components. It is available as of Connector/Python 1.1.0.

>>> mysql.connector.__version_info__(1, 1, 0, 'a', 0)