While there is a limited form of "many-to-one cascade" supported, it
requires that Tag is only linked to a single Entry, which I'm
gathering is not the case here.
Typically events are used to intercept when a flush occurs so that
additional steps can be taken to delete the extra objects.
One event approach would be the before_flush() event, you search
through session.deleted for all Container objects; within Container,
locate all Tag entries with that Container as the ultimate parent
and mark them all as deleted as well. With the before_flush()
approach, you can use the Session and your objects in the usual way.
Another event approach would be to use the before_delete event on
the Container mapping. When the Container row is marked for
deletion, perform a Core level DELETE on the given connection that
deletes all Tag rows from the "tag" table. With the
before_delete() approach, the event occurs deep within the flush
process, so it's not safe to manipulate the state of the Session;
instead, you emit SQL directly on the given connection.
Still a third approach is to run a simple query at the end of the
flush, where you search for Tag objects that have no Entry objects
associated, and delete them. I came up with that for this
stackoverflow answer:
http://stackoverflow.com/questions/9234082/setting-delete-orphan-on-sqlalchemy-relationship-causes-assertionerror-this-att/9264556#9264556.
You can probably just adapt that one.