summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/aiomysql.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-08-16 10:48:57 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-30 15:49:09 -0500
commit2581655c545a0cf705e0347e81cd092896d3207c (patch)
tree70a9528216c3de54797b4197978c494ae819d39a /lib/sqlalchemy/dialects/mysql/aiomysql.py
parent102b91d8950926f1215dd7c59c5b7f200b5c0f8b (diff)
downloadsqlalchemy-2581655c545a0cf705e0347e81cd092896d3207c.tar.gz
Support testing of async drivers without fallback mode
Change-Id: I4940d184a4dc790782fcddfb9873af3cca844398
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/aiomysql.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/aiomysql.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/aiomysql.py b/lib/sqlalchemy/dialects/mysql/aiomysql.py
index f560ece33..81864603d 100644
--- a/lib/sqlalchemy/dialects/mysql/aiomysql.py
+++ b/lib/sqlalchemy/dialects/mysql/aiomysql.py
@@ -34,6 +34,7 @@ handling.
from .pymysql import MySQLDialect_pymysql
from ... import pool
+from ... import util
from ...util.concurrency import await_fallback
from ...util.concurrency import await_only
@@ -226,7 +227,7 @@ class AsyncAdapt_aiomysql_dbapi:
def connect(self, *arg, **kw):
async_fallback = kw.pop("async_fallback", False)
- if async_fallback:
+ if util.asbool(async_fallback):
return AsyncAdaptFallback_aiomysql_connection(
self,
await_fallback(self.aiomysql.connect(*arg, **kw)),
@@ -244,6 +245,8 @@ class MySQLDialect_aiomysql(MySQLDialect_pymysql):
supports_server_side_cursors = True
_sscursor = AsyncAdapt_aiomysql_ss_cursor
+ is_async = True
+
@classmethod
def dbapi(cls):
return AsyncAdapt_aiomysql_dbapi(
@@ -251,8 +254,14 @@ class MySQLDialect_aiomysql(MySQLDialect_pymysql):
)
@classmethod
- def get_pool_class(self, url):
- return pool.AsyncAdaptedQueuePool
+ def get_pool_class(cls, url):
+
+ async_fallback = url.query.get("async_fallback", False)
+
+ if util.asbool(async_fallback):
+ return pool.FallbackAsyncAdaptedQueuePool
+ else:
+ return pool.AsyncAdaptedQueuePool
def create_connect_args(self, url):
args, kw = super(MySQLDialect_aiomysql, self).create_connect_args(url)