def to_dict(cursor):
    """ Add column names to the fetched values.
    """
    rows = cursor.fetchall()
    cols = [desc[0] for desc in cursor.description]
    try:
        return list(dict(zip(cols, row)) for row in rows)
    except Exception:
        return []