graphene-sqlalchemy icon indicating copy to clipboard operation
graphene-sqlalchemy copied to clipboard

String ID

Open adrianschneider94 opened this issue 6 years ago • 2 comments

Not only ints should be converted to the ID type, but also strings. Especially as GraphQL itself considers IDs as strings.

@convert_sqlalchemy_type.register(types.String)
@convert_sqlalchemy_type.register(types.SmallInteger)
@convert_sqlalchemy_type.register(types.Integer)
def convert_column_to_int_or_id(type, column, registry=None):
    return ID if column.primary_key else String

adrianschneider94 avatar Sep 08 '19 22:09 adrianschneider94

I agree with this. I'm happy to revisit this when tacking https://github.com/graphql-python/graphene-sqlalchemy/issues/102. Feel free to share your opinion in the other thread if you want to help move this forward. Cheers

jnak avatar Sep 24 '19 00:09 jnak

Will try this out while testing graphene#1428

erikwrede avatar Jun 28 '22 14:06 erikwrede