Re: [sqlalchemy] Many-to-many cascade delete

2021-11-03 Thread Anders Buch
Thanks a lot, this is what I was hoping for! Anders On 11/2/21 9:33 PM, Mike Bayer wrote: The answers regarding "cascade" are correct, however this question has been asked a few times before and we have a recipe on the W

Re: [sqlalchemy] Many-to-many cascade delete

2021-11-02 Thread Mike Bayer
The answers regarding "cascade" are correct, however this question has been asked a few times before and we have a recipe on the Wiki that discusses this problem and presents an ORM event oriented solution, which is at https://github.com/sqlalchemy/sqlalchemy/wiki/ManyToManyOrphan , which I put

Re: [sqlalchemy] Many-to-many cascade delete

2021-11-02 Thread Richard Damon
Fundamentally the cascade applies to doing something to the 'many' side when something happens on the 'one' side. A many-to-many association can't do this sort of things, and in fact, you can't just 'create' a many-to-many relationship in a relational database. To implement a many-to-many rela

[sqlalchemy] Many-to-many cascade delete

2021-11-02 Thread Anders Buch
Hello All, Suppose I have a table of people, a table of secrets, and a many-to-many association table between them. A person can exist without knowing any secrets, but a secret without any associated people might as well be deleted. My reading of the documentation is that it is not possible to