MySQLdb.cursor.execute can't run multiple queries

前端 未结 7 1359
暗喜
暗喜 2020-12-06 05:11

We\'re trying to run SQL files containing multiple insert statements as a single query, but it seems rollback fails when any of the statements contain an error.

7条回答
  •  没有蜡笔的小新
    2020-12-06 05:50

    I think you need to pass multi=True to execute when using multiple statements, see http://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-execute.html

    Update: This applies to the mysql.connector module, not MySQLdb used in this case.

提交回复
热议问题