Hi,
I use in my database tables, that reference other tables, e.g. table A -> 
table B. In my deletion routine, I want to prohibit people to delete rows 
from A, which have references to B.

How would I do that?

My first approach was to rely on the databases referential integrity and catch 
related dabases errors, however, SQLAlchemy works around these references, as 
due to the "cascade = all" rule in the mapper, the rows of table "B" are 
simply deleted before.

On the other hand, I can't simply omit "cascade=all", as I need this for 
object creation. "passive_deletes", "delete_orphan" and the like are also no 
solution.

What I currently do is to manually check for related objects and raise an 
error if I find one, but I estimate that there will be some SQLAlchemy trick 
that does that for me?

Best Regards,
Hermann

-- 
herm...@qwer.tk
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7

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