Q: SqlAlchemy Entity class has no property when joining I'm trying to do the following query:
stats = Session.query(PlayerMatchStats).join(Match, Match.id == PlayerMatchStats.match_id 
                  ).filter_by(player=self).order_by(Match.date.desc()).limit(5).all()

These are some parts of the relevant models:
class PlayerMatchStats(Base):
    __tablename__ = 'players_stats'

    id = Column(Integer, primary_key=True)
    player_id = Column(ForeignKey('players.id'), index=True, nullable=False)
    player = relationship('Player', backref='stats')
    match_id = Column(ForeignKey('matches.id'), index=True, nullable=False)
    match = relationship('Match', backref='players_stats')
    team_id = Column(ForeignKey('teams.id'), index=True, nullable=False)
    team = relationship('Team', backref='players_matches_stats')


class Match(Base):
    __tablename__ = 'matches'

    id = Column(Integer, primary_key=True)
    league_id = Column(ForeignKey('leagues.id'), nullable=False, index=True)
    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)
    away_team = relationship('Team', foreign_keys=[away_team_id], backref='away_matches')


class Player(Base):
    __tablename__ = 'players'

    id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False, index=True)

When trying to perform the query, the error I receive is: Entity '<class 'model.overview.Match'>' has no property 'player'

A: Sqlalchemy thinks that you're trying to filter based on a property on Match when you really need to filter on a property of PlayerMatchStats.  You can explicitly tell SQLAlchemy which model you are referring to using the "filter" method instead of "filter_by".  In summary:
stats = Session.query(PlayerMatchStats).join(Match, Match.id==PlayerMatchStats.match_id)\
    .filter(PlayerMatchStats.player=self).order_by(Match.date.desc()).limit(5).all()

This is of course assuming that "self" is a Player object
