I have a MSSQL server with two logical databases. (I inherited this situation, of course.) There is a table in each database and an association table in one of them. What is the right way to configure this? Here is what I have and it complains about the values in foreign_keys. I've tried a lot of permutations and can't seem to hit on the right one. Thanks much!
left_engine = create_engine(SERVER_A_DB_ONE) left_meta = MetaData() left_meta.bind = left_engine right_engine = create_engine(SERVER_A_DB_TWO) right_meta = MetaData() right_meta.bind = right_engine left_table = Table('LeftTable', left_meta, Column('id', Integer, primary_key=True), Column('description', String(128))) right_table = Table('RightTable', right_meta, Column('id', Integer, primary_key=True), Column('description', String(128))) assoc_table = Table('LeftAssoc', left_meta, Column('left_id', Integer), Column('right_id', Integer)) MySession = sessionmaker(binds={ left_table: left_engine, right_table: right_engine, assoc_table: left_engine }) class Left(object): pass class Right(object): pass mapper(Left, left_table) mapper(Right, right_table, properties={ 'lefts': relation(Left, secondary=assoc_table, primaryjoin=right_table.c.id==assoc_table.c.right_id, secondaryjoin=assoc_table.c.left_id==left_table.c.id, foreign_keys=[right_table.c.id, left_table.c.id], backref="rights"), }) - Luke --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---