the "cancelled_user" may not have been lazy loaded before you flush() ed.
On Feb 21, 2007, at 6:09 AM, Ali wrote: > > 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 <[EMAIL PROTECTED]> 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_idattributeonmyinstanceto7butthefooattributeisstillNon >> esh >> ouldntithaveloadedFoowithid7 > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
