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).

 In any case, I suppose the simplest solution is just to assign to the
modified_by_id attribute.  Because of the way my application is designed I
probably am assigning by id and not the actual user object --- I will have
to change some of my unit tests though.


Thanks once again for your help (and quick reply)

Shawn

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