From 9fa79bb53638e02aaa45d77397b39a1b652ba5f1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 2 Nov 2021 18:19:35 -0400 Subject: map Float to asyncpg.FLOAT, test for infinity Fixes: #7283 Change-Id: I5402a72617b7f9bc366d64bc5ce8669374839984 --- lib/sqlalchemy/dialects/postgresql/asyncpg.py | 9 +++++++++ 1 file changed, 9 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 3d195e691..913b93159 100644 --- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py +++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py @@ -249,6 +249,9 @@ class AsyncpgUUID(UUID): class AsyncpgNumeric(sqltypes.Numeric): + def get_dbapi_type(self, dbapi): + return dbapi.NUMBER + def bind_processor(self, dialect): return None @@ -277,6 +280,11 @@ class AsyncpgNumeric(sqltypes.Numeric): ) +class AsyncpgFloat(AsyncpgNumeric): + def get_dbapi_type(self, dbapi): + return dbapi.FLOAT + + class AsyncpgREGCLASS(REGCLASS): def get_dbapi_type(self, dbapi): return dbapi.STRING @@ -883,6 +891,7 @@ class PGDialect_asyncpg(PGDialect): sqltypes.Integer: AsyncpgInteger, sqltypes.BigInteger: AsyncpgBigInteger, sqltypes.Numeric: AsyncpgNumeric, + sqltypes.Float: AsyncpgFloat, sqltypes.JSON: AsyncpgJSON, json.JSONB: AsyncpgJSONB, sqltypes.JSON.JSONPathType: AsyncpgJSONPathType, -- cgit v1.2.1