Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

feat: add progress bar for magics - #396

Merged
tswast merged 5 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_389
Dec 2, 2020
Merged

feat: add progress bar for magics#396
tswast merged 5 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_389

Conversation

@HemangChothani

Copy link
Copy Markdown
Contributor

Fixes#389

@HemangChothani
HemangChothani requested review from a team and tswastNovember 20, 2020 15:20
@google-clagoogle-claBot added the cla: yes This human has signed the Contributor License Agreement. label Nov 20, 2020
@product-auto-labelproduct-auto-labelBot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Nov 20, 2020
self._default_query_job_config = bigquery.QueryJobConfig()
self._bigquery_client_options = client_options.ClientOptions()
self._bqstorage_client_options = client_options.ClientOptions()
self._progress_bar_type = None

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.

I think tqdm would be fine default value here

@HemangChothaniHemangChothaniDec 1, 2020

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

If i put tqdm as a default value anywhere in the code, test_jupyter_tutorial(ipython) snippet failed, you can see in the first commit. It's because tqdm is not installed.

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.

That's because there's a bug in the progress bar code.

 if progress_bar_type is None:
return query_job.result()

This is too soon to check if a progress bar can be supported. We should check if progress_bar is None after

 progress_bar = get_progress_bar(
progress_bar_type, "Query is running", default_total, "query"
)

Something like

 """Return query result and display a progress bar while the query running, if tqdm is installed."""
progress_bar = get_progress_bar(
progress_bar_type, "Query is running", default_total, "query"
)
if progress_bar is None:
return query_job.result()
default_total = 1
current_stage = None
start_time = time.time()

@tswast
tswast merged commit 04d0273 into googleapis:masterDec 2, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show progress bar in %%bigquery magics

2 participants

@HemangChothani@tswast