Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2db0c9c

Browse filesBrowse files
authored
BigQuery : max_results changes page size not full list size
Also, running a query is not "preferred" if you do want all the data. If you do run a query, you end up reading data from the destination table anyway.
1 parent f15c86a commit 2db0c9c
Copy full SHA for 2db0c9c

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎bigquery/cloud-client/snippets.py

Copy file name to clipboardExpand all lines: bigquery/cloud-client/snippets.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"""
2626

2727
import argparse
28+
import itertools
2829
import uuid
2930

3031
from google.cloud import bigquery
@@ -124,10 +125,9 @@ def list_rows(dataset_name, table_name, project=None):
124125
# Reload the table so that the schema is available.
125126
table.reload()
126127

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

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.