I have the following setup: (relevant excerpts only) contacts = Table('contacts', meta, Column('id', Integer, primary_key=True), Column('display_as', String(75)), Column('title', String(5)), Column('first_name', String(25)), Column('middle_name', String(25)), Column('last_name', String(25)), Column('suffix', String(5)), Column('job_title', String(50)), Column('department', String(50)), Column('company', String(50)), Column('gender', String(1)), Column('website', String(100)), Column('notes', Text), Column('active', Boolean), Column('account_id', Integer), Column('time_zone_id', Integer), Column('created_at', DateTime), Column('updated_at', DateTime), Column('created_by', Integer), Column('updated_by', Integer), ForeignKeyConstraint(['account_id'], ['accounts.id']), ForeignKeyConstraint(['time_zone_id'], ['time_zones.id']), ForeignKeyConstraint(['created_by'], ['contacts.id']), ForeignKeyConstraint(['updated_by'], ['contacts.id']) )
payment_methods = Table('payment_methods', meta, Column('id', Integer, primary_key=True), Column('contact_id', Integer), Column('payment_method_type_id', Integer), Column('created_at', DateTime), Column('updated_at', DateTime), Column('created_by', Integer), Column('updated_by', Integer), ForeignKeyConstraint(['contact_id'],['contacts.id']), ForeignKeyConstraint(['payment_method_type_id'], ['payment_method_types.id']), ForeignKeyConstraint(['created_by'],['contacts.id']), ForeignKeyConstraint(['updated_by'],['contacts.id']), ) class Contact(object): pass class PaymentMethod(object): pass mapper(Contact, contacts, extension=HistoryMapperExtension(), properties={ 'payment_methods': relation(PaymentMethod, backref='contact', primaryjoin=payment_methods.c.contact_id, _local_remote_pairs=[(contacts.c.id, payment_methods.c.contact_id)], foreign_keys=[payment_methods.c.contact_id], backref='contact') }) mapper(PaymentMethod, payment_methods) A series of exceptions led me to add the primaryjoin, then foreign_keys, then _local_remote_pairs options. Once all three were in place I then received another ArgumentError exception advising I specify a foreign_keys option. Full exception text: ArgumentError: Could not determine relation direction for primaryjoin condition 'payment_methods.contact_id', on relation PaymentMethod.contact (Contact). Specify the foreign_keys argument to indicate which columns on the relation are foreign. Any help would be appreciated. -brad --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---