]> 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:40:22 +0000 (13:40 -0400)
commit71feeb37ca8e6726327aa1f24cf7de458dea6f82
tree01146ce86b9242f643ffa0301ae9e9c829e74936
parent0ff91b3e34bf62e84ea69f30448d953fbdd6cfbf
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
(cherry picked from commit fee0855bfe2982927ab21ce7398fa48b90af7ca4)
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
test/engine/test_transaction.py