From: Mike Bayer Date: Mon, 29 May 2006 16:49:42 +0000 (+0000) Subject: echo_pool flag fixed X-Git-Tag: rel_0_2_2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11fab37133fd2ae155179d64079965f307b4d57c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git echo_pool flag fixed removed incorrect paragraph regarding release modes --- diff --git a/doc/build/content/dbengine.txt b/doc/build/content/dbengine.txt index 85767bf14c..2193ab6b5d 100644 --- a/doc/build/content/dbengine.txt +++ b/doc/build/content/dbengine.txt @@ -181,8 +181,6 @@ The `threadlocal` strategy is better suited to a programming style which relies # are returned to the pool. r2 = None -While the `close()` method is still available with the "threadlocal" strategy, it should be used carefully. Above, if we issued a `close()` call on `r1`, and then tried to further work with results from `r2`, `r2` would be in an invalid state since its connection was already returned to the pool. By relying on `__del__()` to automatically clean up resources, this condition will never occur. - Advantages to `threadlocal` include that resources can be left to clean up after themselves, application code can be more minimal, its guaranteed that only one connection is used per thread, and there is no chance of a "connection pool block", which is when an execution hangs because the current thread has already checked out all remaining resources. To get at the actual `Connection` object which is used by implicit executions, call the `contextual_connection()` method on `Engine`: diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index 51496a67df..d8b503add1 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -32,7 +32,7 @@ class PlainEngineStrategy(EngineStrategy): dialect = module.dialect(**kwargs) poolargs = {} - for key in (('echo', 'echo_pool'), ('pool_size', 'pool_size'), ('max_overflow', 'max_overflow'), ('poolclass', 'poolclass'), ('pool_timeout','timeout'), ('pool', 'pool')): + for key in (('echo_pool', 'echo'), ('pool_size', 'pool_size'), ('max_overflow', 'max_overflow'), ('poolclass', 'poolclass'), ('pool_timeout','timeout'), ('pool', 'pool')): if kwargs.has_key(key[0]): poolargs[key[1]] = kwargs[key[0]] poolclass = getattr(module, 'poolclass', None) @@ -54,7 +54,7 @@ class ThreadLocalEngineStrategy(EngineStrategy): dialect = module.dialect(**kwargs) poolargs = {} - for key in (('echo', 'echo_pool'), ('pool_size', 'pool_size'), ('max_overflow', 'max_overflow'), ('poolclass', 'poolclass'), ('pool_timeout','timeout'), ('pool', 'pool')): + for key in (('echo_pool', 'echo'), ('pool_size', 'pool_size'), ('max_overflow', 'max_overflow'), ('poolclass', 'poolclass'), ('pool_timeout','timeout'), ('pool', 'pool')): if kwargs.has_key(key[0]): poolargs[key[1]] = kwargs[key[0]] poolclass = getattr(module, 'poolclass', None)