diff options
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/strategies.py | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 13755d49a..587dbf92f 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -15,7 +15,7 @@ as the base class for their own corresponding classes. import re, random from sqlalchemy.engine import base, reflection from sqlalchemy.sql import compiler, expression -from sqlalchemy import exc, types as sqltypes, util +from sqlalchemy import exc, types as sqltypes, util, pool AUTOCOMMIT_REGEXP = re.compile( r'\s*(?:UPDATE|INSERT|CREATE|DELETE|DROP|ALTER)', @@ -143,6 +143,10 @@ class DefaultDialect(base.Dialect): @property def dialect_description(self): return self.name + "+" + self.driver + + @classmethod + def get_pool_class(cls, url): + return getattr(cls, 'poolclass', pool.QueuePool) def initialize(self, connection): try: diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index fe0abd4b7..8de29271b 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -37,8 +37,6 @@ class EngineStrategy(object): class DefaultEngineStrategy(EngineStrategy): """Base class for built-in stratgies.""" - pool_threadlocal = False - def create(self, name_or_url, **kwargs): # create url.URL object u = url.make_url(name_or_url) @@ -84,8 +82,9 @@ class DefaultEngineStrategy(EngineStrategy): creator = kwargs.pop('creator', connect) - poolclass = (kwargs.pop('poolclass', None) or - getattr(dialect_cls, 'poolclass', poollib.QueuePool)) + poolclass = kwargs.pop('poolclass', None) + if poolclass is None: + poolclass = dialect_cls.get_pool_class(u) pool_args = {} # consume pool arguments from kwargs, translating a few of @@ -100,7 +99,6 @@ class DefaultEngineStrategy(EngineStrategy): tk = translate.get(k, k) if tk in kwargs: pool_args[k] = kwargs.pop(tk) - pool_args.setdefault('use_threadlocal', self.pool_threadlocal) pool = poolclass(creator, **pool_args) else: if isinstance(pool, poollib._DBProxy): @@ -163,7 +161,6 @@ class ThreadLocalEngineStrategy(DefaultEngineStrategy): """Strategy for configuring an Engine with thredlocal behavior.""" name = 'threadlocal' - pool_threadlocal = True engine_cls = threadlocal.TLEngine ThreadLocalEngineStrategy() |