Let's say I have a generic Food
sqlalchemy model that I want to reuse for different apps.
In each app, I have a FoodType
enum which contains the different types of food I'll use.
I want to be able to pass this app-specific Enum to my generic model. Any idea on how to do that?
Here is my food model:
class Food(Base):
type = Column(Enum(FoodType, name="l=food_type"))
I tried to define an empty enum in my generic model so that it could be overwritten in each app but that apparently doesn't work, it crashes on:
sqlalchemy.exc.StatementError: (builtins.LookupError) "PIZZA" is not among the defined enum values