On Mar 6, 2009, at 7:04 PM, Shawn Church wrote:

>
>
> On Fri, Mar 6, 2009 at 3:43 PM, Michael Bayer <[email protected] 
> > wrote:
>
>
> On Mar 6, 2009, at 6:14 PM, Shawn Church wrote:
>
> >
> > But setting the User.modified_by relation does not work:
> >
> >>>> user.modified_by = user
>
> the key here is that you're setting modified_by to the parent, which
> means you are creating a row that's dependent on itself.   This will
> work on UPDATE but not on INSERT.    there's an option called
>
> Isn't the example an update since the original user was committed? I  
> just ran the test with echo on and when I set the modified_by_id  
> attribute an UPDATE is generated but when I set modified_by no SQL  
> is generated (except for the commit).

uh yeah it is.   the sync of the primary key to the foreign key  
happens after the parent object is updated.   but the child is also  
the parent, so the flush completes without ever getting to the  
"child".   if you set post_update=True then it works.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to