Skip to content
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

Cache job constructed for a synchronous query. #1675

Merged
merged 1 commit into from
Mar 29, 2016
Merged

Cache job constructed for a synchronous query. #1675

merged 1 commit into from
Mar 29, 2016

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Mar 29, 2016

Fixes #1673.

@tseaver tseaver added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: bigquery Issues related to the BigQuery API. labels Mar 29, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 29, 2016
@dhermes
Copy link
Contributor

dhermes commented Mar 29, 2016

Code itself LGTM but before merging here is a design question: should the user have a way to bust our cached value?

@tseaver
Copy link
Contributor Author

tseaver commented Mar 29, 2016

Should the user have a way to bust our cached value?

I wouldn't think so. The QueryJob instance has no "interesting" user-settable state once the job is running: its only use is to poll for status / statistics, etc.

@dhermes
Copy link
Contributor

dhermes commented Mar 29, 2016

But what if the job attribute becomes out of sync with the actual job? Is it even possible? What if the job on the server ceases to exist but the property still is valid locally?

@tseaver
Copy link
Contributor Author

tseaver commented Mar 29, 2016

But what if the job attribute becomes out of sync with the actual job? Is it even possible?

That is what the job.reload() call is for (when polling the status).

What if the job on the server ceases to exist but the property still is valid locally?

No different than holding onto any other client-side proxy for a server-side resource. The docs for jobs.query say:

The query results from this method are saved to a temporary table that is deleted approximately 24 hours after the query is run.

which implies that the job must last that long, too (since its ID is used to fetch the results). If the user tries to fetch results after the job / result table is gone, then the API will (presumably) raise a 404.

@dhermes
Copy link
Contributor

dhermes commented Mar 29, 2016

LGTM

@tseaver tseaver merged commit b8eac84 into googleapis:master Mar 29, 2016
@tseaver tseaver deleted the 1673-bigquery-reify_query_job branch March 29, 2016 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants