views:

76

answers:

1

how do i do enumeration in sqlachemy? im using pylons if it matters. i also want to have in code to create different object depends on the enumeration, with the same parameters, but different object class.

+1  A: 

SQLAlchemy 0.6 has generic Enum column type, earlier versions have vendor specific types for some database drivers. And sure, you can use Integer.

Initializing different classes based based on column value is easy. What you need for this particular case is single table inheritance.

Denis Otkidach