Skip to content

Serializing native Python enums does not work #152

Description

@wichert

Currently using SQL enums works well, unless you use a enum.Enum as base for the enum. For example using this model:

class Hairkind(enum.Enum):
    LONG = 'long'
    SHORT = 'short'

class Pet(Base):
    __tablename__ = 'pets'
    id = Column(Integer(), primary_key=True)
    hair_kind = Column(Enum(Hairkind, name='hair_kind'), nullable=False)

will fail badly if you try to query the hairKind field:

  File "lib/python3.7/site-packages/graphql/execution/executor.py", line 622, in complete_leaf_value
    path=path,
graphql.error.base.GraphQLError: Expected a value of type "hair_kind" but received: Hairkind.LONG

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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