]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Update "transaction has already begun" language
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Nov 2021 17:36:43 +0000 (13:36 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Nov 2021 17:36:43 +0000 (13:36 -0400)
commitfee0855bfe2982927ab21ce7398fa48b90af7ca4
tree75ae89326a8f1eea0b45ceeca39a85284a5ceeb2
parenta3bc81b86387771713740b1926fad0e026f05c16
Update "transaction has already begun" language

As future connections will now be autobeginning, there
will be more cases where begin() can't be called as well as where isolation level
can't be set, which will be surprising as this is a behavioral
change for 2.0; additionally, when DBAPI autocommit is set,
there isn't actually a DBAPI level transaction in effect even though
Connection has a Transaction object.  Clarify the language in these
two error messages to make it clear that begin() and autobegin
are tracking a SQLAlchemy-level Transaction() object, whether or not
the DBAPI has actually started a transaction, and that this is the
reason rollback() or commit() is required before performing
the requsted operation.   Additionally make sure the error message
mentions "autobegin" as a likely reason this error is being
encountered along with what Connection needs the user to do in
order to resolve.

Change-Id: If8763939eeabc46aa9d9209a56d05ad82b892c5c
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
test/engine/test_transaction.py