11 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Multiple Foreign Key...
FromSent OnAttachments
Ali20 Feb 2007 09:01 
Michael Bayer20 Feb 2007 09:10 
Ali20 Feb 2007 09:12 
Ali20 Feb 2007 09:13 
Michael Bayer20 Feb 2007 10:04 
Ali20 Feb 2007 10:40 
Michael Bayer20 Feb 2007 13:04 
Ali20 Feb 2007 13:50 
Michael Bayer20 Feb 2007 15:47 
Ali21 Feb 2007 03:08 
Michael Bayer21 Feb 2007 07:48 
Subject:[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.
From:Michael Bayer (zzz@gmail.com)
Date:02/20/2007 09:10:37 AM
List:com.googlegroups.sqlalchemy

On Feb 20, 12:01 pm, "Ali" <aafs@gmail.com> wrote:

Here is my code (with other fields removed):

stockreceipt_table = Table('stockreceipt', meta, Column('user_id', Integer, ForeignKey('user.id')), # Cancellation Column('cancelled_user_id', Integer, ForeignKey('user.id')), )

class Receipt(object): """Stock Receipt"""

assign_mapper(ctx, Receipt, stockreceipt_table, properties=dict( user=relation(User, backref='receipts', primaryjoin=stockreceipt_table.c.user_id == users_table.c.id), cancelled_user=relation(User, backref='cancelled_receipts', lazy=False, primaryjoin=stockreceipt_table.c.cancelled_user_id == users_table.c.id), )

that cant be right, since theres no primary key expressed either in the stockreceipt_table or in your Receipt mapper.