How to use relationships in sqlalchemy?

Learn flask and sqlalchemy.
Took the example from the documentation:
class Parent(Base):
 __tablename__ = 'parent'
 id = Column(Integer, primary_key=True)
 children = relationship("Child", backref="parent")

class Child(Base):
 __tablename__ = 'child'
 id = Column(Integer, primary_key=True)
 parent_id = Column(Integer, ForeignKey('parent.id'))


To the end is not panimaju the meaning of the design:
children = relationship("Child", backref="parent")
What are her tasks? How to use in queries?
How is it necessary if you specify ForeignKey('parent.id')?

I find it difficult to navigate in the documentation of sqlalchemy, I will be glad to links to examples of the use of relations.
September 19th 19 at 12:14
2 answers
September 19th 19 at 12:16
This realization relationship is 1 to many, 1 parent, there are a shitload of kids, the latest strecke all the children which that parent is referenced from the database to empty
In General, it became clear. But I have another question arose, why you want to join, they can replace the relationship and get similar functionality without specifying the relationship? Or join and relations complement each other? - Lourdes_Jones commented on September 19th 19 at 12:19
September 19th 19 at 12:18
In General figured out. Don't know if I'm right. My vision is this.
The relationship is a more objective approach. When using the relationship is added to the table "how-to" field which is an iterable object (like a list) of values from the second table corresponding to a primary key from the first table.
join more like a SQL statement, it glues the two tables on the primary key of the first table and its value from the second. And work with the resulting table. In this case, it is possible to do entirely without a relationship.

Find more questions by tags Flask