Skip to content

Commit

Permalink
Merge pull request googleapis#1086 from GoogleCloudPlatform/tswast-pa…
Browse files Browse the repository at this point in the history
…tch-1

BigQuery : max_results changes page size not full list size
  • Loading branch information
tswast authored Aug 22, 2017
2 parents 4bfaa98 + d8be82a commit ce3e978
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions samples/snippets/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"""

import argparse
import itertools
import uuid

from google.cloud import bigquery
Expand Down Expand Up @@ -124,10 +125,8 @@ def list_rows(dataset_name, table_name, project=None):
# Reload the table so that the schema is available.
table.reload()

# Load at most 25 results. You can change the max_results argument to load
# more rows from BigQuery, but note that this can take some time. It's
# preferred to use a query.
rows = list(table.fetch_data(max_results=25))
# Load at most 25 results.
rows = itertools.islice(table.fetch_data(), 25)

# Use format to create a simple table.
format_string = '{!s:<16} ' * len(table.schema)
Expand Down

0 comments on commit ce3e978

Please sign in to comment.