title: Flask/SQLAlchemy - Difference between association model and association table for many-to-many relationship?
body: <p>I started learning this stuff from the Flask Mega Tutorial. When he gets into Many-to-Many relationships, he creates an association table like this:</p>
  
  <pre><code>followers = db.Table('followers',
      db.Column('follower_id', db.Integer, db.ForeignKey('user.id')),
      db.Column('followed_id', db.Integer, db.ForeignKey('user.id'))
  )
  </code></pre>
  
  <p>As I was searching for ways to add some metadata regarding a specific association between models, I found that you can store this kinda thing in the association table.. However the example of this I've found seems to make the association table an actual model.</p>
  
  <pre><code>class DepartmentEmployeeLink(Base):
      __tablename__ = 'department_employee_link'
      department_id = Column(Integer, ForeignKey('department.id'), primary_key=True)
      employee_id = Column(Integer, ForeignKey('employee.id'), primary_key=True)
      extra_data = Column(String(256))
      department = relationship(Department, backref=backref("employee_assoc"))
      employee = relationship(Employee, backref=backref("department_assoc"))
  </code></pre>
  
  <p>What is the difference between these two methods? Is the model method required to store metadata in the association table or can the same thing be accomplished with the top method?</p>
  
  <p>Thanks!</p>