flâneur — a map of the web's best reading

Cascades — SQLAlchemy 2.0 Documentation

docs.sqlalchemy.org · 5,048 words · saved by 1 readers

Mappers support the concept of configurable cascade behavior on relationship() constructs. This refers to how operations performed on a “parent” object relative to a particular Session should be propagated to items referred to by that relationship (e.g. “child” objects), and is affected by the relationship.cascade option. The default behavior of cascade is limited to cascades of the so-called save-update and merge settings. The typical “alternative” setting for cascade is to add the delete and delete-orphan options; these settings are appropriate for related objects which only exist as long as they are attached to their parent, and are otherwise deleted. Cascade behavior is configured using the relationship.cascade option on relationship(): To set cascades on a backref, the same flag can be used with the backref() function, which ultimately feeds its arguments back into relationship(): The Origins of Cascade SQLAlchemy’s notion of cascading behavior on relationships, as well as the opt

Cascades - SQLAlchemy 2.0 Documentation via SQLAlchemy adapter --> Release: 2.0.51 current release | Release Date: June 15, 2026 SQLAlchemy 2.0 Documentation SQLAlchemy 2.0 Documentation current release Home | Download this Documentation Search terms: SQLAlchemy ORM ORM Quick Start ORM Mapped Class Configuration Relationship Configuration ORM Querying Guide Using the Session Session Basics State Management Cascades ¶ save-update Behavior of save-update cascade with bi-directional relationships delete Using delete cascade with many-to-many relationships Using foreign key ON DELETE cascade with

Explore this link on the map →

related reading