diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2021-06-03 22:38:15 +0200 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2021-06-08 22:02:42 +0200 |
| commit | d200ba26a0f5b8542ec258d2fcfe0b53a80af42c (patch) | |
| tree | 38c6a9f72da15d6c496f1e24f621c3a78ee3e863 /lib/sqlalchemy/pool/impl.py | |
| parent | dd5d6d15467b66398dd328ff43b863a057899291 (diff) | |
| download | sqlalchemy-d200ba26a0f5b8542ec258d2fcfe0b53a80af42c.tar.gz | |
Propagate asyncio flag from the dialect to selected pool classes
Fixed an issue that presented itself when using the :class:`_pool.NullPool`
or the :class:`_pool.StaticPool` with an async engine. This mostly affected
the aiosqlite dialect.
Fixes: #6575
Change-Id: Ic1e27d99ffcb20ed4de82ea78f430a0f3b629d86
Diffstat (limited to 'lib/sqlalchemy/pool/impl.py')
| -rw-r--r-- | lib/sqlalchemy/pool/impl.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/sqlalchemy/pool/impl.py b/lib/sqlalchemy/pool/impl.py index 730293273..99d0c94d2 100644 --- a/lib/sqlalchemy/pool/impl.py +++ b/lib/sqlalchemy/pool/impl.py @@ -13,7 +13,7 @@ import traceback import weakref -from .base import _ConnDialect +from .base import _AsyncConnDialect from .base import _ConnectionFairy from .base import _ConnectionRecord from .base import Pool @@ -34,6 +34,7 @@ class QueuePool(Pool): """ + _is_asyncio = False _queue_class = sqla_queue.Queue def __init__( @@ -222,10 +223,6 @@ class QueuePool(Pool): return self._pool.maxsize - self._pool.qsize() + self._overflow -class _AsyncConnDialect(_ConnDialect): - is_async = True - - class AsyncAdaptedQueuePool(QueuePool): _is_asyncio = True _queue_class = sqla_queue.AsyncAdaptedQueue @@ -307,6 +304,8 @@ class SingletonThreadPool(Pool): """ + _is_asyncio = False + def __init__(self, creator, pool_size=5, **kw): Pool.__init__(self, creator, **kw) self._conn = threading.local() |
