The values are in there as "Calc.choose.property.columns[0].type_.enums".  But 
this isn't how you'd want to go about this, you want to make your particular 
enum here a Python type you can work with, something simple might be:

choose_type = set(['min', 'max', 'avg'])

class Calc(...):
   ...
   choose = Column(Enum(*choose_type))

that's a quick version.  for the real enum pattern that I use, see 
http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/




On Aug 1, 2012, at 4:04 AM, jeetu wrote:

> I have a table Calc. I have an Enum type "choose" in it. In some other part 
> of the code, I wan to have the possible values of this Enum type. How I can 
> achieve this?
> 
> # Present Calc class in Calc.py file
> class Calc(DeclarativeBase):
>      __tablename__= calcs
>      id =  Column(Integer, primary_key=True)
>      choose = Column(Enum('min', 'max', 'avg')
> 
> # Desired in some other file
> import Calc
> for choice in Calc.choose: print choices # I want something like this to 
> iterate over options of 'choose' in 'Calc'.
> 
> PS: I am using turbogears 2.2rc2
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/mF1ZWU6RFEAJ.
> 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.

-- 
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.

Reply via email to