MySQLdb.cursor.execute can't run multiple queries

前端 未结 7 1343
暗喜
暗喜 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:58

    Apparently there is no way to do this in MySQLdb (aka. MySQL-python), so we ended up just communicateing the data to subprocess.Popen([mysql, ...], stdin=subprocess.PIPE) and checking the returncode.

提交回复
热议问题