This is a bug in Python, or more correctly it is a luser-error (error code 1D 10T).
If you wish to control transactions explicitly, you need to open the connection with isolation_level=None. Otherwise, the sqlite3 (pysqlite) library issues "automagically created" "begin" statements for you (oftentimes incorrectly). For example, the 1D 10T talk of not opening transactions for "read only" operations, which is not correct. Even read only operations are contained within a transaction, it may just be a transaction that you do not explicitly start or commit. So, if you issue an explicit "BEGIN" statement when operating in automagical mode (that is, when isolation_level is any value OTHER THAN None), you may experience error AHBL. This has nothing to do with SQLite itself, it is a 1D 10T error in the interface module design. (the error thrown in correct -- you cannot start a transaction within a transaction) > -----Original Message----- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Big Stone > Sent: Friday, 25 November, 2016 12:27 > To: sqlite-users@mailinglists.sqlite.org > Subject: [sqlite] problem or not problem around 'begin immediate' > > there is some discussion about an issue-or-not-an-issue on bugs.python.org > > https://bugs.python.org/issue28518 > > ##### > > conn = sqlite3.connect(':memory:', isolation_level='IMMEDIATE') > conn.execute('begin immediate') > > Throws: > > sqlite3.OperationalError: cannot start a transaction within a transaction > > This didn't happen in previous versions > > ##### > Maybe a sqlite developer comment would help settle the case ? > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users