lol
This commit is contained in:
@@ -205,6 +205,7 @@ from .base import PGExecutionContext
|
||||
from .base import PGIdentifierPreparer
|
||||
from .base import REGCLASS
|
||||
from .base import REGCONFIG
|
||||
from .types import BIT
|
||||
from .types import BYTEA
|
||||
from .types import CITEXT
|
||||
from ... import exc
|
||||
@@ -237,6 +238,10 @@ class AsyncpgTime(sqltypes.Time):
|
||||
render_bind_cast = True
|
||||
|
||||
|
||||
class AsyncpgBit(BIT):
|
||||
render_bind_cast = True
|
||||
|
||||
|
||||
class AsyncpgByteA(BYTEA):
|
||||
render_bind_cast = True
|
||||
|
||||
@@ -566,6 +571,7 @@ class AsyncAdapt_asyncpg_cursor:
|
||||
async def _executemany(self, operation, seq_of_parameters):
|
||||
adapt_connection = self._adapt_connection
|
||||
|
||||
self.description = None
|
||||
async with adapt_connection._execute_mutex:
|
||||
await adapt_connection._check_type_cache_invalidation(
|
||||
self._invalidate_schema_cache_asof
|
||||
@@ -818,10 +824,23 @@ class AsyncAdapt_asyncpg_connection(AdaptedConnection):
|
||||
|
||||
def ping(self):
|
||||
try:
|
||||
_ = self.await_(self._connection.fetchrow(";"))
|
||||
_ = self.await_(self._async_ping())
|
||||
except Exception as error:
|
||||
self._handle_exception(error)
|
||||
|
||||
async def _async_ping(self):
|
||||
if self._transaction is None and self.isolation_level != "autocommit":
|
||||
# create a tranasction explicitly to support pgbouncer
|
||||
# transaction mode. See #10226
|
||||
tr = self._connection.transaction()
|
||||
await tr.start()
|
||||
try:
|
||||
await self._connection.fetchrow(";")
|
||||
finally:
|
||||
await tr.rollback()
|
||||
else:
|
||||
await self._connection.fetchrow(";")
|
||||
|
||||
def set_isolation_level(self, level):
|
||||
if self._started:
|
||||
self.rollback()
|
||||
@@ -1002,6 +1021,7 @@ class PGDialect_asyncpg(PGDialect):
|
||||
{
|
||||
sqltypes.String: AsyncpgString,
|
||||
sqltypes.ARRAY: AsyncpgARRAY,
|
||||
BIT: AsyncpgBit,
|
||||
CITEXT: CITEXT,
|
||||
REGCONFIG: AsyncpgREGCONFIG,
|
||||
sqltypes.Time: AsyncpgTime,
|
||||
|
||||
Reference in New Issue
Block a user