Skip to content

Enum ChoiceType column results in error #196

Open
@thejcannon

Description

@thejcannon

Howdy folks!

The following code produces TypeError: 'MyEnum' object is not iterable, but should work. Note that this is also involves package sqlalchemy_utils

from enum import Enum

class MyEnum(Enum):
   foo = 1
   bar = 2

class MyModel(Base):
    id = Column(sa.Integer, primary_key=True)
    name = Column(sa.Unicode(255))
    type = Column(ChoiceType(MyEnum, impl=Integer()))

class MyObject(SQLAlchemyObjectType):
    class Meta:
        model = MyModel

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions