diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-12-14 15:38:21 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-12-14 15:38:21 +0000 |
| commit | 8d3254b6727b306e19dd0db299586b95caa46c9e (patch) | |
| tree | 9caddc165f5d5941b10f5f272fe43db7e4157420 /lib/sqlalchemy | |
| parent | 89ccab00e33c9a80f2d94e656a489b63c7d51e7a (diff) | |
| parent | 628db9581c5bd43c01cbfcc16753477f206de431 (diff) | |
| download | sqlalchemy-8d3254b6727b306e19dd0db299586b95caa46c9e.tar.gz | |
Merge "Emit 2.0 deprecation warning for sub-transactions"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 10 |
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 |
