def get_best_for_match(match_id, **kwargs): query = f"select home_win, draw, away_win from odds_table where match_id={match_id}" odds_list = fetchall(query, kwargs["conn"]) home_odd = max([odd[0] for odd in odds_list]) draw_odd = max([odd[1] for odd in odds_list]) away_odd = max([odd[2] for odd in odds_list]) return home_odd, draw_odd, away_odd
def get_seasons_for_division(division, **kwargs): if not division: query = f"select id from season_table;" elif isinstance(division, list): query = f"select id from season_table where division_id IN ({','.join(str(idd) for idd in division)});" elif isinstance(division, int): query = f"select id from season_table where division_id={division};" return fetchall(query, kwargs["conn"])
def get_teams_for_season(season_id, **kwargs): query = f"select distinct(HomeTeam) from match_table where season_id={season_id};" return fetchall(query, conn=kwargs["conn"])
def get_teams(division, conn): query = f"SELECT DISTINCT HomeTeam, AwayTeam FROM match_table where Div='{division}';" result = fetchall(query, conn) return [r[0] for r in result]
def get_tags_for_ids(ids, **kwargs): conn = kwargs["conn"] query = f"select data_tag from division_table where id IN ({','.join(str(idd) for idd in ids)})" ret = fetchall(query, conn) return [val[0] for val in ret]