MySQL Connector/Python Changelog

What's new in MySQL Connector/Python 8.0.32

Jan 26, 2023
  • Functionality Added or Changed:
  • Removed distutils support, which is deprecated as of Python 3.10 and removed in Python 3.12.
  • 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.
  • On Windows, added a kerberos_auth_mode connection option that's set to either "SSPI" (default) or "GSSAPI". This allows choosing between SSPI and GSSAPI at runtime for the authentication_kerberos_client authentication plugin on Windows. Previously, only the SSPI mode was supported on Windows. For general usage information, see Kerberos Pluggable Authentication. This connection is ignored on other platforms, such as Linux, as they only support GSSAPI.
  • Limitation: GSSAPI can't be used with the pure Python implementation on Windows using authentication with a username and password, a limitation with the C library used by the python-gssapi package used by the pure Python implementation of Connector/Python.
  • Bugs Fixed:
  • Using USE_TZ=True in the Django settings would raise this exception: ValueError: Not naive datetime (tzinfo is already set).
  • Removed debug messages that showed authentication data. (Bug #34695103)
  • Updated the protobuf version requirement to version >= 3.11.0, <=3.20.3.
  • Connecting to MariaDB could fail with an unsupported character set because the default MySQL character collection is MySQL 8.0 specific. Now the 5.7 character set is used by default, but is switched to a 8.0 character set if the queried server is version 8.0.
  • Incorrect MySQLCursor.statement values were returned with cursor.execute(query_string, multi=True) under the following conditions: The query string contained two or more queries seperated by a semicolon, and the non-first query used a literal or identifier containing either an odd number of backticks, quotes, or double quotes.
  • On Windows, changed the security support provider (SSP) from Kerberos to Negotiate. Using Negotiate will then select either Kerberos or NTLM as the SSP.
  • On Windows, the Connector/Python MSI did would not detect and install with Python 3.11. The workaround is to use pip install mysql-connector-python instead.
  • When using a prepared cursor, if a datetime column contained 00:00:00 as the time, a Python date object was returned instead of datetime.
  • The MySQLCursor.executemany() method failed to batch insert data since the regular expression (RE) sentinel did not detect batch cases correctly; this meant using the one-on-one insert instead, which led to decreased performance.
  • Added a new init_command connection option; an SQL query that's immediately executed after the connection is established.
  • Russian characters were not handled correctly by the c-ext version's X DevAPI driver. String values are now encoded to their byte string representation before being sent to protobuf.
  • When fetching results from a prepared cursor using the pure Python implementation, it would fail if the VARBINARY column contained bytes that could not be decoded. The bytes are now returned if they cannot be decoded.
  • Fixed multiple reference leaks and removed redundant code.
  • The cursors (both pure and c-ext versions) uses a single SELECT query to retrieve procedure result parameters after a procedure call; but one SET call was used per parameter when setting the input parameters. This was optimized to always use a single SET call for one or multiple parameters.
  • Improved warning handling throughout the connector.
  • Added a new MySQLCursorPreparedDict class option that is similar to MySQLCursorPrepared; the difference is that the former returns a fetched row as a dictionary where column names are used as keys while the latter returns a row as a traditional record (tuple).
  • Enable the use of dictionaries as parameters in prepared statements using the '(param)s' format as placeholders.
  • Using MySQLConverter.escape() on datetime objects raised this error: TypeError: an integer is required. Now it does not attempt to escape values that are not bytes or string types.
  • Not all parameters were added to the INSERT statement when using INSERT IGNORE with cursor.executemany().

New in MySQL Connector/Python 8.0.30 (Jul 26, 2022)

  • Functionality Added or Changed:
  • Added OpenSSL 3.0 support.
  • Added or renamed collations as per MySQL Server 8.0.30. This includes adding support for the new language-specific utf8mb4 collations and renaming all existing utf8_* collations to utf8mb3_*. This also makes utf8 an alias to utf8mb4. Support for MySQL 5.7 collations were preserved for connections to a MySQL 5.7 server.
  • Implemented an authentication mechanism to only instantiate required authentication plugins as per the authentication handshake performed with MySQL Server. Previously, all available authentication plugins (and their associated third-party modules) were loaded upon initialization.
  • Improved PEP 7 and PEP 8 style guideline enforcement by adding Black and Isort tooling for PEP 8, and clang-format for PEP 7. The integration includes git pre-commit hooks.
  • In addition, Pylint was also tested and integrated with a git pre-commit hook.
  • Removed support for the "bdist_deb", "bdist_macos", and "bdist_rpm" build targets from setup.py. Instead, use packages built by the Release Engineering team.
  • Bugs Fixed:
  • No longer allow empty strings ("") in the collection fields used in methods like set() that are chained with modify(). Now only the dollar sign ("$") is allowed when trying to replace the entire document. (Bug #34260344)
  • Updated the protobuf version requirement to version >= 3.11.0, <=3.20.1 due to a breaking change introduced in Python protobuf 4.21.0. (Bug #34231226)
  • Now check for supported cursor classes and raise a ProgrammingError if it's not compatible cursor type; as c-ext and pure Python cursor types are not interchangeable when using connection objects that aren't of the same type. (Bug #34223015)
  • The C Extension implementation did not function with the NO_BACKSLASH_ESCAPES SQL mode enabled. The fix is to internally call the mysql_real_escape_string_quote() C API function instead of mysql_real_escape_string_quote(). The workaround was to use the pure Python implementation (use_pure=True). (Bug #107434, Bug #34228442)
  • For Django, allow setting the connection isolation level with an 'isolation_level' OPTIONS entry in Django's DATABASES configuration. (Bug #107174, Bug #34127959)
  • The connect()'s failover argument now accepts a tuple, as was documented, when previously it only accepted a list of dictionaries.
  • Thanks to Ville Skyttä for the patch. (Bug #106632, Bug #33923516)
  • For Django, added the missing DatabaseIntrospection _parse_constraint_columns() method. (Bug #105993, Bug #33827760)
  • Fixed potential rounding errors when using arithmetic expressions with decimal data types; decimal values are no longer quoted. (Bug #92790, Bug #28821983)
  • Disabled SSL usage with Unix socket connections. (Bug #91552, Bug #92260, Bug #28295504, Bug #28880051)

New in MySQL Connector/Python 8.0.28 (Apr 26, 2022)

  • Functionality Added or Changed:
  • The TLSv1 and TLSv1.1 connection protocols were previously deprecated in Connector/Python 8.0.26 and support for them is removed starting with this release. Instead, use TLSv1.2 or TLSv1.3.
  • Note: the tls_versions connection option now defaults to '["TLSv1.2", "TLSv1.3"]' when before it was '"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"'.
  • Connector/Python can now establish connections using Multi-Factor Authentication (MFA), such that up to three passwords can be specified. The new password1, password2, and password3 connection options are available for specifying the first, second, and third MFA passwords, respectively. The password1 option is a synonym for the existing password option.
  • Added Python 3.10 support.
  • Bugs Fixed:
  • A MySQL decimal field type was returned as a string instead of a decimal type. (Bug #33486094)
  • Fixed compiler warnings that were shown when building Connector/Python. (Bug #33410592)
  • Fixed the JSON conversion class in CMySQLConnection; and fixed the related exception raised when using a conversion class in a C extension connection object. (Bug #33409819, Bug #105012)
  • Sent invalid 'params' argument definitions in execution methods to the server instead of raising an error; and this generated an error unrelated to the invalid parameter definition. (Bug #27358941)

New in MySQL Connector/Python 8.0.27 (Oct 19, 2021)

  • Functionality Added or Changed:
  • In Connector/Python 8.0.26, the capability was introduced for applications that use the classic MySQL connections for accounts that use the authentication_kerberos server-side authentication plugin, provided that the correct Kerberos tickets are available or can be obtained from Kerberos. That capability was available on client hosts running Linux only. It is now available on client hosts running Windows.
  • Added wheel packages for the commercial edition.
  • Improved the DMG package as previously it assumed that XCode was installed to provide the Python installation. Additionally, there are now two separate DMG files; one for x86-64 and another for ARM. These installers now provides an option to choose which Python version to use, and defaults to the version provided by XCode.
  • Added a new converter_str_fallback connection option that allows enabling the conversion to str of value types not supported by the Connector/Python converter class, or by a custom converter class. It defaults to False.
  • Known limitation: Python 3.10 is not yet supported, and therefore operating systems including Python 3.10 (such as Fedora 35) do not support this or earlier versions of Connector/Python.
  • Bugs Fixed:
  • Using the C-extension, attempting to connect with chained SSL certificates using ssl_verify_identity=True did not function. The workaround was to use the pure Python implementation. (Bug #33177337)
  • Printing an mysqlx.result.row object output the generic representation of a class in Python rather than the string value. (Bug #28641350)

New in MySQL Connector/Python 8.0.25 (Jul 20, 2021)

  • This release contains no functional changes and is published to align the version number with the MySQL Server 8.0.25 release.

New in MySQL Connector/Python 8.0.24 (Apr 20, 2021)

  • Functionality Added or Changed:
  • Removed Python 2.7 and 3.5 support, and added Python 3.9 support. (Bug #32144255, Bug #32192619, Bug #32001787)
  • Improved server disconnection handling of X Protocol connections now creates a log entry and returns an error message, as needed, after Connector/Python receives a connection-close notice from the server. Connector/Python detects three new types of warning notices.
  • Connection idle notice. This notice applies to a server connection that remains idle for longer than the relevant timeout setting. Connector/Python closes the connection when it receives the notice in an active session or while a new session is being created. An attempt to use the invalid session returns the “Connection closed. Reason: connection idle too long” error message.
  • Server shutdown notice. If a connection-close notice is received in a session as a result of a server shutdown, Connector/Python terminates the session with the "Connection closed. Reason: server shutdown" error message. All other sessions that are connected to the same endpoint are removed from the pool, if connection pooling is used.
  • Connection killed notice. If the connection being killed from another client session, Connector/Python closes the connection when it receives the notice in an active session or while a new session is being created. An attempt to use the invalid session returns the “Connection closed. Reason: connection killed by a different session” error message.
  • If a classic MySQL protocol connection experiences a server timeout, Connector/Python now reports more precise disconnection information from the server.
  • Bugs Fixed:
  • For the C-extension, executing prepared statements emitted errors when placeholders were defined without associated parameters. Now they are not executed. (Bug #32497631)
  • For prepared statements any type or argument was accepted, which could produce undesired results. Now the use of list or type objects for the argument is enforced, and passing in other types raise an error. (Bug #32496788)
  • Added Django 3.2 support while preserving compatibility with Django 2.2, 3.0, and 3.1. (Bug #32435181)
  • Added context manager support for pooled connections; a feature added to standard connections in 8.0.21. (Bug #32029891)
  • Replaced the deprecated PyUnicode_GetSize with PyUnicode_GET_LENGTH to fix the casting of Python's unicode to std::string. (Bug #31490101, Bug #99866)
  • Binary columns were returned as strings instead of 'bytes' or 'bytearray'. (Bug #30416704, Bug #97177)

New in MySQL Connector/Python 8.0.22 (Jan 18, 2021)

  • Functionality Added or Changed:
  • Added Django 3.0 support while preserving compatibility with Django 2.2. Removed support for Django 1.11 with Python 2.7.
  • Previously, the client-side mysql_clear_password authentication plugin was not supported. Now, it is permitted to send passwords without hashing or encryption by using mysql_clear_password on the client side together with any server-side plugin that needs a clear text password, such as for LDAP pluggable authentication. Connector/Python returns an exception if the mysql_clear_password plugin is requested but the connection is neither encrypted nor using Unix domain sockets. For usage information, see Client-Side Cleartext Pluggable Authentication.
  • Connections made using the MySQL Enterprise Edition SASL LDAP authentication plugin now are supported on Windows and Linux, but not on macOS. Connector/Python implements the SCRAM-SHA-1 authentication method of the SASL authentication protocol.
  • The new compression-algorithms connection option sets the order by which supported algorithms are negotiated and selected to send compressed data over X Protocol connections. The algorithms available are specified by the server and currently include: lz4_message, deflate_stream, and zstd_stream. Supported algorithm aliases are lz4, deflate, and zstd. Unknown or unsupported values are ignored.
  • For enhanced security of the existing allow_local_infile connection string option, the new allow_local_infile_in_path option allows restricting LOCAL data loading to files located in this designated directory.
  • Refactored the Connector/Python build system by removing artifacts of old implementations, improved debugging, and now statically link the C extensions. This also exposes the distutils commands, to allow the end-user build packages.
  • The pure Python and C extension implementations were combined into a single package; this applies to both DEB and RPM packages.
  • Bugs Fixed:
  • Fixed a memory leak in the C-extension implementation when using the Decimal data type. Thanks to Kan Liyong for the patch. (Bug #31335275, Bug #99517)
  • Copyright and License headers were missing in the Python modules generated by protoc. (Bug #31267800)
  • When creating an index on a collection, if a collation was specified but the field is not of the type TEXT, then an error message was generated with a wrong field type. It'd always report it as GEOJSON. (Bug #27535063)
  • The reset connection command was missing from the C-extension implementation, which is required to reuse a connection from the pool. As such, connection pooling is now allowed with the C-extension implementation. (Bug #20811567, Bug #27489937)

New in MySQL Connector/Python 8.0.20 (Jul 13, 2020)

  • Functionality Added or Changed:
  • For X DevAPI applications, when creating a new connection, if the connection data contains several target hosts that have no explicit priority assigned, the behavior of the failover logic now is the same as if all those target hosts have the same priority. That is, the next candidate for making a connection is chosen randomly from the remaining available hosts. Alternatively, the new priority attribute optionally sets the priority for each host. If two hosts have the same priority then one is chosen at random
  • Bugs Fixed:
  • The fetchmany() method failed to function properly when the last fetch was not a full batch; and would hang. Thanks to Bruce Feng for the patch. (Bug #30608703, Bug #97830)
  • The minimum Protobuf prerequisite version changed from 3.6.1 to 3.0.0
  • To make RPM and DEB package installation seamless, implicit dependencies on Python protobuf 3.0.0 or higher was added to the packages for most platforms. But as there are no Python protobuf versions fulfilling that requirement on EL7, SLES 12, nor Ubuntu 16.04, their pure Python packages depend on the C extension package to provide the same functionality
  • These dependencies are handled automatically by tools like YUM and APT. Users installing using "rpm" or "dpkg" needs to install both the pure Python and C extension packages

New in MySQL Connector/Python 8.0.19 (Jul 13, 2020)

  • Functionality Added or Changed:
  • Added DNS SRV support
  • To automatically resolve any SRV record available in a target DNS server or service discovery endpoint, use the mysqlx+srv scheme+extension in a X DevAPI connection string, or mysqlx+srv for the classic protocol, or by enabling the dns-srv=True (or dns_srv=True) connection option when using keyword arguments or dictionaries
  • Added two new connection options that evaluate during the TLS handshake to restrict the negotiated TLS protocols and ciphers; along with those configured on the server that can further restrict the final choices. The new options are tls-versions to define the allowed TLS protocol versions, and tls-ciphersuites for the allowed cipher suites. These definitions are comma-separated, and accepted by the getSession() and getClient() methods
  • tls-versions: accepts one or more of the following: TLSv1, TLSv1.1, TLSv1.2, and TLSv1.3. Other values generate an error. Example usage: mysqlx://myserver/db?tls-versions=[TLSv1.2,TLSv1.3]
  • tls-ciphersuites: accepts IANA cipher suite names, as listed on IANA's TLS Cipher Suites page. Unsupported or unknown values are ignored. Example usage: mysqlx://myserver/db?tls-ciphersuites=[TLS_DHE_PSK_WITH_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256]
  • The internal X Protocol namespace changed from xplugin to mysqlx. MySQL Server removed xplugin namespace support in v8.0.19; for Connector/Python this means
  • With Connector/Python v8.0.19 and higher, some X DevAPI Protocol operations do not function with MySQL Server 8.0.18 and lower, operations such as Schema.create_collection(), Schema.get_collections(), Schema.get_tables(), and Collection.create_index()
  • Connector/Python 8.0.19 can connect to MySQL Server 8.0.18 and lower, as both both the 'xplugin' (with deprecation warnings) and 'mysqlx' namespaces can be used
  • Bugs Fixed:
  • Fixed the reserved SSL authentication filed; it changed from 23 to 22. Thanks to Qianqian Bu for the patch. (Bug #30270760, Bug #96770)
  • References: This issue is a regression of: Bug #29855733
  • Fixed LOAD DATA INFILE LOCAL handling; the file handle was not closed. Thanks to Micah Gale for the patch. (Bug #29417117, Bug #94496)

New in MySQL Connector/Python 8.0.18 (Jul 13, 2020)

  • Functionality Added or Changed:
  • Added Python 3.8 support
  • Connector/Python connections now set CAN_HANDLE_EXPIRED_PASSWORDS to indicate it can handle sandbox mode for expired passwords. This indicates that Connector/Python does not execute SET commands by a connection with an expired password, an operation that's disallowed by MySQL Server 8.0.18 and higher
  • On Windows, added platform dependent MSI installers that install and update Connector/Python for all supported Python versions on the system. Downloading and installing separate packages for each version is no longer required
  • Bugs Fixed:
  • The /usr/lib/mysqlx folder was not created after executing setup.py from commercial packages. (Bug #29959309)
  • A table scan for a float using the C Extension caused a memory leak. (Bug #29909157)
  • Added read_default_file as an alias for option_files to increase MySQLdb compatibility. (Bug #25349794, Bug #84389)
  • Connector/Python 8.0.17 does not properly negotiate the highest TLS protocol version supported by both the client and server. As such, because MySQL 5.6/5.7 platform packages (DEB and RPM) include YaSSL prior to 5.6.45/5.7.27, and YaSSL only supports up to TLS 1.1, systems setting a minimum TLS protocol version above 1.1 (such as Debian 10 that sets MinProtocol=TLSv1.2) do not function with Connector/Python 8.0.17
  • As a workaround, the wheel (pip) packages function properly as they are built using glibc and bundle OpenSSL instead of YaSSL
  • Connector/Python 8.0.18 adds a tls-versions option to define the TLS version to use

New in MySQL Connector/Python 8.0.17 (Jul 22, 2019)

  • Functionality Added or Changed:
  • Prepared statement support was added to the C extension's (use_pure=False) implementation. (Bug #27364973, Bug #21670979, Bug #77780)
  • Added connection attribute support for the classic connector; new connection attributes can be passed in with the "conn_attrs" connection argument. Thanks to Daniël van Eeden for the patch.
  • Document fields containing arrays can now be indexed by setting array to true in an index fields definition.
  • Added support for the OVERLAPS and NOT OVERLAPS operators; which is equivalent to the SQL JSON_OVERLAPS() function.
  • Added support for the utf8mb4_0900_bin collation added in MySQL Server 8.0.17.
  • Added CONTRIBUTING.rst and replaced README.txt with README.rst.
  • Bugs Fixed:
  • Executing a Collection.find() without first fetching results would raise an AttributeError with an unclear message. (Bug #29327931)
  • An error was generated when used with the combination of MySQL 5.7, Python 3, and having the C-extension enabled. (Bug #28568665)

New in MySQL Connector/Python 8.0.11 (Apr 19, 2018)

  • Functionality Added or Changed:
  • X DevAPI: Previously, when documents without an _id attribute were added to a collection, Connector/Python automatically generated _id for them. Now a MySQL 8 server generates the _id attribute unless a document already contains one. The generated IDs resulting from a document-add operation can be obtained using the new get_generated_ids() method.
  • This capability requires a MySQL 8.0 server. Because MySQL 5.7 does not support document ID generation, the document-add operation returns an error if you do not define the _id's.
  • Incompatibility: The get_generated_ids() method replaces the now removed get_document_ids(). (Bug #27627366)
  • Added NOWAIT and SKIP_LOCKED support to the ReadStatement.lock_shared() and ReadStatement.lock_exclusive() methods. Example usage: lock_exclusive(mysqlx.LockContention.SKIP_LOCKED).
  • The C extension (cext) is now enabled by default, as the use_pure option changed from True to False by default.
  • If the C extension is not available on the system then the Python implementation is used instead, and use_pure is set to True.
  • Added the X DevAPI SHA256_MEMORY authentication mechanism.
  • Example mysqlx.get_session() usages: ?auth=SHA256_MEMORY via a connection string, "auth": mysqlx.Auth.SHA256_MEMORY via a dictionary, or auth=mysqlx.Auth.SHA256_MEMORY via method parameters.
  • Bugs Fixed:
  • Warnings are now stored as a list of dictionaries instead of a list of tuples. In other words, get_warnings() returns the likes of [{"level": _level_, "code": _code_, "msg": _msg_}] instead of [(_level_, _code_, _msg_))]. (Bug #27639119)
  • The mapped MySQL Server error codes were synced with MySQL Server 8.0.11. (Bug #27634885)
  • Removed upsert functionality from InsertStatement as it can only be used by collections, so upsert remains available to AddStatement. (Bug #27589450)
  • MySQLConverter.escape() functionality was added to create_schema()'s count mechanism. (Bug #27528842)
  • When using prepared statements, string columns were returned as bytearrays instead of strings. The returned value is now a string decoded using the connection's charset (defaults to 'utf8'), or as a bytearray if this conversion fails. (Bug #27364914)
  • The result from JSON_TYPE() was returned as a bytearray instead of a string. The returned value is now a string decoded using the connection's charset (defaults to 'utf8'), or as a bytearray if this conversion fails. (Bug #24948205, Bug #83516)
  • JSON integer values were cast to bytes in Python instead of integers. (Bug #24948186, Bug #83513)

New in MySQL Connector/Python 2.1.7 (Aug 18, 2017)

  • Functionality Added or Changed:
  • Connector/Python is now compatible with Django 1.11. Thanks to Brian Tyndall for the patch for some of the work. (Bug #25965922, Bug #86105, Bug #26257499, Bug #86652)
  • Connector/Python now attempts to connect using TLS by default if the server supports secure connections. (Bug #21947091)
  • Bugs Fixed:
  • Prepared statements did not work with a MySQL 8.0 server. (Bug #26376334)
  • With a connection character set of utf8mb4, multiple-row insert operations failed with an error of LookupError: unknown encoding: utf8mb4. (Bug #24659561, Bug #82948)
  • Creating a Connection instance with use_pure=True could lead to the underlying socket not being closed if the user name or password were invalid. Thanks to Vilnis Termanis for the patch. (Bug #24342757, Bug #82324)
  • For cursors created with named_tuple=True, MySQLCursorNamedTuple objects could leak memory. Thanks to Piotr Jurkiewicz for the patch on which this fix was based. (Bug #22880163, Bug #80621)
  • The C Extension leaked memory if used to execute INSERT statements that inserted Unicode strings. (Bug #22825962, Bug #79887)
  • The escape_string() method leaked memory. (Bug #22810810, Bug #79903)
  • With Python 2.x, for a call to encode('utf8') on a bytestring that was serialized from unicode, Python attempted to decode the string using the 'ascii' codec and encode it back using 'utf8'. The result was encoding failure for bytestrings that contain non-ASCII characters. (Bug #22564149, Bug #79993)

New in MySQL Connector/Python 2.1.6 (Apr 18, 2017)

  • Functionality Added or Changed:
  • An ssl-cipher option is now supported for specifying the encryption cipher for secure connections. (Bug #22545879, Bug #78186)
  • Bugs Fixed:
  • Compatibility issues with Django 1.9 were corrected. (Bug #25726671)
  • The fix for Bug #22529828 caused Python 2.7 to be unable to insert binary data. (Bug #25589496, Bug #85100)
  • References: This issue is a regression of: Bug #22529828.
  • Some SQL statements that worked using pure Python failed with the Connector/Python C Extension enabled. (Bug #25558885)
  • Connector/Python produced no error or warning if the server certificate was expired. (Bug #25397650)
  • If an exception reset the underlying session, connections in a connection pooled could become unavailable to the pool. (Bug #25383644, Bug #84476)
  • Methods for filtering time and datetime fields were changed in Django 1.9 from value_to_db_datetime to adapt_datetimefield_value and from value_to_db_time to adapt_timefield_value. Proxy methods with the previous names were added to Connector/Python ensure compatibility. Thanks to Brian Tyndall for the patch. (Bug #25349918, Bug #84410)
  • Extra encapsulation was removed from the get_constraints method for the foreign_key parameter. Thanks to Brian Tyndall for the patch. (Bug #25349912, Bug #84409)
  • Connector/Python added support for a database backend API change introduced in Django 1.9 for the bulk_insert_sql method. Thanks to Brian Tyndall for the patch. (Bug #25349897, Bug #84408)
  • Loading the world sample database worked using pure Python but failed with the Connector/Python C Extension enabled. (Bug #22476689, Bug #79780)
  • If the output from the mysql_config --include command included more than one directory, the C Extension failed to compile. (Bug #20736339, Bug #76350)

New in MySQL Connector/Python 2.1.5 (Apr 14, 2017)

  • Bugs Fixed:
  • Incorrect logic for handling EOF packets caused MySQL Utilities replication to fail. (Bug #25111218)
  • Using the C Extension, connection failure occurred when the user name or password contained Unicode characters. (Bug #21656282)
  • For connections established using the use_pure=True parameter, queries that returned more than 4096 columns produced an InterfaceError. (Bug #21530841)
  • Using Python 3.3, connection failure occurred if the option_groups parameter named multiple groups. (Bug #21530100)
  • Using executemany() to execute an INSERT INTO ... SELECT statement produced an InterfaceError. (Bug #21477493)
  • If a call to set_charset_collation() failed, the character set became invalid rather than being unchanged. (Bug #21476495)

New in MySQL Connector/Python 2.1.4 Beta (Oct 21, 2016)

  • Security Notes:
  • The linked OpenSSL library for Connector/Python Commercial has been updated to version 1.0.1q. Issues fixed in the new OpenSSL version are described at http://www.openssl.org/news/vulnerabilities.html.
  • This change does not affect Oracle-produced MySQL Community builds of Connector/Python, which use the yaSSL library instead. The change also does not affect connections made using any pure-Python implementation of Connector/Python, for which the version of OpenSSL used is whatever is installed on the system.
  • Bugs Fixed:
  • Connector/Python failed to establish connections using the cleartext client-side authentication plugin for accounts using the PAM server-side authentication plugin. Thanks to Daniël van Eeden for the patch. (Bug #22873551, Bug #80609)
  • A potential SQL injection vector was eliminated. (Bug #22529828)
  • Connections made using the C Extension failed when the ssl_ca parameter was given without ssl_cert and ssl_key. (Bug #21879914, Bug #79835, Bug #22494320)
  • For connections made with consume_results=True, consume_results was reset to False after callproc() execution failure. (Bug #21879859)
  • References: This issue is a regression of: Bug #21492815.
  • In connections for which compress=True, LOAD DATA LOCAL INFILE statements produced “Packets out of error” errors. (Bug #21449996)
  • Attempts to insert Python ByteArray data into binary table columns failed. (Bug #77822, Bug #21498719)

New in MySQL Connector/Python 2.1.3 (Aug 15, 2016)

  • Functionality Added or Changed:
  • Connector/Python is now compatible with Django 1.8. (Bug #76752, Bug #20987205).
  • Bugs Fixed:
  • When using the C Extension with raise_on_warnings=True, errors were not thrown as exceptions when an executed statement produced an error, and it was not possible to reuse the cursor if the statement produced a result set. (Bug #21536507);
  • When using the C Extension, character decoding of identifiers (database, table, column names) in result sets could fail. (Bug #21535573);
  • When using the C Extension with the auth_plugin option, connect() calls failed. (Bug #21529781);
  • In connections for which consume_results=True, callproc() could hang. (Bug #21492815);
  • Connections failed if the password began or ended with spaces because they were being stripped before the connection attempt. (Bug #21492428);
  • Connection failure occurred for accounts authenticated with the sha256_password authentication plugin that had a blank password. (Bug #21420906);
  • RPM packages of Connector/Python were missing some required __init_py__ files. (Bug #77819, Bug #21505096);
  • The Connector/Python C Extension could exit when fetching a result set containing many NULL values. (Bug #77678, Bug #21420633);
  • Connector/Python failed to complete the connection handshake with MySQL Server 5.5.8. (Bug #77040, Bug #21090014);
  • Connector/Python hung until timeout if the query it was running was killed. (Bug #76156, Bug #20653441);
  • Writing to a table with a BinaryField from Django resulted in a UnicodeDecodeError exception. (Bug #75175, Bug #21054559);
  • Stripping NoneType objects from Django resulted in an AttributeError exception. (Bug #74675, Bug #21054556).

New in MySQL Connector/Python 2.1.2 Beta (May 1, 2015)

  • Functionality Added or Changed:
  • Previously, connections from Connector/Python to Fabric were always made using the XML-RPC protocol. It is now possible to connect using the MySQL client/server protocol. To specify the protocol, use the protocol value in the the fabric dictionary argument for the connect() method. Permitted protocol values are xmlrpc (the default) and mysql. With mysql, the default port becomes 32275, although that can be changed with an explicit port value.
  • Bugs Fixed:
  • Connector/Python could raise an AttributeError exception for Fabric connections with MySQL Utiliies 1.5.4 or 1.6.1. (Bug #20834643)
  • For connections that use the C Extension, an error occurred for attempts to create a cursor with buffered=True. (Bug #20811802)
  • The Connector/Python version checker for MySQL did not handle nonnumeric suffixes. During the build process, if the --with-mysql-api option was given, the check failed for installed versions of MySQL such as 5.7.6-m16. (Bug #20365619)
  • The setup.py install command did not retain the value provided by the --install-lib option. (Bug #20217174)
  • Encoding failure could occur for prepared cursors with UTF-8 statement parameters. (Bug #75542, Bug #20407036)
  • Values of the SET data type were not translated correctly if empty. (Bug #75402, Bug #20301989)
  • HASH sharding for Fabric failed. (Bug #75287, Bug #20324089)
  • Queries that produced a large result could result in an IndexError: bytearray index out of range exception. (Bug #74933, Bug #20462427)
  • The Django backend was creating excessive connections (immediately when each DatabaseWrapper object was created rather than waiting until the object actually needed the connection.) (Bug #74696, Bug #19972427)
  • Error messages containing non-ASCII characters caused an exception to be raised. (Bug #74345, Bug #19803702)
  • The Django backend sometimes failed to properly convert SafeText objects, which then appeared in queries. (Bug #74336, Bug #20106629)
  • When using the callproc() cursor method, warnings generated by statements executed within the procedure or generated by the procedure itself were not available to the client. (Bug #74252, Bug #19777815)
  • Connection pooling did not work when using MySQL Fabric. (Bug #73445, Bug #19331658)

New in MySQL Connector/Python 2.0.4 (Apr 22, 2015)

  • Bugs Fixed:
  • The Changes.txt file was missing from .msi and .dmg packages. (Bug #20323087)
  • Encoding failure could occur for prepared cursors with UTF-8 statement parameters. (Bug #75542, Bug #20407036)
  • Values of the SET data type were not translated correctly if empty. (Bug #75402, Bug #20301989)
  • HASH sharding for Fabric failed. (Bug #75287, Bug #20324089)
  • Queries that produced a large result could result in an IndexError: bytearray index out of range exception. (Bug #74933, Bug #20462427)
  • The Django backend sometimes failed to properly convert SafeText objects, which then appeared in queries. (Bug #74336, Bug #20106629)

New in MySQL Connector/Python 2.0.3 (Jan 28, 2015)

  • Bugs Fixed:
  • The Django backend was creating excessive connections (immediately when each DatabaseWrapper object was created rather than waiting until the object actually needed the connection.)
  • Using the Django backend, it was not possible to connect to a connection_created signal.
  • recv_plain() could fail to read a packet header correctly, resulting in a lost connection.
  • Error messages containing non-ASCII characters caused an exception to be raised.
  • When using the callproc() cursor method, warnings generated by statements executed within the procedure or generated by the procedure itself were not available to the client.
  • Connection pooling did not work when using MySQL Fabric.

New in MySQL Connector/Python 2.0.2 (Nov 11, 2014)

  • Bugs Fixed:
  • If the pool_size and pool_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.
  • The Django backend raised an exception when converting "0000-00-00 00:00:00" to None.
  • Using a connection_created signal defined in django.db.backends.signals caused a “maximum recursion depth reached” runtime error.
  • The type_code in cursor.description did not compare equal to any of the type objects defined in mysql.connector.dbapi.
  • 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.
  • When the character set was binary, character set conversion could occur. Conversion is no longer done and binary data is returned as is.

New in MySQL Connector/Python 2.0.1 (Sep 25, 2014)

  • Functionality Added or Changed:
  • Connector/Python is now compatible with Django 1.7.
  • RANGE_STRING is now supported as a sharding type. This is similar to the regular RANGE sharding type, but instead of an integer key, requires a UTF-8 encoded string. For example:
  • cnx.set_property(tables=["employees.employees"],
  • key=u'employee_name', mode=fabric.MODE_READONLY)
  • Only Unicode strings are supported. Any other type given when using a shard defined using RANGE_STRING causes a ValueError to be raised.
  • RANGE_DATETIME is now supported as a sharding type. This is similar to the regular RANGE sharding type, but instead of an integer key, requires a datetime or date object. For example, to get the shard which holds employees hired after the year 2000, you could do the following, with lower bounds set as "group1/1980-01-01, group2/2000-01-01":
  • cnx.set_property(tables=["employees.employees"],
  • key=datetime.date(2000, 1, 1), mode=fabric.MODE_READONLY)
  • If the lower bounds included a time, it would have been like this:
  • cnx.set_property(tables=["employees.employees"],
  • key=datetime.datetime(2000, 1, 1, 12, 0, 0),
  • mode=fabric.MODE_READONLY)
  • Only datetime.datetime and datetime.date values are supported. Any other type given when using a shard defined using RANGE_DATETIME causes a ValueError to be raised.
  • Bugs Fixed:
  • Connector/Python failed to catch an exception when SSL capability was found to be unavailable.
  • Multiple [connector_python] option groups sometimes caused an error.
  • Date and time query formatting was fixed for the Django backend.
  • An error failed to occur if an option file was named multiple times.
  • Some valid Connector/Python connection options were not recognized when specified in the [connector_python] option group.
  • An exception was raised when a cursor tried to convert LINESTRING data as UTF-8 data. Now such values are returned without decoding.
  • With Python 2, Connector/Python could truncate digits of floating-point values.
  • Binding None (NULL) to a parameter marker in a prepared statement did not work.
  • !include and !includedir directives in option files were not handled properly.
  • Connector/Python now supports a shutdown() method that, unlike disconnect(), closes the client connection without attempting to send a QUIT command to the server first. Thus, it will not block if the connection is disrupted for some reason such as network failure.

New in MySQL Connector/Python 1.2.3 (Aug 27, 2014)

  • Functionality Added or Changed:
  • Connector/Python is now compatible with Django 1.7.
  • Bugs Fixed:
  • Connector/Python failed to catch an exception when SSL capability was found to be unavailable.
  • The specification and control files were updated to reflect that Connector/Python 1.2 cannot be used with MySQL Utilities 1.5.1 (which requires Connector/Python 2.0 or greater).
  • Negative timedelta values were incorrectly converted to and from Python. Thanks to Vitali Graf for the patch.
  • Fetching results from a prepared statement that returned many columns could produce an error.
  • Previously, a RuntimeError exception was raised when a Django application was inactive for a while. Now, the Django backend verifies that the database connection is still valid each time a database request is made.
  • Django TimeField values of 00:00:00 were incorrectly converted to NULL because Python considered that value equal to False.
  • An exception was raised when a cursor tried to convert LINESTRING data as UTF-8 data. Now such values are returned without decoding.
  • With Python 2, Connector/Python could truncate digits of floating-point values.

New in MySQL Connector/Python 1.2.2 (May 27, 2014)

  • Bugs Fixed:
  • The Fabric connection configuration permitted username but not user as a parameter name, which is inconsistent with the connection arguments permitted by Connector/Python itself. Now either can be used. (Using both raises a ValueError.) (Bug #18463182)
  • In the MySQLProtocol._auth_response method of the mysql.connector.protocol module, the auth_response variable was changed without being defined first. (Bug #18463182)
  • Commercial Debian Connector/Python packages included a copyright file containing a GPL license. (Bug #18422727)
  • Building an RPM package using python setup.py bdist_rpm did not work. (Bug #72261, Bug #18550039)
  • The community MSI Connector/Python packages contained empty documentation PDF and HTML files. These have been removed and replaced with the README_DOCS.txt file which contains a URL to the online manual. (Bug #72245, Bug #18527132)
  • For Python 3, when parameters were passed as a dictionary to the MySQLCursor methods execute() and executemany(), only first occurrence of each element in the query was replaced by the parameter value. (Bug #71975, Bug #18389196)
  • when MySQLCursor.execute() was passed values of a data type which cannot be converted, the exception raised was not easy to understand. Now a nicer error message is displayed when unconvertible Python types are given. (Bug #71729, Bug #18258807)
  • Connector/Python raised all deprecation warnings as errors when Django was run in debug mode. Now only database warnings are raised as errors in debug mode. (Bug #71806, Bug #18380134)

New in MySQL Connector/Python 1.1.7 (May 13, 2014)

  • Bugs Fixed:
  • Connector/Python produced errors using time functions with Django 1.6 due to not using the autocommit value from Django. Now the value is set to that specified in the Django configuration file.

New in MySQL Connector/Python 1.2.1 RC (Apr 1, 2014)

  • Functionality Added or Changed:
  • It was not possible to initiate an SSL session without explicitly giving a key and certificate. Now it is possible to connect to a MySQL server using only the ssl_ca connection argument pointing to a file of CA certificates. This means the ssl_key and ssl_cert connection arguments are optional. However, when either is given, both must be given or an AttributeError is raised. (Bug #69418, Bug #17054848)
  • Connector/Python now supports authentication plugins found in MySQL 5.6. This includes mysql_clear_password and sha256_password, both of which require an SSL connection. The sha256_password plugin does not work over a non-SSL connection because Connector/Python does not support RSA encryption.
  • The connect() method now supports an auth_plugin parameter that can be used to force use of a particular plugin. For example, if the server is configured to use sha256_password by default and you want to connect to an account that authenticates using mysql_native_password, either connect using SSL or specify auth_plugin='mysql_native_password'. (Bug #68054, Bug #16217765)
  • Connector/Python now permits the type for stored procedure parameters to be specified. To do this, specify a parameter as a two-item tuple consisting of the parameter value and type. For more information, see Method MySQLCursor.callproc(procname, args=()). (Bug #71124, Bug #17965619)
  • A new MySQLConnection class reset_connection() method enables applications to send a COM_RESET_CONNECTION to the server. This method is analogous to the mysql_reset_connection() C API function added in MySQL 5.7.3.
  • A new MySQLConnection class reset_session() method is similar to reset_connection() but falls back to use reauthentication for older servers that do not support COM_RESET_CONNECTION. For more information, see Method MySQLConnection.cmd_reset_connection(), and Method MySQLConnection.reset_session().
  • Connector/Python now can report errors to Fabric that occur while accessing a MySQL instance. The information can be used to update the backing store and trigger a failover operation, provided that the instance is a primary server and Fabric has received a sufficient number of problem reports from different connectors.
  • The fabric dictionary argument to the connect() method now accepts a report_errors value. Its default value is False; pass a value of True to enable error reporting to Fabric.
  • To define which errors to report, use the extra_failure_report() function:
  • from mysql.connector.fabric import extra_failure_report
  • extra_failure_report([error_code_0, error_code_1, ...])
  • Connector/Python now enables applications to specify additional information to be used when connecting to Fabric: User name and credentials, and information to use for establishing an SSL connection. The fabric dictionary argument to the connect() method accepts these additional values: username, password, ssl_ca, ssl_cert, ssl_key. Only the ssl_ca value is required to establish an SSL connection. If ssl_cert or ssl_key are given, both must be specified.
  • The connect() method now accepts a failover argument that provides information to use for server failover in the event of connection failures. The argument value is a tuple or list of dictionaries (tuple is preferred because it is nonmutable). Each dictionary contains connection arguments for a given server in the failover sequence. Permitted dictionary values are: user, password, host, port, unix_socket, database, pool_name, pool_size.
  • Bugs Fixed:
  • The MySQLConnection.autocommit attribute failed to set the value of the self._autocommit attribute. (Bug #18172769)
  • Uninstalling Connector/Python using an RPM package failed to remove the fabric folder. (Bug #18143073)
  • For Fabric connections, any connect_attempts and connect_delay values specified by the user were ignored. (Bug #18055719)
  • The global MYSQL_FABRIC_PORT variable was changed from 8080 to 32274 to match the port change made in Fabric. (Bug #18075339)
  • For Fabric sharding operations, Connector/Python raised an incorrect error when a table was given with the tables connection property for which no sharding information was available. This now results in a DatabaseError (with errorcode.ER_BAD_TABLE_ERROR) mentioning that the table is unknown. (Bug #18047794)
  • For Fabric operations, the default mode was supposed to be read/write but was set to read-only. (Bug #18047591)
  • For Fabric operations, an incorrect exception was raised by set_property() when a connection property value had the wrong type (for example, when the tables property was not a tuple or a list). set_property() now correctly raises a ValueError. (Bug #18047758)
  • Fabric has renamed the dump functionality to a new command called dump. Consequently, Connector/Python now uses the new functions dump.sharding_information, dump.fabric_nodes, and dump.servers. (Bug #71124, Bug #17965619)
  • MySQLCursor.executemany() caused a UnicodeDecodeError when non-ASCII characters existed in the seq_params parameter and the operation was a Unicode instance with Python 2. This is now corrected by encoding the operation per the current connection character set. (Bug #69067, Bug #18220593)
  • The delay between attempts when trying to connect to a MySQL Fabric-managed server was not honored. (Bug #71905, Bug #18335432)

New in MySQL Connector/Python 1.1.6 (Feb 20, 2014)

  • Bugs Fixed:
  • Connector/Python produced errors using time functions with Django 1.6 due to not using the autocommit value from Django. Now the value is set to that specified in the Django configuration file. (Bug #71438, Bug #18187561)

New in MySQL Connector/Python 1.1.5 (Feb 1, 2014)

  • Functionality Added or Changed:
  • Connector/Python is now compatible with Django 1.6.
  • utf8mb4 is now recognized as a valid character set.
  • The start_transaction() method now supports a readonly argument. This argument can be True to start the transaction in READ ONLY mode or False to start it in READ WRITE mode. If readonly is omitted, the server's default access mode is used. For details about transaction access mode, see the description for the START TRANSACTION statement at START TRANSACTION, COMMIT, and ROLLBACK Syntax. If the server is older than MySQL 5.6.5, it does not support setting the access mode and Connector/Python raises a ValueError.
  • Bugs Fixed:
  • When using connection pooling, a connection returned to the pool was not reset, so session variables retained their values. Now these variables are reset by re-authenticating the user when the connection is returned to the pool. To disable this behavior, pass a pool_reset_session argument to connect() when requesting a pooled connection:
  • cnx = mysql.connector.connect(pool_reset_session=False,...)
  • An incorrectly handled error in MySQLProtocol.parse_column_count() method could lead to a misreported error message.
  • executemany() failed with INSERT INTO ... SELECT statements.

New in MySQL Connector/Python 1.2.0 Alpha (Dec 23, 2013)

  • Functionality Added or Changed:
  • Connector/Python now supports Fabric.
  • Supported capabilities include:
  • High-Availability group lookup using RO/RW modes
  • Failure reporting to Fabric
  • Range and Hash Sharding support
  • Failover support
  • Load balancing based on weight

New in MySQL Connector/Python 1.1.4 (Dec 17, 2013)

  • Bugs Fixed:
  • Python method call overhead was reduced for certain update and select operations. (Bug #17890173)

New in MySQL Connector/Python 1.1.3 Beta (Dec 4, 2013)

  • Functionality Added or Changed:
  • The Connector/Python source code has been made compliant with PEP-8 to the extent possible.
  • Bugs Fixed:
  • Connection pooling did not correctly handle unavailable servers; for a connection that could not be established, it failed to return the connection to the pool. Now reconnection is attempted and if that fails, the connection is returned to the pool. (Bug #17578937)
  • There was a problem saving data containing the backslash character or 0x5c using multi-byte character sets such as sjis, big5, or gbk. To handle this, there is a new HexLiteral type. When a backslash is found in such as sjis, big5, or gbk data, the string is sent as a hexadecimal literal to MySQL. (Bug #69710, Bug #17079344)
  • Connection attempts failed on older versions of FreeBSD. (Bug #69088, Bug #17372107)

New in MySQL Connector/Python 1.1.2 Alpha (Oct 24, 2013)

  • Functionality Added or Changed:
  • The error message raised when a connection pool has no more connections available now indicates “pool exhausted” rather than “queue is empty”. (Bug #17406263)
  • Previously, instantiating a cursor for prepared statements was done using MySQLConnection.cursor(cursor_class=MySQLCursorPrepared). Now this can be done using MySQLConnection.cursor(prepared=True). (Bug #17215197)
  • Previously, setting a custom converter class was possible after instantiating a new connection object. The connect() method now accepts a converter_class connection argument that takes a class and sets it when configuring the connection. An AttributeError is raised if the the custom converter class is not a subclass of conversion.MySQLConverterBase. (Bug #13551483)
  • The connect() method now accepts a boolean compress={False|True} argument indicating whether to use the compressed client/server protocol (default False). This provides an easier alternative to setting the ClientFlag.COMPRESS flag. (Bug #13369592)
  • Bugs Fixed:
  • In some cases, when a Connector/Python application exited, a RuntimeError was raised when using Python 3. (Bug #17424009)
  • The DatabaseOperations.last_executed_query() method in the Django base module was unnecessarily decoding the string, resulting in an error when using Python 3. (Bug #70324, Bug #17473273)

New in MySQL Connector/Python 1.1.1a1 Alpha (Sep 10, 2013)

  • Functionality Added or Changed:
  • Output for individual unit tests did not show timings, making it more difficult to debug problems that involve a change in test execution time. unittest.py now has a new --stats option that runs tests and shows elapsed time for each.
  • It is also possible to save the data to a MySQL server. When the --stats-host option is given with other options such as --stats-user, results are saved to a table called myconnpy_X_Y_Z. The table contains the name of the test case and columns that combine Python and MySQL versions; for example, py27my55 or py33my56.
  • MySQL Connector/Python now supports simple connection pooling that has these characteristics:
  • A pool opens a number of connections and handles thread safety when providing connections to requesters.
  • The size of a connection pool is configurable at pool creation time. It cannot be resized thereafter.
  • A connection pool can be named at pool creation time. If no name is given, one is generated using the connection parameters.
  • The connection pool name can be retrieved from the connection pool or connections obtained from it.
  • It is possible to have multiple connection pools. This enables applications to support pools of connections to different MySQL servers, for example.
  • For each connection request, the pool provides the next available connection. No round-robin or other scheduling algorithm is used.
  • It is possible to reconfigure the connection parameters used by a pool. These apply to connections obtained from the pool thereafter. Reconfiguring individual connections obtained from the pool by calling the connection config() method is not supported.
  • Applications that can benefit from connection-pooling capability include:
  • Middleware that maintains multiple connections to multiple MySQL servers and requires connections to be readily available.
  • Web sites that can have more “permanent” connections open to the MySQL server.
  • The connection pooling implementation involves these interface elements:
  • A new module, mysql.connector.pooling, provides two classes: MySQLConnectionPool instantiates and manages connection pools, and PooledMySQLConnection is similar to MySQLConnection but is used for connections that are part of a connection pool.
  • A new exception, PoolError, occurs for pool-related exceptions. PoolError is a subclass of Error.
  • For more information, see Connector/Python Connection Pooling.
  • Connector/Python now includes a mysql.connector.django module that provides a Django backend for MySQL. This backend supports new features found in MySQL 5.6 such as fractional seconds support for temporal data types.
  • Bugs Fixed:
  • Following fetchone() or fetchmany(), the result returned by fetchall() was missing one row. (Bug #17041412)
  • Previously, executing a statement after the connection was closed raised an OperationalError with an unclear error. Connector/Python now returns the client error 2006, MySQL Server has gone away, with an extra message.
  • The Error() class has been extended to accept a new argument, extra_msg. When given, it is appended between brackets. For example: [2000] Unknown MySQL Error (Some extra message) (Bug #17022399)
  • LOAD DATA LOCAL INFILE failed for files approximately 14MB or larger. (Bug #17002411)
  • An InternalError was raised during transaction rollback if there were unread results. The MySQLConnection.rollback() method now consumes unread results instead of raising an error. (Bug #16656621)
  • Python 2.6 and 2.7 raised a UnicodeDecodeError when unicode_literals was used and a database name contained nonlatin Unicode characters. (Bug #16655208)
  • An unclear OperationalError was raised if a cursor object was closed while there were unread results. Connector/Python now raises an InternalError indicating that there are still unread results. This provides information that to avoid the error it is necessary to consume the result by reading all rows. (Bug #67649, Bug #17041240)
  • The MySQLCursor.executemany() method raised an exception when a SQL function was used as a column value when executing an INSERT statement. (Bug #69675, Bug #17065366)

New in MySQL Connector/Python 1.1.0 Alpha (Aug 15, 2013)

  • Functionality Added or Changed:
  • Incompatible Change: Python v2 code was changed to use new features introduced in Python 2.6 and 2.7. Some examples:
  • print() is used as a function, not a statement.
  • Exceptions are handled using the as keyword.
  • The in keyword is used instead of the has_key() dictionary method.
  • This change means that MySQL Connector/Python 1.1 does not work with versions of Python older than 2.6.
  • Connector/Python was updated with error information from MySQL 5.7.1. (Bug #16896702)
  • Connector/Python supports a new MySQLCursorPrepared class that enables execution of prepared SQL statements using the binary client/server protocol. For details, see Class cursor.MySQLCursorPrepared.
  • MySQLConnection objects now support a start_transaction() method to begin a transaction. This method accepts arguments indicating whether to use a consistent snapshot and which transaction isolation level to use:
  • cnx.start_transaction(consistent_snapshot=bool, isolation_level=level)
  • The default consistent_snapshot value is False. The default isolation_level value is None, and permitted values are 'READ UNCOMMITTED', 'READ COMMITTED', 'REPEATABLE READ', and 'SERIALIZABLE'.
  • MySQLConnection objects now support an in_transaction property that returns True or False to indicate whether a transaction is active for the connection.
  • mysql.connector.__version__ and mysql.connector.__version_info__ now are available to provide MySQL Connector/Python version information in a more standard, Pythonic manner.
  • Bugs Fixed:
  • Relative imports were removed from Python v3 code. PEP-8 indicates that relative imports are discouraged. (Bug #16234372)

New in MySQL Connector/Python 1.0.12 (Aug 15, 2013)

  • Following fetchone() or fetchmany(), the result returned by fetchall() was missing one row. (Bug #17041412)
  • LOAD DATA LOCAL INFILE failed for files approximately 14MB or larger. (Bug #17002411)
  • The fetchall() methods for buffered cursors were returning all rows after fetchone() or fetchmany() were used. fetchall() now correctly returns all or remaining, just like the nonbuffered cursors. (Bug #16662920)
  • Python 2.6 and 2.7 raised a UnicodeDecodeError when unicode_literals was used and a database name contained nonlatin Unicode characters. (Bug #16655208)
  • An unclear OperationalError was raised if a cursor object was closed while there were unread results. Connector/Python now raises an InternalError indicating that there are still unread results. This provides information that to avoid the error it is necessary to consume the result by reading all rows. (Bug #67649, Bug #17041240)
  • The MySQLCursor.executemany() method raised an exception when a SQL function was used as a column value when executing an INSERT statement. (Bug #69675, Bug #17065366)

New in MySQL Connector/Python 1.0.11 (Aug 15, 2013)

  • Connector/Python was updated with error information from MySQL 5.7.1. (Bug #16896702)
  • Debian (.deb) packages for Connector/Python are now available.

New in MySQL Connector/Python 1.0.10 (May 13, 2013)

  • Functionality Added or Changed:
  • A new connection option ssl_verify_cert checks the SSL certificate for the server against the certificate found in the file specified by the ssl_ca option. This option is disabled by default. Any certificate mismatch of invalid combination of SSL options will raise a ValueError exception. (Bug #16400735)
  • Connector/Python now supports the LOCAL keyword for LOAD DATA LOCAL. (Bug #16369511, Bug #16736916)
  • The MySQLConnection.cmd_shutdown() method now accepts an optional shutdown type. A new ShutdownType constants class was added. (Bug #16234441)
  • The GPL Connector/Python packages contained non-GPL documentation. This could be an issue when Linux distributions would like to repackage. PDF and other documentation formats now are removed from the GPL packages, which point in the README_DOCS.txt file to online availability of the manual. (Bug #68509, Bug #16430013)

New in MySQL Connector/Python 1.0.9 (May 13, 2013)

  • Functionality Added or Changed:
  • Previously, when setting up an SSL connection, the developer had to set the ClientFlag.SSL explicitly in the client_flags argument of the mysql.connector.connect() function call. Now, whenever SSL arguments are specified, the client flag is set automatically. This change makes the SSL behavior of Connector/Python more consistent with other MySQL connectors. (Bug #16217667, Bug #68172)
  • Bugs Fixed:
  • The DistUtils command was not copying version.py into the build directory, so that the build/lib directory could not be used for development without manually copying version.py. (Bug #16236136)
  • Passing string parameters to a stored procedure resulted in extra quotes being included in the value. This was caused by the conversion from Python to MySQL data types being applied two times. We now only convert once, and pass the values correctly.
  • MySQLCursor.callproc() now also raises a ValueError when the type of an argument is incorrect. (Bug #16217743, Bug #68066)
  • Fixed IPv6 for older Microsoft Windows versions. Also improved the associated code for all operating systems: we now use socket.getaddrinfo() instead of inet_pton() to check whether we are connecting using IPv4 or IPv6.
  • A new connection option force_ipv6 has been introduced. When set to True, IPv6 will be used when an address resolves to both IPv4 and IPv6. Otherwise, IPv4 is favored. (Bug #16209119)

New in MySQL Connector/Python 1.0.8 (May 13, 2013)

  • Bugs Fixed:
  • When a stored procedure was called with arguments, and produced multiple result sets, the result sets were not returned properly. (Bug #15916486, Bug #67710)
  • The ping() method was always reconnecting to the database, ignoring the reconnect argument. This means that there would be a rollback when pinging the MySQL server during a transaction.
  • Now ping() will honor the reconnect option and only reestablish the connection when needed. (Bug #15915243, Bug #67650)
  • When connecting to a MySQL server from a host whose IP address was not allowed, Connector/Python reported a handshake problem and raised an InterfaceError exception. (Bug #15836979)
  • Connector/Python could not connect to MySQL servers using IPv6 addresses. An InterfaceError or ConnectionRefusedErrorwas raised:
  • mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on
  • 'IPv6-style address' (Address family for hostname not supported)
  • ConnectionRefusedError: [Errno 111] Connection refused
  • (Bug #15876886, Bug #15927825)
  • A socket error would produce a NameError exception instead of the expected InterfaceError, due to a misnamed variable:
  • NameError: global name 'e' is not defined
  • (Bug #14802017)
  • Intermittent errors could occur on Windows systems: InterfaceError(errno=2013). The cause was incorrect handling of sock.recv() library calls that returned less data than was requested. (Bug #14829471, Bug #67303)
  • When a username or password was passed in as Unicode to Connector/Python, connection attempts failed with UnicodeDecodeError exceptions due to string concatenation of mixed-charset types. This issue affected programs running under Python 2, and did not affect Python 3. (Bug #14843456, Bug #67306)
  • The executemany() function now supports the pyformat parameter style. In the pyformat style, all the substitution variables are passed in using a single dictionary parameter, and the % format specifier is encoded like %(dict_key)s for a string. MySQLCursor.executemany() can now use both ANSI C printf and Python extended format codes. (Bug #14754894, Bug #67146)
  • The error message was clarified when a non-integer value was used for the TCP/IP port connection argument. (Bug #13808727, Bug #64543)

New in MySQL Connector/Python 1.0.7 (May 13, 2013)

  • Functionality Added or Changed:
  • Client and server error messages have been regenerated using the MySQL 5.6.6 development release.
  • Bugs Fixed:
  • Fixed formatting of client errors changing numeric to string placeholders. (Bug #14548043)

New in MySQL Connector/Python 1.0.6 (May 13, 2013)

  • Functionality Added or Changed:
  • Changed name and version of distributions to align with other MySQL projects:
  • The version now includes the suffix 'b' for beta and 'a' for alpha followed by a number. This version is used in the source and built distributions. GA versions will have no suffix.
  • The RPM spec files have been updated to create packages whose names are aligned with RPMs from other MySQL projects.
  • Changed how MySQL server errors are mapped to Python exceptions. We now use the SQLState (when available) to raise a better error.
  • Incompatibility: some server errors are now raised with a different exception.
  • It is possible to override how errors are raised using the mysql.connector.custom_error_exception() function, defined in the mysql.connector.errors module. This can be useful for certain frameworks to align with other database drivers.
  • Bugs Fixed:
  • Fixed version-specific code so Connector/Python works with Python 3.3. (Bug #14524942)
  • Fixed MySQLCursorRaw.fetchall() so it does not raise an exception when results are available. (Bug #14517262, Bug #66465)
  • Fixed installation of version.py on OS X:
  • version.py is now correctly installed on OS X in the mysql.connector package. Previously, it was installed through data_files, and version.py ended up in the system-wide package location of Python, from which it could not be imported.
  • data_files is not used any longer in setup.py and is removed. Extra files like version.py are now copied in the custom Distutils commands.
  • (Bug #14483142)
  • Timeout for unit tests has been set to 10 seconds. Test cases can individually adjust it to be higher or lower. (Bug #14487502)
  • Fixed test cases in test_mysql_database.py that failed when using YEAR(2) with MySQL 5.6.6 and greater. (Bug #14460680)
  • Fixed SSL unit testing for source distributions:
  • The SSL keys and certificates were missing and are now added to the source distribution. Now SSL testing works properly.
  • Additionally for the Windows platform, forward slashes were added to the option file creation so the MySQL server can pick up the needed SSL files.

New in MySQL Connector/Python 1.0.5 (May 13, 2013)

  • Functionality Added or Changed:
  • Added SQLMode class in the constants module to make it easier to set modes. For example:
  • cnx.sql_mode = [SQLMode.REAL_AS_FLOAT, SQLMode.NO_ZERO_DATE]
  • Added descriptive error codes for both client and server errors in the module errorcode. A new sub-package locales has been added, which currently only supports English client error messages.
  • For example, errorcode.CR_CONNECTION_ERROR is 2002.

New in MySQL Connector/Python 1.0.4 (May 13, 2013)

  • Bugs Fixed
  • Incompatible Change: The MySQLConnection methods unset_client_flag() and set_client_flag() have been removed. Use theset_client_flags() method instead using a sequence. (Bug #14259996)
  • Incompatible Change: The method MySQLConnection.set_charset() has been removed and replaced by MySQLConnection.set_charset_collation() to simplify setting and retrieving character set and collation information. The MySQLConnection properties collation and charset are now read-only. (Bug #14260052)
  • Incompatible Change: Fixed MySQLConnection.cmd_query() to raise an error when the operation has multiple statements. We introduced a new method MySQLConnection.cmd_query_iter() which needs to be used when multiple statements send to the MySQL server. It returns a generator object to iterate through results.
  • When executing single statements, MySQLCursor.execute() will always return None. You can use the MySQLCursor property with_rows to check whether a result could have rows or not.
  • MySQLCursor.execute() returns a generator object with which you can iterate over results when executing multiple statements.
  • The MySQLCursor.next_resultset() became obsolete and was removed and the MySQLCursor.next_proc_result() method has been renamed to MySQLCursor.proc_results(), which returns a generator object. The MySQLCursor.with_rows property can be used to check if a result could return rows. The multiple_resultset.py example script shows how to go through results produced by sending multiple statements. (Bug #14208326)
  • Fixed MySQLCursor.executemany() when INSERT statements use the ON DUPLICATE KEY clause with a function such as VALUES(). (Bug #14259954)
  • Fixed unit testing on the Microsoft Windows platform. (Bug #14236592)
  • Fixed converting a datetime.time to a MySQL type using Python 2.4 and 2.5. The strftime() function has no support for the %f mark in those Python versions. (Bug #14231941)
  • Fixed cursor.CursorBase attributes description, lastrowid and rowcount to be read-only properties. (Bug #14231160)
  • Fixed MySQLConnection.cmd_query() and other methods so they check first whether there are unread results. (Bug #14184643)

New in MySQL Connector/Python 1.0.3 (May 13, 2013)

  • Adding new Distutils commands to create Windows Installers using WiX and RPM packages.
  • Adding support for time values with a fractional part, for MySQL 5.6.4 and greater. A new example script microseconds.py was added to show this functionality.