def get_compute_time(connection: 'Connection', query_id: str) ->float:
    """
    Get the time in seconds that a cached query took to compute.

    Parameters
    ----------
    connection : "Connection"
    query_id : str
        Unique id of the query

    Returns
    -------
    float
        Number of seconds the query took to compute

    """
    try:
        return float(connection.fetch(
            f"SELECT compute_time FROM cache.cached WHERE query_id='{query_id}'"
            )[0][0] / 1000)
    except IndexError:
        raise ValueError(
            f"Query id '{query_id}' is not in cache on this connection.")
