Open OndrejZapletal opened 5 years ago
Composite types are normally handled automatically, since their (binary) structure is well defined. The issue in this case is that AgensGraph chose to put their extension types into the standard Postgres type namespace, and asyncpg expects to have explicit codecs for all such types. The fix here would be to handle "standard" composite types like all other composites.
Thanks for the response. Could you elaborate a little. You mean fix for asyncpg
? Or is there something I can do on my end instead. I would like to know if I can run into some problems in the future when I've decided to circumvent the asyncpg
limit of codec addition for composite types?
To clarify: this can be fixed in asyncpg.
To clarify: this can be fixed in asyncpg.
Is there a plan in place at the moment ?
Any updates or workarounds on this?
I'm trying to use
asyncpg
for communication with AgensGraph. It is graph database build on top of PostgreSQL 10.4.Bitnine
provides client agensgraph-python for it, but is built on top of psycopg2 and therefore dosn't supportasync
. I've tried to simply useasyncpg
instead with following simple example:got following exception:
I've looked at agensgraph-python implementation and it seems fairly straight forward. It simply adds new types [GRAPHID, VERTEX, EDGE, GRAPHPATH]. Like this:
https://github.com/bitnine-oss/agensgraph-python/blob/e6b9fedfda81e28a46ac9dcf8b8e562ca1b1119d/agensgraph/__init__.py#L26-L42
I've tried to use set_type_codec to define those, but I've come across this error:
https://github.com/MagicStack/asyncpg/blob/9d8a1c03597970f231da67415c6465776adc03b7/asyncpg/connection.py#L968-L971
My question is why it isn't allowed to add codecs for composite types?
I've overcame this problem temporarily by patching
set_type_codec
in following way:This seems to work for me so far, but I'm not sure if I won't come across some additional issues due to this in the future.