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

BigQuery: Close the to_dataframe progress bar when finished. #7757

Merged
merged 1 commit into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bigquery/google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,10 @@ def _to_dataframe_tabledata_list(self, dtypes, progress_bar=None):
progress_bar.total = progress_bar.total or self.total_rows
progress_bar.update(len(current_frame))

if progress_bar is not None:
# Indicate that the download has finished.
progress_bar.close()

return pandas.concat(frames)

def _to_dataframe_bqstorage(self, bqstorage_client, dtypes):
Expand Down
1 change: 1 addition & 0 deletions bigquery/tests/unit/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ def test_to_dataframe_progress_bar(

progress_bar_mock.assert_called()
progress_bar_mock().update.assert_called()
progress_bar_mock().close.assert_called_once()
self.assertEqual(len(df), 4)

@unittest.skipIf(pandas is None, "Requires `pandas`")
Expand Down