Implemented context managers to define the runtime context to establish when executing a with statement. It was added to the Connection and Cursor objects in the classic protocol, and to Session in the X DevAPI. Thanks to WEN-FENG SHIH for the patch. (Bug #19586444, Bug #71663, Bug #28779784, Bug #89113)
Added compression support to X Protocol connections. Supported compression algorithms are zlib/deflate and lz4. Specifically, the supported algorithms (in order of preference) are lz4_message and deflate_stream. The compression threshold is set at 1000 bytes.
compressX DevAPI connection option accepts either required, disabled, or preferred (default).
preferred: If Connector/Python and the server cannot reach consensus on algorithm or styles, then no compression is used; and this is logged.
required: Like preferred, except the connection is terminated with an error if the connector and server are unable to reach agreement.
disabled: Compression is not used.
The connect_timeout option applied to all blocking socket operations but now properly only applies to the timeout when establishing the connection. (Bug #30996790)
In X DevAPI implementation, an error was raised when using the fractional part in DATETIME types. The error: "ValueError: Datetime mapping scenario unhandled" (Bug #30950184)
Because MySQL stores TEXT types as BLOB and JSON as LONGBLOB, the TEXT and JSON types are now converted to str and the rest of the BLOB types as bytes. Previously, as an example, a column of type TEXT that only contained digits was read as type=integer by Connector/Python. (Bug #29808262, Bug #95437)
Connector/Python assumed that MySQL libraries were under lib/ when compiling the C extension, but now uses the mysql_config flags which adds the correct include and libraries paths. Thanks to Daniël van Eeden for the patch. (Bug #29181907, Bug #93846)
Attempting to change values using the Table object would yield an "Unknown column 'doc' in 'field list'" exception when using the X DevAPI. (Bug #28627768, Bug #27602636)