Ticket #491 (closed defect: fixed)
Support for SQLAlchemy synonym properties
| Reported by: | nick | Owned by: | nick |
|---|---|---|---|
| Priority: | major | Milestone: | 0.4.2 |
| Component: | Adapter | Version: | 0.4.1 |
| Keywords: | sqlalchemy | Cc: | |
| Fixed in revision: | Branch: | pyamf/branches/sqlalchemy-properties-491 | |
| Author: | nick |
Description (last modified by nick) (diff)
See the mailing list for reference.
class Contact(Base): __tablename__ = "org_contacts" id = Column(Integer, primary_key = True) short_name = Column(Unicode(20), index = True) first_name = Column(Unicode(50)) last_name = Column(Unicode(50)) email_address = Column(Unicode(50)) notes = Column(UnicodeText) organization_id = Column(Integer, ForeignKey("org_organizations.id")) modified = Column(DateTime, default=datetime.now, onupdate = datetime.now) modified_by_id = Column(Integer, ForeignKey("app_users.id")) inactive = Column(Boolean, default=False) organization = relation("Organization", lazy = False) phones = relation("Phone", lazy = True) modified_by = relation("User", lazy = False) # This is what I want to do: ## @synonym_for("short_name") ## @property ## def display_name(self): ## inact = "*" if self.inactive else "" ## return inact + self.short_name ## # This works but is harder to do: display_name = column_property( (case([(inactive, u"*")], else_ = u"") + short_name ).label("display_name"))
Change History
Note: See
TracTickets for help on using
tickets.


