Hi. I'm trying to relate two tables with a one to many relationship (the parent table has a composite primary key) but I'm getting a mapper error. I found a recent message about this same problem but with declarative base (which I don't use) and not sure why the suggestion there didn't apply to my problem.
Find below the error and the table creation code. TIA, Mariano Error: ArgumentError: Could not locate any equated, locally mapped column pairs for primaryjoin condition 'regevent.id = regevent_who.regevent_id AND regevent.author = regevent_who.regevent_author' on relationship RegEvent.who. For more relaxed rules on join conditions, the relationship may be marked as viewonly=True. Code: regevent = Table('regevent', metadata, Column('id', Unicode(200), primary_key=True), Column('author', Unicode(200), primary_key=True), Column('since', DateTime), Column('until', DateTime), Column('title', Unicode(100)), Column('content', Unicode(600)), Column('status', Unicode(200)), Column('published', DateTime), useexisting=True) Index('regevent_cal_ix', *(regevent.c.calname,)) class RegEvent(object): pass regevent_who = Table('regevent_who', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('regevent_id', Unicode(200)), Column('regevent_author', Unicode(200)), Column('email', Unicode(200)), Column('status', Unicode(200)), Column('role', Unicode(200)), ForeignKeyConstraint(("regevent_id", "regevent_author"), ("regevent.id", "regevent.author"), "regevent_fk"), useexisting=True) Index("regevent_who_fk_ix", *(regevent_who.c.regevent_id, regevent_who.c.regevent_author)) class RegEventWho(object): pass mapper(RegEvent, regevent_who, properties={ 'who': relationship(RegEventWho, primaryjoin=and_( regevent.c.id==regevent_who.c.regevent_id, regevent.c.author==regevent_who.c.regevent_author)) }) mapper(RegEventWho, regevent_who) -- 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.