Spec-Zone .ru
спецификации, руководства, описания, API
|
The mysql.connector
module provides top-level methods and properties.
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')
This property indicates the Connector/Python default parameter style.
>>> mysql.connector.paramstyle'pyformat'
This property indicates the Connector/Python thread safety value.
>>> mysql.connector.threadsafety1
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'