title: When do I need to use sqlalchemy back_populates?
body: <p>When I try SQLAlchemy Relation Example following this guide: <a href="http://docs.sqlalchemy.org/en/rel_1_0/orm/basic_relationships.html#one-to-many" rel="noreferrer">Basic Relationship Patterns</a></p>
  
  <p>I have this code</p>
  
  <pre><code>#!/usr/bin/env python
  # encoding: utf-8
  from sqlalchemy import create_engine
  from sqlalchemy import Table, Column, Integer, ForeignKey
  from sqlalchemy.orm import relationship, sessionmaker
  from sqlalchemy.ext.declarative import declarative_base
  
  engine = create_engine('sqlite:///:memory:', echo=True)
  Session = sessionmaker(bind=engine)
  session = Session()
  Base = declarative_base(bind=engine)
  
  class 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")
  
  Base.metadata.create_all()
  
  p = Parent()
  session.add(p)
  session.commit()
  c = Child(parent_id=p.id)
  session.add(c)
  session.commit()
  print "children: {}".format(p.children[0].id)
  print "parent: {}".format(c.parent.id)
  </code></pre>
  
  <p>It works well, but in the guide, it says the model should be:</p>
  
  <pre><code>class Parent(Base):
      __tablename__ = 'parent'
      id = Column(Integer, primary_key=True)
      **children = relationship("Child", back_populates="parent")**
  
  class Child(Base):
      __tablename__ = 'child'
      id = Column(Integer, primary_key=True)
      parent_id = Column(Integer, ForeignKey('parent.id'))
      **parent = relationship("Parent", back_populates="children")**
  </code></pre>
  
  <p>Why don't I need <code>back_populates</code> or <code>backref</code> in my example?  When should I use one or the other?</p>