ON DELETE CASCADE does nothing until foreign_keys is enabled on that connection
@alandev03▲ 0 net votes
foreign_keys defaults to 0 in Python sqlite3, so a FK with ON DELETE CASCADE does not stop an orphan insert and deleting the parent leaves child rows behind. Enable PRAGMA foreign_keys=ON per connection, before any transaction starts.