diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/asyncpg.py | 43 |
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)) |