summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/pool.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-05-05 16:50:58 +0000
committerJason Kirtland <jek@discorporate.us>2008-05-05 16:50:58 +0000
commit1589bc5f254bb99ee30ed3b67b9aac51b88cf52b (patch)
tree53f519dec9e3653971a3a0cc884f8ee35003961e /lib/sqlalchemy/pool.py
parentfd5543b78e071a24652ab040c3029b7aea29f7d7 (diff)
downloadsqlalchemy-1589bc5f254bb99ee30ed3b67b9aac51b88cf52b.tar.gz
Renamed rollback_returned to reset_on_return. Future, dialect-aware pools can do better than rollback for this function.
Diffstat (limited to 'lib/sqlalchemy/pool.py')
-rw-r--r--lib/sqlalchemy/pool.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py
index 232f188e3..31adf77d1 100644
--- a/lib/sqlalchemy/pool.py
+++ b/lib/sqlalchemy/pool.py
@@ -110,19 +110,24 @@ class Pool(object):
that receive events when DB-API connections are created, checked out and
checked in to the pool.
- """
+ reset_on_return
+ Defaults to True. Reset the database state of connections returned to
+ the pool. This is typically a ROLLBACK to release locks and transaction
+ resources. Disable at your own peril.
- def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True, rollback_returned=True,
- listeners=None):
+ """
+ def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True,
+ reset_on_return=True, listeners=None):
self.logger = logging.instance_logger(self, echoflag=echo)
- # the WeakValueDictionary works more nicely than a regular dict
- # of weakrefs. the latter can pile up dead reference objects which don't
- # get cleaned out. WVD adds from 1-6 method calls to a checkout operation.
+ # the WeakValueDictionary works more nicely than a regular dict of
+ # weakrefs. the latter can pile up dead reference objects which don't
+ # get cleaned out. WVD adds from 1-6 method calls to a checkout
+ # operation.
self._threadconns = weakref.WeakValueDictionary()
self._creator = creator
self._recycle = recycle
self._use_threadlocal = use_threadlocal
- self._rollback_returned = rollback_returned
+ self._reset_on_return = reset_on_return
self.echo = echo
self.listeners = []
self._on_connect = []
@@ -289,7 +294,7 @@ def _finalize_fairy(connection, connection_record, pool, ref=None):
return
if connection is not None:
try:
- if pool._rollback_returned:
+ if pool._reset_on_return:
connection.rollback()
# Immediately close detached instances
if connection_record is None: