title: SQL Alchemy Join Multiple Columns from same table
body: <pre><code>class Match(Base):
      __tablename__ = 'matches'
  
      id = Column(Integer, primary_key=True)
      date = Column(Date, nullable=False)
      time = Column(Time, nullable=True)
      league_id = Column(ForeignKey('leagues.id'), nullable=False, index=True)
      league = relationship('League', backref='matches')
      type = Column(enums.matches_types)
      home_team_id = Column(ForeignKey('teams.id'), nullable=False, index=True)
      home_team = relationship('Team', foreign_keys=[home_team_id], backref='home_matches')
      away_team_id = Column(ForeignKey('teams.id'), nullable=False, index=True)
  
  
  class Team(Base):
      __tablename__ = 'teams'
  
      id = Column(Integer, primary_key=True)
      name = Column(String, nullable=False)
      country_id = Column(ForeignKey('countries.id'), nullable=False, index=True)
      country = relationship('Country', backref='teams')
  </code></pre>
  
  <p>I need to write a query that joins columns and teams tables displaying information of the teams information for both local and away team.</p>
  
  <pre><code>Session.query(Match.date, Match.home_team.name, Match_away_team.name).joins(Team)
  </code></pre>
  
  <p>This returns <code>Can't determine join between 'matches' and 'teams'; tables have more than one foreign key constraint relationship between them. Please specify the 'onclause' of this join explicitly</code></p>