GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — perf: use `jobs.getQueryResults` to download result sets by tswast · Pull Request #347 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
|
|
Based on #341 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ) | ||
|
|
||
| self._query_results = None | ||
| self._get_query_results_kwargs = {} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a thread-local variable?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actually, the cached query results might need to be thread-local too. Imagine if two threads called result with different starting indexes and/or max results.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We'll also need some logic like
to see if we can use the cached page if result is called more than once
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done in latest commit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Since `getQueryResults` was already used to wait for the job to finish, this avoids an additional call to `tabledata.list`. The first page of results are cached in-memory. Additional changes will come in the future to avoid calling the BQ Storage API when the cached results contain the full result set.
7364196 to
983c8d2
Compare
Also, move to thread-local variables for values that were intended to track parameters across methods.
startIndex is no longer passed to the iterator It is used in the initial (cached) call to getQueryResults
| Iterator of row data | ||
| :class:`~google.cloud.bigquery.table.Row`-s. | ||
| """ | ||
| row_iterator = RowIterator( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Be sure to populate extra args with the field projection. We only need rows and page token.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Per our discussion, I'll be splitting this into 2 PRs:
I'll base them on the refactoring to split up the giant job module here: #361 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.