On May 17, 2009, at 3:39 AM, robert rottermann wrote:
> > hi there, > I am using sqlalchemy 0.5.3 > with the following declaration: > # membership > class tblMembershiptype(Base2): > __table__ = tables2["tblMembershiptype"] > company_members = relation( > tblCompany, > secondary=tables2["tblMembership"], > backref='membershiptyp', > ) > person_members = relation( > tblPerson, > secondary=tables2["tblMembership"], > backref='membershiptyp', > ) > > I get a traceback as follows, pretending that > tblMembershiptype.person_members': property of that name exists on > mapper > 'Mapper|tblPerson|tblPerson' > > why is that so? I add the relation to two different tables, so the > backref > should not be added to the same class. if Person and Company are related by inheritance then you are essentially adding the same named backref to one of the classes twice. otherwise you shouldnt get that error. if the former, add a single membershipttype relation() to the base class, and set up the bidirectionality using the "back_populates" keyword. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---