def build_ward_table(query: Query, session: Session, team_session: Session) -> DataFrame: """Build a table of wards with coordinates, IDs, names and times. Arguments: query {Query} -- Database query with Wards. session {Session} -- Session of the parsed DB. team_session {Session} -- Open session to team_info DB. Returns: DataFrame -- Includes x, y, steamID, times, smoke status, name. """ sql_query = query.with_entities(Ward.xCoordinate, Ward.yCoordinate, Ward.steamID, Ward.game_time, Ward.from_smoke).statement data = read_sql(sql_query, session.bind) data.sort_values(['game_time'], ascending=True) name_map = get_player_map(team_session, set(data['steamID'].unique())) data['Name'] = data['steamID'].map(name_map) data['time'] = data['game_time'].map(seconds_to_nice) return data
def with_entities(self, *entities): return Query.with_entities(self.private(), *entities)