-
Notifications
You must be signed in to change notification settings - Fork 435
How do I encode/decode my type with conn.set_type_codec? #1240
Unanswered
tamis-laan
asked this question in
Q&A
-
I have the following type:
CREATE TYPE REC_CONTENT AS ( id TEXT, filename TEXT, mimetype TEXT, extract JSONB );
This is my current attempt:
await conn.set_type_codec( 'rec_content', encoder=lambda x: (x['id'], x['filename'], x['mimetype'], json.dumps(x['extract'])), decoder=lambda t: {'id': t[0], 'filename': t[1], 'mimetype': t[2], 'extract': json.loads(t[3])}, format='tuple' )
But I get back the error:
asyncpg.exceptions._base.UnsupportedClientFeatureError: cannot decode type "public"."rec_content": text encoding of composite types is not supported
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment