DEV Community


Discussion on: SQLAlchemy Cascading Deletes

lefnire profile image
Tyler Renelle

So just the two, right?

artist_id = Column(Integer, ForeignKey("", ondelete="cascade"))
songs = relationship("Song", cascade="all, delete", passive_deletes=True)

with passive_deletes=True set, do you need cascade="all, delete"? It sounds like passive_deletes says "skip doing what I do, defer to DB", so my impression is we can remove cascades?