Never mind, the hybrid_property was needed not declared_attr.  My bad.

On Thursday, 29 October 2015 11:46:32 UTC-7, drMental wrote:
>
> How do I get this use case working?  I want the ticker attribute to 
> retrieve the values from the value defined in the Enum column.
>
>
> class Security(Base):
>     cusip = Column(String)
>     sedol = Column(String)
>     isin = Column(String)
>     symbol = Column(String)
>
>     _ticker = Column(Enum('cusip', 'sedol', 'isin', 'symbol', 
> name='default_ticker'), default='symbol')
>
>     @declared_attr
>     def ticker(self):
>         return getattr(self, self._ticker)
>
> TypeError: getattr(): attribute name must be string
>
>
> Many thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to