Torsten Irländer <torsten.irlaen...@googlemail.com> wrote:

> 
> Nothing is wrong with the IntegrityException if this Exception is actually 
> raised :) That is currently my problem: I except such an exception but it 
> isn't raised. Instead the group is deleted (including all entries for this 
> group in the secondary table) although still having users referencing the 
> group. 

I made an answer for something like this over here: 
http://stackoverflow.com/questions/9234082/setting-delete-orphan-on-sqlalchemy-relationship-causes-assertionerror-this-att/9264556#9264556,
  over there they wanted the equivalent of User to be deleted if all the Groups 
are.     There’s no integrity constraint applicable to an association table so 
you’d need to catch this in Python.    If these are Session.delete() 
operations, then you’d need to check the object and assert that its user 
collection is empty within a before_flush() event.




> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to