Christoph Zwerschke wrote: > > Michael Bayer schrieb: >> I had the idea that since "a1" appears to be in the collections of both >> u1 >> and u2, it would be arbitrary where "a1" ended up after the flush >> completed. But that is likely wrong, in that the flush() is going to >> look >> at change events to determine what state changes to persist to the >> database. I'm not sure if there's a more complex series of moves >> between >> u1 and u2 which would make predicting the final destination of "a1" >> difficult, though. > > I still don't really understand why/how a flush operation would change > the .addresses attribute of any object as a side effect. Maybe I just > understand SA's unit-of-work implementation not good enough.
meaning, the foreign key "user_id" on the "address" row would be populated with either u1's id, or u2's id, and sent to the database as an UPDATE. when the session's contents are expired and/or reloaded, the new relationship of a1 to either u1 or u2 would be expressed. So u1.addresses would not change until reloaded. > > -- Christoph > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
