MySQLConnection 类的 start_transaction 方法似乎没有mysql-connector-python
按预期工作。
>>> from mysql.connector import connect
>>> conn = connect(user = 'john', unix_socket = '/tmp/mysql.sock', database='db7')
>>> cur = conn.cursor()
>>> cur.execute("select @@session.tx_isolation")
>>> cur.fetchone()
('REPEATABLE-READ',)
>>> cur.close()
True
>>> conn.start_transaction(isolation_level = 'SERIALIZABLE')
>>> cur = conn.cursor()
>>> cur.execute("select @@session.tx_isolation")
>>> cur.fetchone()
('REPEATABLE-READ',)
start_transaction
尽管在调用中将隔离级别设置为“SERIALIZABLE”,但隔离级别仍保持可重复读取。我错过了什么吗?