-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetching next batch of results using BigQuery's dbapi #3840
Comments
I'm not sure what you are asking. Under the covers the The DB-API specification says that |
Unless I am missing something, there is currently no way to fetch all rows for a query? The only workaround is to set |
What's wrong with using But yes, for best performance you will need to increase the |
|
This is what I thought as well, but I've tried |
Ah, okay. I'll investigate further. Thanks for you patience. |
I'm able to reproduce the issue with this system test.
When arraysize is 1 (the default), only one result is returned when three are expected. The unit tests are passing, but they mock out the core iterator class used, so I'm thinking the issue lies there or in how it is used. |
I think the problem is that HTTPIterator is looking for |
I'm able to reproduce this issue (only the first page is fetched) in the core API, not just the DB-API. By modifying the system test with 1000 rows and setting the page size to 100, I'm able to reproduce.
Working to fix in this branch: https://github.com/tswast/google-cloud-python/tree/bq-dbapi/bigquery |
Thank you for such a quick fix! |
Fix merged. It should be in the next release. (I don't know when that will be) |
Currently, the maximum number of rows that you can get when iterating using
fetchmany
,fetchall
orfetchone
is limited byarraysize
.I see that those methods are using iterator returned by
_query_data.fetch_data()
withmax_results
set toarraysize
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 setting
arraysize
to an arbitrary large number.Here is what I've tried:
I am using google-cloud-bigquery 0.26.0
The text was updated successfully, but these errors were encountered: