MySQL Connector/Python Release Notes
Syntax:
cnx.set_charset_collation(charset=None, collation=None)
This method sets the character set and collation to be used for
the current connection. The charset argument
can be either the name of a character set, or the numerical
equivalent as defined in
constants.CharacterSet.
When collation is None,
the default collation for the character set is used.
In the following example, we set the character set to
latin1 and the collation to
latin1_swedish_ci (the default collation for:
latin1):
>>> cnx = mysql.connector.connect(user='scott')
>>> cnx.set_charset_collation('latin1')
Specify a given collation as follows:
>>> cnx = mysql.connector.connect(user='scott')
>>> cnx.set_charset_collation('latin1', 'latin1_general_ci')