Also note that the Python sqlite3 wrapper automagically manages the transaction state for you (success at this depends on the version of the PySqlite2 extension code that the wrapper is using -- newer versions use a better detection of "write" statements and old ones are limited by guessing based on the first word in the SQL statement). This automagic is controlled by the isolation_level parameter of the sqlite3.connect function. If the isolation_level is not None (the default is '', an empty string) then it must be a character string which is appended to a BEGIN statement that is automagically executed before any write statement. To turn off the automagic you need to open the connection with isolation_level=None. See also APSW <https://rogerbinns.github.io/apsw/> that behaves more like sqlite3 and less like a lowest-common-denominator DB-API interface.