Hi,

I'm using the following table (shortened, removed unnecessary columns)
to store a menu tree.

class MenuNode(Base):
    __tablename__ = 'menu'
    id = Column(Integer, primary_key=True, nullable=False,
unique=True)
    parent_id = Column(Integer, ForeignKey('menu.id',
onupdate='CASCADE', ondelete='CASCADE'), nullable=True, index=True)
    name = Column(String(64), nullable=False)

    parent = relationship('MenuNode', remote_side='MenuNode.id',
cascade='all, delete', passive_deletes=True,
backref=backref('children', order_by=position))

Top-level menu nodes have parent_id=NULL.
When deleting a node via session.delete(node) sqlalchemy issues UPDATE
statements to set all children's parent_id fields to NULL instead of
deleting the children.
How can i tell SA that I want to delete any children?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to