def __init__(self, pool, dialect, url, logging_name=None, echo=None,
execution_options=None, loop=None, **kwargs):
self._engine = Engine(
pool, dialect, url, logging_name=logging_name, echo=echo,
execution_options=execution_options, **kwargs)
self._loop = loop
max_workers = None
# https://www.python.org/dev/peps/pep-0249/#threadsafety
if dialect.dbapi.threadsafety < 2:
# This might seem overly-restrictive, but when we instantiate an
# AsyncioResultProxy from AsyncioEngine.execute, subsequent
# fetchone calls could be in different threads. Let's limit to one.
max_workers = 1
self._engine_executor = ThreadPoolExecutor(max_workers=max_workers)
评论列表
文章目录