On page 23 of the 0.9.7 (Section 2.1.10, Building A Relationship) I see the example:
class Address(Base): __tablename__ = 'addresses' id = Column(Integer, primary_key=True) email_address = Column(String, nullable=False) user_id = Column(Integer, ForeignKey('users.id')) user = relationship("User", backref=backref('addresses', order_by=id)) The last line is in the child table (with the foreign key) and the backref() statement has the child table name and an order_by option) Why is backref written twice, and why is the parent table (user/User) mentioned twice? Or, is 'user' a column in the addresses table? On page 89 (Section 2.3.3, Linking Relationships With Backref) I see a different example: class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True) name = Column(String) addresses = relationship("Address", backref="user") class Address(Base): __tablename__ = 'address' id = Column(Integer, primary_key=True) email = Column(String) user_id = Column(Integer, ForeignKey('user.id')) Here, the relationship() statement is in the parent table and it specifies the child class "Address" with backref mentioned once to the parent table "user". These two examples appear different to me. If no one can clear up my confusion I'll wait for Mike to return from vacation to be straightened out on how to define referencial integrity. Thanks, Rich -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.