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

Fallback to BQ API when there are problems reading from BQ Storage. #7633

Merged
merged 1 commit into from
Apr 1, 2019

Conversation

tswast
Copy link
Contributor

@tswast tswast commented Apr 1, 2019

The tabledata.list API works for more kinds of tables, including small
anonymous query results tables. By falling back to this API, we enable
a developer to always specify a bqstorage_client even when they
aren't writing their query results to a destination table and don't
know how large their query results will be.

The tabledata.list API works for more kinds of tables, including small
anonymous query results tables. By falling back to this API, we enable
a developer to always specify a `bqstorage_client` even when they
aren't writing their query results to a destination table and don't
know how large their query results will be.
@tswast tswast added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: bigquery Issues related to the BigQuery API. labels Apr 1, 2019
@tswast tswast requested a review from shollyman April 1, 2019 18:29
@tswast tswast requested a review from crwilcox as a code owner April 1, 2019 18:29
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 1, 2019
return self._to_dataframe_bqstorage(bqstorage_client, dtypes)
else:
return self._to_dataframe_tabledata_list(dtypes, progress_bar=progress_bar)
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  • Is the difference in progress_bar intentional?

  • Should we try to be more specific about what errors trigger fallback? I think the current exception is probably the right call, but do cases like non-enabled storage api fall under this as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the difference in progress_bar intentional?

I haven't implemented the progress bar for BQ Storage API, yet. It'll need some additional features on the BQ Storage client to do well (expose to_dataframe() per block)

Should we try to be more specific about what errors trigger fallback?

I didn't want to be too specific, because the API currently returns "InternalError" when trying to read from small anonymous tables, which seemed like there's the potential to change in the future.

You're right that this does cach non-enabled storage API, which throws

 E   google.api_core.exceptions.PermissionDenied: 403 BigQuery Storage API has not been used in project before or it is disabled.

GoogleAPICallError is a superclass of PermissionDenied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I've started work on the tutorial, I've had a change of heart regarding catching PermissionDenied and other authn/authz errors. #7661 We should rethrow those, but let the other (expected) errors get caught.

@tswast tswast merged commit 8049e8a into googleapis:master Apr 1, 2019
@tswast tswast deleted the bqstorage-pandas branch April 1, 2019 21:01
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: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants