import six


def rows_from_table(table):
    """Given a tinyquery.Table, build an API-compatible rows object."""
    result_rows = []
    for i in six.moves.xrange(table.num_rows):
        field_values = [{'v': str(col.values[i])}
                        for col in table.columns.values()]
        result_rows.append({
            'f': field_values
        })
    return result_rows