-
Incompatible Change: Python 2 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 thehas_key()
dictionary method.
This change means that MySQL Connector/Python 1.1 does not work with versions of Python older than 2.6. (WL #6509)
Connector/Python was updated with error information from MySQL 5.7.1. (Bug #16896702)
mysql.connector.__version__
andmysql.connector.__version_info__
now are available to provide MySQL Connector/Python version information in a more standard, Pythonic manner. (WL #6517)MySQLConnection
objects now support anin_transaction
property that returnsTrue
orFalse
to indicate whether a transaction is active for the connection. (WL #6574)-
MySQLConnection
objects now support astart_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 isFalse
. The defaultisolation_level
value isNone
, and permitted values are'READ UNCOMMITTED'
,'READ COMMITTED'
,'REPEATABLE READ'
, and'SERIALIZABLE'
. (WL #6573) Connector/Python supports a new
MySQLCursorPrepared
class that enables execution of prepared SQL statements using the binary client/server protocol. For details, see cursor.MySQLCursorPrepared Class. (WL #6148)