class HierarchicModelTest(unittest.TestCase):

    def test_delete_parent_object(self):
        foo = Foo(**foo_data).save()
self.assertEqual(Foo.query.count(), 1)
self.assertEqual(FooCycle.query.count(), 1)
s = get_session()
s.delete(foo)
s.flush()
self.assertEqual(Foo.query.count(), 0)
self.assertEqual(FooCycle.query.count(), 0)
Dependency rule tried to blank out primary key in SQLAlchemy, when foreign key constraint is part of composite primary key