Skip to content

Commit 3e06961

Browse files
authored
Close the to_dataframe progress bar when finished. (#7757)
1 parent ee804a1 commit 3e06961

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

bigquery/google/cloud/bigquery/table.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,10 @@ def _to_dataframe_tabledata_list(self, dtypes, progress_bar=None):
13851385
progress_bar.total = progress_bar.total or self.total_rows
13861386
progress_bar.update(len(current_frame))
13871387

1388+
if progress_bar is not None:
1389+
# Indicate that the download has finished.
1390+
progress_bar.close()
1391+
13881392
return pandas.concat(frames)
13891393

13901394
def _to_dataframe_bqstorage_stream(

bigquery/tests/unit/test_table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,7 @@ def test_to_dataframe_progress_bar(
15031503

15041504
progress_bar_mock.assert_called()
15051505
progress_bar_mock().update.assert_called()
1506+
progress_bar_mock().close.assert_called_once()
15061507
self.assertEqual(len(df), 4)
15071508

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

0 commit comments

Comments
 (0)