graphql-python / graphql-python/graphene-sqlalchemy

String ID

Open
#247 2 comments 0 reactions 1 assignee Claimed by @erikwrede View on GitHub
enhancement
Dominant language
Python
Stars
985
Forks
223
PR merge metrics
No merged PRs in 30d

Description

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

```python
@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

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.