Concept FAQs
Contributors: Alanna Zhou
backref vs. back_populates vs. none of these
using neither backref nor back_populates
backref nor back_populatesclass Parent(Base):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
children = relationship("Child")
class Child(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent.id'))
parent = relationship("Parent")using back_populates
back_populatesusing backref
backrefLast updated
Was this helpful?