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:Ali (aafs@gmail.com)
Date:02/21/2007 03:08:48 AM
List:com.googlegroups.sqlalchemy

Excellent, that (expire, refresh) works. Thank-you very much.

Is there a reason why it sometimes works?

On Feb 20, 11:47 pm, Michael Bayer <mike@zzzcomputing.com> wrote:

On Feb 20, 2007, at 12:01 PM, Ali wrote:

u = User(name='Ali') u.flush() r = Receipt(user_id=u.id) r.flush() r.user is u True r.cancelled_user_id = u.id r.flush() r.cancelled_user is u

True

oh sorry, i missed this one. when you say "r.cancelled_user_id = u.id", that will send the right SQL to the database but isnt going to change the "r.cancelled_user" property to anything unless you refresh ()/expire() the Receipt object.

references:

http://www.sqlalchemy.org/docs/ unitofwork.myt#unitofwork_api_flush_whatishttp://www.sqlalchemy.org/trac/wiki/ FAQ#Isetthefoo_idattributeonmyinstanceto7butthefooattributeisstillNonesh ouldntithaveloadedFoowithid7