From 667a9ca21417f5ae9d2c5bd031506cf40c8e5909 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 3 May 2023 22:33:28 -0400 Subject: add bind casts for BYTEA on asyncpg Fixed another regression due to the "insertmanyvalues" change in 2.0.10 as part of :ticket:`9618`, in a similar way as regression :ticket:`9701`, where :class:`.LargeBinary` datatypes also need additional casts on when using the asyncpg driver specifically in order to work with the new bulk INSERT format. Fixes: #9739 Change-Id: I57370d269ea757f263c1f3a16c324ceae76fd4e8 --- lib/sqlalchemy/dialects/postgresql/asyncpg.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py') diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py index c879205e4..3f33600f9 100644 --- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py +++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py @@ -182,6 +182,7 @@ from .base import PGExecutionContext from .base import PGIdentifierPreparer from .base import REGCLASS from .base import REGCONFIG +from .types import BYTEA from ... import exc from ... import pool from ... import util @@ -212,6 +213,10 @@ class AsyncpgTime(sqltypes.Time): render_bind_cast = True +class AsyncpgByteA(BYTEA): + render_bind_cast = True + + class AsyncpgDate(sqltypes.Date): render_bind_cast = True @@ -986,6 +991,7 @@ class PGDialect_asyncpg(PGDialect): sqltypes.Numeric: AsyncpgNumeric, sqltypes.Float: AsyncpgFloat, sqltypes.JSON: AsyncpgJSON, + sqltypes.LargeBinary: AsyncpgByteA, json.JSONB: AsyncpgJSONB, sqltypes.JSON.JSONPathType: AsyncpgJSONPathType, sqltypes.JSON.JSONIndexType: AsyncpgJSONIndexType, -- cgit v1.2.1