Closed
Description
Currently, the maximum number of rows that you can get when iterating using fetchmany
, fetchall
or fetchone
is limited by arraysize
.
I see that those methods are using iterator returned by _query_data.fetch_data()
with max_results
set to arraysize
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/36304f7448677cff2f89558ef87c374e904a0492/bigquery/google/cloud/bigquery/dbapi/cursor.py#L171-L172
However, shouldn't it automatically fetch the next page of results when we are finished iterating over the current batch of results? Otherwise, it makes it impossible to retrieve full results from the query without settingarraysize
to an arbitrary large number.
Here is what I've tried:
cursor.execute('SELECT * FROM dataset.table')
while True:
rows = cursor.fetchmany(5000)
if not rows:
break
for row in rows:
print(row)
cursor.execute('SELECT * FROM dataset.table')
row = cursor.fetchone()
while row:
print(row)
row = cursor.fetchone()
I am using google-cloud-bigquery 0.26.0