db.relationship
Provides and configures a mapped relationship between two models.
- SQLAlchemy configures the settings between model relationships once, and generates JOIN statements for us whenever we need them.
- db.relationship is an interface offered in SQLAlchemy to provide and configure a mapped relationship between two models.
- db.relationship is defined on the parent model, and it sets:
- the name of its children (e.g. children), for example parent1.children
- the name of a parent on a child using the backref, for example child1.my_amazing_parent