I'm having trouble inheriting a synonym property from a mixin class. It obviously works if the call to synonym() is on the child class and just the get/set methods are left on the mixin. Here is an example:
from sqlalchemy import create_engine, Column, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker, synonym from sqlalchemy.types import Integer, String engine = create_engine('sqlite:///:memory:', echo=True) Base = declarative_base(bind=engine) Session = scoped_session(sessionmaker(bind=engine)) class WithAge(object): _age = Column('age', Integer) def _get_age(self): return self._age or -1 def _set_age(self, age): self._age = age # Doesn't work age = synonym('_age', descriptor=property(_get_age, _set_age)) class Person(Base, WithAge): __tablename__ = 'people' name = Column(String, primary_key=True) # Works #age = synonym('_age', descriptor=property(WithAge._get_age, WithAge._set_age)) p = Person() print p.age # <sqlalchemy.orm.properties.SynonymProperty object at ...> -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.