On 2017-06-02, Frank Millman <fr...@chagford.com> wrote: > As I said, I cannot prove this, but the theory fits the > observed behaviour perfectly, so I have proceeded on the > assumption that it is true. Therefore I now always run every > SQL command or block of commands within a context manager, > which always calls conn.commit() or conn.rollback() on exit, > and I have not had any more problems. I use exactly the same > code for sqlite3 and for Sql Server/pyodbc, and it has not > caused any problems there either.
You're probably not expected to interleave transaction control commands from different levels of abstraction, e.g., only call 'commit' directly if you called 'begin' directly. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list