Quick tip if you get in trouble with a foreign key dependency even if you have specified a cascade delete in your models.
Using SQLAlchemy, to specify a cascade delete you should have cascade='all, delete'
on your parent table.
Ok but then when you execute something like:
It actually triggers an error about a foreign key used in your children tables.
The solution I used it to query the object and then delete it:
This should delete your parent record AND all the children associated with it.