Python 3.12 is going to introduce new autocommit keyword argument for the connect() function. It does not exist in Python 3.11 and is set to LEGACY_TRANSACTION_CONTROL by default in Python 3.12, but it is recommended to set autocommit to False by the documentation.
If the recommended autocommit=False mode is used, we should not open our own transaction, while python will open DEFERRED transactions for us. Transactions should be committed with .commit() or rolled back with .rollback(). Because the transaction is DEFERRED, there is a possibility of .commit() failing, as far as I understand with an sqlite3.OperationalError, in which case the transaction should be retried from scratch as if it was rolled back.
Even if we do not switch to the new behaviour, we should not forget to set autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL explicitly on Python >= 3.12, because the documentation for it says "The default will change to False in a future Python release."
Python 3.12 is going to introduce new
autocommit
keyword argument for theconnect()
function. It does not exist in Python 3.11 and is set toLEGACY_TRANSACTION_CONTROL
by default in Python 3.12, but it is recommended to setautocommit
toFalse
by the documentation.If the recommended
autocommit=False
mode is used, we should not open our own transaction, while python will openDEFERRED
transactions for us. Transactions should be committed with.commit()
or rolled back with.rollback()
. Because the transaction isDEFERRED
, there is a possibility of.commit()
failing, as far as I understand with ansqlite3.OperationalError
, in which case the transaction should be retried from scratch as if it was rolled back.Even if we do not switch to the new behaviour, we should not forget to set
autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL
explicitly on Python >= 3.12, because the documentation for it says "The default will change toFalse
in a future Python release."