Greetings Alchemists, I want to define a column that will only accept a handful of possible values. Sure enough, I can to that with a check constraint or with a lookup table an a foreign key. However, for some reason, I really like the semantic of an enum column. That is, I like to read a definition that looks like that:
class Order(DeclarativeBase): __tablename__ = 'order' id = Column(Integer, primary_key=True) code = Column(Enum('CMTP'), nullable=False, default='C') # ... There is the low level MySQL enum type and there is a somewhat dated recipe on the wiki: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Enum Is there another way to do it? Something that would be portable and to both MySQL and Postgres would be great. Regards, -- Yannick Gingras http://ygingras.net
signature.asc
Description: This is a digitally signed message part.