MySQL :: MySQL 5.0 Reference Manual :: 13.2.8 The InnoDB ...
By default, MySQL starts the session for each new connection with autocommit ...dev.mysql.com/.../innodb-transaction-model.html
The connection object commit() method commits any outstanding changes in the current transaction to make them permanent in the database. In DB-API, connections begin with autocommit mode disabled, so you must call commit() before disconnecting or changes may be lost.
Python DB API默认情况下禁用自动提交
从谷歌粘贴(第一页,第二个结果)
但是
显然Python是以非自动提交模式启动MySQL的,请参见:
http://www.kitebird.com/articles/pydbapi.html
从文章中:
可怜虫,不知道如何克服这一点,我不想通过猜测把你引入歧途。 我建议提出一个新问题,题为:
如何在MySQL python DB-API中启用自动提交模式
祝你好运
InnoDB是事务性的。插入/删除/更新后需要调用connection.commit()
编辑:您可以调用connection.autocommit(True)来启用自动提交
相关问题 更多 >
编程相关推荐