Cannot perform a backup or restore operation within a transaction

℡╲_俬逩灬. 提交于 2019-11-29 11:12:56

Your error says

Cannot perform a backup or restore operation within a transaction.

Transactions are started by default in pyodbc, so how do you execute a query without creating a transaction? Simply turn on autocommit:

conn.autocommit = true
// do stuff
conn.autocommit = false

The pyodbc FAQ has an entry about this.

By default all pyodbc connections start with a transaction.

You need to turn autocommit on - using the autocommit keyword to the connect function:

conn.autocommit = true
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!