Context
So I am trying to figure out how to properly override the auto-transaction when using SQLite in Python. When I try and run
c
As @CL. said you have to set isolation level to None
. Code example:
s = sqlite3.connect("./data.db")
s.isolation_level = None
try:
c = s.cursor()
c.execute("begin")
...
c.execute("commit")
except:
c.execute("rollback")
The documentaton says:
You can control which kind of
BEGIN
statements sqlite3 implicitly executes (or none at all) via the isolation_level parameter to the connect() call, or via the isolation_level property of connections.If you want autocommit mode, then set isolation_level to
None
.