MySQL Connector/Python Release Notes
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.
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)