On Jan 17, 2008, at 7:36 PM, Rick Morrison wrote:

> two clarifications: in my case the relation cascade is 'all, delete- 
> orphan'. But in the case I'm running into, all of the children are  
> unpersisted before the flush.
>
> and the exception I get is not a complaint about an orphan, it's a  
> database error when SA tries to persist the (typ='a') item, but does  
> not populate it's parent id.
>

do your setProp() operation, then do this:

(added, unchanged, deleted) = MyClass.props.get_history(myobject)

to see whats actually in there.  it should just be a collection of  
"added" objects (and also, the correct objects).

Then, use echo_uow=True on your session to see the flush plan.   
everything in the flush plan should also be in an "added" collection  
somewhere.  also look inside of session.new, see if all the correct  
stuff is in there too.

Objects which get removed from the collection due to your operation  
should be raising an "orphan" error right now, since theyre in the  
session but have no parent....seems like thats what your FK error is  
but its unusual that the orphan detection wouldn't be working.


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