title: Flask SQLAlchemy order_by relationship
body: <p>I'm working with a Flask application where I have a LargeGroupAttendance model that references another model called Attendee.  I'm trying to request all of the LargeGroupAttendance objects that match a certain criteria, but I'm trying to sort them by a column of the Attendee model - is that even possible? Here are the two models below:</p>
  
  <pre><code>""" Attendeee Class """
  class Attendee(Base):
      __tablename__ = 'attendee'
  
      id = Column(Integer, primary_key=True)
      first_name = Column(String(200))
      last_name = Column(String(200))
      year = Column(String(200))
      email = Column(String(100), unique=True)
      dorm = Column(String(100))
  
      def __init__(self, first_name, last_name, year, email, dorm):
          self.first_name = first_name
          self.last_name = last_name
          self.year = year
          self.email = email
          self.dorm = dorm
  
      def __repr__(self):
          return '&lt;Attendee %r&gt;' % self.first_name
  
  """ Large Group Attendance Class """
  class LargeGroupAttendance(Base):
      __tablename__ = 'large_group_attendance'
  
      id = Column(Integer, primary_key=True)
      first_time = Column(Integer)
  
      large_group_id = Column(Integer, ForeignKey('large_group.id'))
      large_group = relationship("LargeGroup", backref=backref('large_group_attendance', order_by=id))
  
      attendee_id = Column(Integer, ForeignKey('attendee.id'))
      attendee = relationship("Attendee", backref=backref('large_group_attendance', order_by=id))
  </code></pre>
  
  <p>Do I need to add something to my attendee class to make this possible? And here's a query I've tried before, but it's had no output (no errors either..). Where am I going wrong?</p>
  
  <pre><code>    attendance_records = db.session.query(LargeGroupAttendance).filter_by(large_group_id=event_id).order_by(desc(LargeGroupAttendance.attendee.first_name)) 
  </code></pre>