Skip to content

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

Merged
tswast merged 1 commit into
googleapis:masterfrom
plamut:iss-9091
Sep 26, 2019
Merged

feat(bigquery): store QueryJob to destination variable on error#9245
tswast merged 1 commit into
googleapis:masterfrom
plamut:iss-9091

Conversation

@plamut

@plamut plamut commented Sep 18, 2019

Copy link
Copy Markdown
Contributor

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 Sep 24, 2019

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

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.

3 participants