Skip to content

[Documentation Issue] table.fetch_data(max_results=100) #1980

Closed
@mchirico

Description

@mchirico

Page Name: bigquery-usage
Release: a1b8066

Please note, the following documentation appears to be incorrect.
https://googlecloudplatform.github.io/gcloud-python/latest/bigquery-usage.html

Get rows from a table’s data:

from gcloud import bigquery
>>> client = bigquery.Client()
>>> dataset = client.dataset('dataset_name')
>>> table = dataset.table(name='person_ages')
>>> rows, next_page_token = table.fetch_data(max_results=100)  # API request
>>> for row in rows:
...     for field, value in zip(table.schema, row):
...         do_something(field, value)

Specifically the following line of code returns 3 values. It appears that total_rows is missing.

rows, next_page_token = table.fetch_data(max_results=100)  # API request

The documentation for table.fetch_data states the following:

returns: ``(row_data, total_rows, page_token)``, where ``row_data``
              is a list of tuples, one per result row, containing only
              the values;  ``total_rows`` is a count of the total number
              of rows in the table;  and ``page_token`` is an opaque

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions