Beispiel #1
0
 def get_pitch_stats_for_season_for_all_teams(cls, db_engine, year):
     s = select([cls]).where(cls.year == year)
     results = db_engine.execute(s).fetchall()
     return PitchStatsMetrics.from_query_results(results) if results else []
Beispiel #2
0
 def get_pitch_stats_by_year_for_team(cls, db_engine, team_id_bbref):
     s = select([cls]).where(cls.team_id_bbref == team_id_bbref)
     results = db_engine.execute(s).fetchall()
     return PitchStatsMetrics.from_query_results(results) if results else []
Beispiel #3
0
 def get_pitch_stats_for_career_for_player(cls, db_engine, mlb_id):
     s = select([cls]).where(cls.mlb_id == mlb_id)
     results = db_engine.execute(s).fetchall()
     return PitchStatsMetrics.from_query_results(
         results)[0] if results else None
Beispiel #4
0
 def get_pitch_stats_for_team(cls, db_engine, team_id_bbref, year):
     s = select([cls]).where(and_(cls.team_id_bbref == team_id_bbref, cls.year == year))
     results = db_engine.execute(s).fetchall()
     return PitchStatsMetrics.from_query_results(results)[0] if results else None
Beispiel #5
0
 def get_pitch_stats_by_opp_team_by_year_for_player(cls, db_engine, mlb_id):
     s = select([cls]).where(cls.mlb_id == mlb_id)
     results = db_engine.execute(s).fetchall()
     return PitchStatsMetrics.from_query_results(results) if results else []