graphene icon indicating copy to clipboard operation
graphene copied to clipboard

Is it necessary to prevent a datasclass field name from being a Python keyword?

Open paulfelix opened this issue 4 years ago • 1 comments

I ran into this error when dynamically creating an dataclass:

"Field names must not be keywords: {name!r}" https://github.com/graphql-python/graphene/blob/master/graphene/pyutils/dataclasses.py#L1196-L1197

The field names come from a defined external dataset, and one field name happens to be a Python keyword, but I don't think that causes any harm.

paulfelix avatar Jul 14 '21 12:07 paulfelix

I just ran into this one too. My application generates a GraphQL API from a database schema, and one of the database tables I'm trying to work with has a column called if.

simonw avatar Nov 17 '21 17:11 simonw