On Nov 13, 2011, at 11:51 PM, espresso maker wrote: > Here are few columns that I am not sure how to represent their data in > the database. > > Columns like 'status' in account indicating the account status. > > Columns like 'type' indicating the account type 'business', > individual', 'reseller'. > > Granted I can normalize them and create tables for each. but I'd like > to avoid Session.query(AccountType).filter_by(type='business') when > assigning a type to an account for example. > > I can use polymorphic discriminator but in most cases I don't need it. > > > Any suggestions?
I use enums for this, following the rationale + recipe at http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/ -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.