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

> Hi,
> 
> I have a similar prolem as described in 
> https://groups.google.com/forum/#!topic/sqlalchemy/OLeCERDZxyk
> 
> I am using the secondary attribute to define the many-to-many relationship 
> between User and Groups.
> 
> Now i want prevent to delete a group if a user is still in the group. Setting 
> the Foreign-Key to "nullable=False" as advised in the post above does not 
> work for me on SQLAlchemy level. It does work when trying to delete the Group 
> directly in Postgres (Error ist raised). I am using no cascading deletes in 
> the relation definition.

when you say “prevent”, do you mean, session.delete() will silently do nothing, 
or that an error is raised (or how exactly are these deletes originating)?  If 
the database is set up with constraints as you describe, then it would raise 
constraint violations.   Or are you looking for some error message to be raised 
sooner?


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