summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--lib/sqlalchemy/pool.py6
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 8e3952419..4ac82c2ed 100644
--- a/CHANGES
+++ b/CHANGES
@@ -83,6 +83,11 @@ CHANGES
- Pool listeners can now be provided as a dictionary of
callables or a (possibly partial) duck-type of
PoolListener, your choice.
+
+ - added "rollback_returned" option to Pool which will
+ disable the rollback() issued when connections are
+ returned. This flag is only safe to use with a database
+ which does not support transactions (i.e. MySQL/MyISAM).
- mssql
- Added "odbc_autotranslate" parameter to engine / dburi
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py
index 71c0c82df..232f188e3 100644
--- a/lib/sqlalchemy/pool.py
+++ b/lib/sqlalchemy/pool.py
@@ -112,7 +112,7 @@ class Pool(object):
"""
- def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True,
+ def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True, rollback_returned=True,
listeners=None):
self.logger = logging.instance_logger(self, echoflag=echo)
# the WeakValueDictionary works more nicely than a regular dict
@@ -122,6 +122,7 @@ class Pool(object):
self._creator = creator
self._recycle = recycle
self._use_threadlocal = use_threadlocal
+ self._rollback_returned = rollback_returned
self.echo = echo
self.listeners = []
self._on_connect = []
@@ -288,7 +289,8 @@ def _finalize_fairy(connection, connection_record, pool, ref=None):
return
if connection is not None:
try:
- connection.rollback()
+ if pool._rollback_returned:
+ connection.rollback()
# Immediately close detached instances
if connection_record is None:
connection.close()