示例#1
0
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
示例#2
0
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"])
示例#3
0
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"])
示例#4
0
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]
示例#5
0
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]