Removed
distutils
support, which is deprecated in Python 3.10 and removed in Python 3.12. (WL #14861)Adopted type hint enforcement for function and class attributes with
mypy
; this is compliant with PEP 8 for module mysql.connector. The integration includes a git pre-commit hook for mypy. (WL #15036)-
On Windows, added a
kerberos_auth_mode
connection option which is set to either "SSPI" (default) or "GSSAPI". This allows choosing between SSPI and GSSAPI at runtime for theauthentication_kerberos_client
authentication plugin on Windows. Previously, only the SSPI mode was supported on Windows. For general usage information, see Kerberos Pluggable Authentication. This option is ignored on other platforms such as Linux which support GSSAPI only.Limitation: GSSAPI cannot be used with the pure Python implementation on Windows using authentication with a username and password; this is a limitation of the C library used in the
python-gssapi
package used by the pure Python implementation of Connector/Python. (WL #15348)
Microsoft Windows: The Connector/Python MSI did not detect and install with Python 3.11. A workaround is to use
pip install mysql-connector-python
instead. (Bug #108911, Bug #34773422)Using
USE_TZ=True
in the Django settings would raise this exception: ValueError: Not naive datetime (tzinfo is already set). (Bug #34727432)Removed debug messages that showed authentication data. (Bug #34695103)
protobuf
must now be version 3.11.0 through 3.20.3, inclusive. (Bug #34690501)Connecting to MariaDB failed with an unsupported character set because the default MySQL character set collation was specific to MySQL 8.0. Now the MySQL 5.7 character set is used by default instead, but is switched to a 8.0 character set if the queried server uses version 8.0. (Bug #34675508)
Incorrect
MySQLCursor.statement
values were returned withcursor.execute(query_string, multi=True)
under the following conditions: The query string contained two or more queries separated by a semicolon, and a query other than the first one used a literal or identifier containing an odd number of backticks, single quotation marks, or double quotation marks. (Bug #34655520)On Windows, changed the security support provider (SSP) from Kerberos to Negotiate. Negotiate selects either Kerberos or NTLM as the SSP. (Bug #34556157)
-
When using a prepared cursor, a DATETIME column containing 00:00:00 as the time value caused a Python date object was returned instead of a datetime.
Thanks to Rong Zhao for the contribution. (Bug #108733, Bug #34689812)
-
The
MySQLCursor.executemany()
method failed to batch insert data because the regular expression (RE) sentinel did not detect batch cases correctly; this meant using a one-on-one insert instead, which led to poor performance.Thanks to Alex Cazacu for the contribution. (Bug #108145, Bug #34499578)
-
Added a new
init_command
connection option to specify a query which is executed immediately after the connection is established.Thanks to Sander van de Graaf for the contribution. (Bug #108076, Bug #34467201)
Russian characters were not handled correctly by the C extension version of the X DevAPI driver. We fix this by encoding string values to their byte string representations before sending them to
protobuf
. (Bug #106585, Bug #33904362)-
Fetching results from a prepared cursor using the pure Python implementation failed when a
VARBINARY
column contained bytes that could not be decoded. Such bytes are now returned directly if they cannot be decoded.Thanks to Naoki Someya for the contribution. (Bug #96280, Bug #30089671)
-
Removed multiple reference leaks and removed redundant code.
Thanks to Vilnis Termanis for the contribution. (Bug #90862, Bug #28020811)
-
Cursors (both the pure Python and C extension versions) use a single
SELECT
to retrieve procedure result parameters following a procedure call, but oneSET
was used per parameter when setting the input parameters. This is now optimized by always using a single SET call, even for multiple parameters.Thanks to Vilnis Termanis for the contribution. (Bug #89345, Bug #27426532)
-
Improved warning handling throughout the Connector.
Thanks to Vilnis Termanis for the contribution. (Bug #82366, Bug #24364556)
-
Added a
MySQLCursorPreparedDict
class option that is similar toMySQLCursorPrepared
except that the former returns a fetched row as a dictionary in which column names are used as keys while the latter returns a row as a traditional record (a tuple).Thanks to Luke Weber for the contribution. (Bug #81573, Bug #23339387)
-
It is now possible to use dictionaries as parameters in prepared statements using the
%(param)s
format as placeholders.Thanks to Luke Weber for the contribution. (Bug #81572, Bug #23342572)
Using
MySQLConverter.escape()
on datetime objects raised the error TypeError: an integer is required. Now this method no longer attempts to escape values which are not bytes or string types. (Bug #80679, Bug #22906307)-
Not all parameters were added to the
INSERT
statement when usingINSERT IGNORE
withcursor.executemany()
.Thanks to Takashi Ichii for the contribution. (Bug #75824, Bug #20504804)