Skip to content

Add equivalent to psycopg2 register_adapter  #1186

Open
@dgilman-hrp

Description

@dgilman-hrp

In psycopg2, register_adapter along with utility functions provides a useful way to map custom Python classes into valid representations, often by relatively simple behaviors such as casting to str. There is no equivalent in asyncpg meaning moving from psycopg2 to asyncpg requires adding lots of str() casts to add and select queries.

The closest equivalent is set_type_codec but this only works for types that are registered with Postgres, not custom Python classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions