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

feat(bigquery): store QueryJob to destination variable on error #9245

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Sep 18, 2019

Closes #9091.

This PR changes the Jupyter notebook magic to store the relevant QueryJob instance on errors to the specified destination variable (if any).

How to test

Start an ipython session from the bigquery/ directory, and try to execute a query that results in an error:

In [1]: from google.cloud import bigquery
In [2]: %load_ext google.cloud.bigquery
In [3]: %%bigquery target_var --dry_run 
  
        SELECT SELECT * FROM `bigquery-public-data.samples.shakespeare` LIMIT 5; 

Expected result:
If an error occurs, the target variable is set to a QueryJob instance, allowing further introspection. This happens both in dry runs and actual runs.

@plamut plamut added the api: bigquery Issues related to the BigQuery API. label Sep 18, 2019
@plamut plamut requested a review from a team September 18, 2019 15:30
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 18, 2019
@plamut plamut changed the title BigQuery: Store QueryJob to destination variable on error feat(bigquery): store QueryJob to destination variable on error Sep 24, 2019
Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks!

@tswast tswast merged commit 6e6cd39 into googleapis:master Sep 26, 2019
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BigQuery: [magics] if destination_var is set and an error occurs, save the QueryJob for further inspection
3 participants