On Nov 1, 2011, at 6:48 AM, Michael Naber wrote:

> Quick question: Why am I allowed to persist an address with no person_id? 
> Shouldn't the delete-orphan prohibit this?

This was the behavior up until 0.7, when the decision was reversed - 
delete-orphan now considers an "orphan" to be only an object that *had* a 
parent, now does not.   To prevent the insertion of a row that has no parent to 
start with you'd use a NOT NULL constraint on the foreign key.    

The improvement here allows delete-orphan cascade to be used on hierarchical 
structures where the "root" row has no parent.   No functionality is lost for 
systems where parents are required as that's what constraints are for.

Notes:  
http://www.sqlalchemy.org/trac/wiki/07Migration#Flushingoforphansthathavenoparentisallowed

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to