graphql-python/graphene-sqlalchemy

Can a registered converter be shadowed to use a type other than a `graphene` type?

this-vidor opened this issue · 2 comments

For example, suppose a developer did not want sqlalchemy.dialects.postgres.HSTORE to be converted to graphene.types.json.JSONString. Is there a correct way to accomplish that?

The solution is to override the default type converter:

@convert_sqlalchemy_type.register(postgresql.HSTORE)
def convert_json_to_string(type, column, registry=None):
    return your_graphene_scalar

This needs to be called before your SQLAlchemyObjectTypes are initialized.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.