-
MySQL Connector/Python distributions now are available that include a C Extension that interfaces with the MySQL C client library. For queries that return large result sets, using the C Extension can improve performance compared to a “pure Python” implementation of the MySQL client/server protocol.
For binary Connector/Python distributions, some packaging types have a single distribution file that includes the pure-Python Connector/Python code together with the C Extension. (Windows MSI and OS X Disk Image packages fall into this category.) Other packaging types have two related distribution files: One that includes the pure-Python Connector/Python code, and one that includes only the C Extension. For packaging types that have separate distribution files, install both distributions if you want to use the C Extension. The two files have related names, the difference being that the one that contains the C Extension has “cext” in the distribution file name.
Source distributions include both the pure-Python code and the C Extension, and distribution names do not contain “cext”. Instead, availability of the C Extension is determined by whether you compile the distribution with the
--with-mysql-capi
option.Packages for Connector/Python with the C Extension are available at the Connector/Python download site. For installation instructions, see Connector/Python Installation. For information about using the C Extension, see The Connector/Python C Extension.
For Connector/Python installations that support the C Extension, the
use_pure
connection argument toconnect()
controls whether to use the extension. Ifuse_pure
isTrue
(the default), the connection uses pure Python. Ifuse_pure
isFalse
, the connection uses the C Extension.It is also possible to use the C Extension directly, by importing the
_mysql_connector
module rather than themysql.connector
module. See The _mysql_connector C Extension Module. (WL #7643)
A new
connect()
option,consume_results
, if enabled, causes result sets generated by queries to be automatically consumed and discarded. Thecan_consume_results
connection object property indicates the value ofconsume_results
.
With
mysql.connector.django
as the engine, the python manage.py inspectdb command failed with an “Unread result found” error. (Bug #20022533)If the
pool_size
andpool_name
connection arguments were specified using the option file (as opposed to being passed explicitly to the connect call), the pooled connection was successfully created, but an exception was raised when closing it. (Bug #19549363)The Django back end raised an exception when converting
"0000-00-00 00:00:00"
toNone
. (Bug #73940, Bug #19667984)The
type_code
incursor.description
did not compare equal to any of the type objects defined inmysql.connector.dbapi
. (Bug #73798, Bug #19584051)Data corruption occurred when inserting sufficiently large data in a table with a
TEXT
type column using prepared statements, due to incorrect encoding of the data length while sending the prepared statement packet. (Bug #73690, Bug #19522948)When the character set was
binary
, character set conversion could occur. Conversion is no longer done andbinary
data is returned as is. (Bug #71909, Bug #19500097)