summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/engine/base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 028af9fbb..d36cf30e9 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -489,6 +489,7 @@ class Connection(Connectable):
code="8s2b",
)
else:
+ assert not self._is_future
raise exc.PendingRollbackError(
"This connection is on an inactive %stransaction. "
"Please rollback() fully before proceeding."
@@ -2190,6 +2191,15 @@ class MarkerTransaction(Transaction):
"Please issue a rollback first."
)
+ assert not connection._is_future
+ util.warn_deprecated_20(
+ "Calling .begin() when a transaction is already begun, creating "
+ "a 'sub' transaction, is deprecated "
+ "and will be removed in 2.0. See the documentation section "
+ "'Migrating from the nesting pattern' for background on how "
+ "to migrate from this pattern."
+ )
+
self.connection = connection
if connection._nested_transaction is not None:
self._transaction = connection._nested_transaction