summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/asyncpg.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-11-03 15:13:22 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-03 11:15:33 -0400
commit2cc49191e28bcf05d97787d6cdc561dd6815e847 (patch)
treec91dc5c29a72fe20df5169b8fc1c99f6fd8aed21 /lib/sqlalchemy/dialects/postgresql/asyncpg.py
parentd80f5277e1c6a6043408244288effb08713c8d70 (diff)
downloadsqlalchemy-2cc49191e28bcf05d97787d6cdc561dd6815e847.tar.gz
Revert "Gracefully degrade unsupported types with asyncpg"
This reverts commit 96c294da8a50d692b3f0b8e508dbbca5d9c22f1b. I have another approach that is more obvious, easier to override explicitly and also I can test it more easily. Change-Id: I11a3be7700dbc6f25d436e450b6fb8e8f6c4fd16
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/asyncpg.py43
1 files changed, 14 insertions, 29 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
index 21f9e3e26..2225a7278 100644
--- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py
+++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
@@ -878,8 +878,6 @@ class PGDialect_asyncpg(PGDialect):
use_native_uuid = True
- _exclude_type_codecs = util.EMPTY_SET
-
colspecs = util.update_copy(
PGDialect.colspecs,
{
@@ -1034,34 +1032,21 @@ class PGDialect_asyncpg(PGDialect):
See https://github.com/MagicStack/asyncpg/issues/623 for reference
on why it's set up this way.
- See #7284 for the rationale behind adding
- self._exclude_type_codecs
-
"""
-
- if "json" not in self._exclude_type_codecs:
- try:
- await conn._connection.set_type_codec(
- "json",
- encoder=str.encode,
- decoder=_json_decoder,
- schema="pg_catalog",
- format="binary",
- )
- except ValueError:
- self._exclude_type_codecs |= {"json"}
-
- if "jsonb" not in self._exclude_type_codecs:
- try:
- await conn._connection.set_type_codec(
- "jsonb",
- encoder=_jsonb_encoder,
- decoder=_jsonb_decoder,
- schema="pg_catalog",
- format="binary",
- )
- except ValueError:
- self._exclude_type_codecs |= {"jsonb"}
+ await conn._connection.set_type_codec(
+ "json",
+ encoder=str.encode,
+ decoder=_json_decoder,
+ schema="pg_catalog",
+ format="binary",
+ )
+ await conn._connection.set_type_codec(
+ "jsonb",
+ encoder=_jsonb_encoder,
+ decoder=_jsonb_decoder,
+ schema="pg_catalog",
+ format="binary",
+ )
def connect(conn):
conn.await_(_setup_type_codecs(conn))