On Mar 17, 2007, at 11:39 AM, Simon King wrote:

>
> I had assumed that post_update was only necessary when you are
> inserting two rows that are mutually dependent, but in this case I
> wasn't inserting either a ReleaseLine or a Label. I suppose
> post_update can actually have a knock-on affect across the whole
> dependency graph.

Yes, you are correct.  I did the requisite three hours of staring and  
uncovered the actual condition that led to this problem, which is  
definitely a bug.

Because the second flush() did not require any update operation to  
either the ReleaseLine or the Label object, the "circular" dependency  
graph that would be generated for them just gets thrown away, but  
that also threw away a processor thats supposed to be setting the  
"release_line_id" column on your Branch table.  so the fix is, if the  
"circular" dependency graph doesnt get generated for a particular  
cycle between mappers, or if a particular mapper within the cycle  
isnt included in the "circular" dependency graph, make sure the flush  
task for that mapper still gets tacked on to the returned structure  
so that it can operate on other things external to the cycle, in this  
case your Branch.  the Branch is related to the ReleaseLine/Label via  
a many-to-one, which was not as stressed in the unit tests so its  
harder for this issue to pop up (also requires the two separate  
flushes...so very hard to anticipate this problem).

So you can take the post_update out and update to rev 2424.

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