Re: [sqlalchemy] Reverse delete orphan?

2015-04-17 Thread Jonathan Gordon
On Tuesday, April 7, 2015 at 4:00:28 PM UTC-7, Michael Bayer wrote: > > 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

[sqlalchemy] Reverse delete orphan?

2015-04-07 Thread Jonathan Gordon
How can I cascade delete from a many to one only when deleting the many means this one has no other children? Imagine the following mapping: class Container(Base): __tablename__ = 'container' pk = sa.Column(sa.Integer, primary_key=True) entries = relationship('Entry', backref='c