Skip to content

Commit 6c306ed

Browse files
sumanau7Sumanau Sareen
authored and
Sumanau Sareen
committed
Send None parameter to pandas-gbq to set no progress bar
1 parent a6a1ab2 commit 6c306ed

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pandas/io/gbq.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def read_gbq(
3232
use_bqstorage_api: Optional[bool] = None,
3333
private_key=None,
3434
verbose=None,
35-
progress_bar_type: Optional[str] = None,
35+
progress_bar_type: Optional[str] = "NOT_SET",
3636
) -> "DataFrame":
3737
"""
3838
Load data from Google BigQuery.
@@ -132,6 +132,8 @@ def read_gbq(
132132
133133
Possible values of ``progress_bar_type`` include:
134134
135+
``NOT_SET``
136+
Arg is not set by caller, don't including the argument in pandas-gbq call.
135137
``None``
136138
No progress bar.
137139
``'tqdm'``
@@ -167,8 +169,7 @@ def read_gbq(
167169
# START: new kwargs. Don't populate unless explicitly set.
168170
if use_bqstorage_api is not None:
169171
kwargs["use_bqstorage_api"] = use_bqstorage_api
170-
171-
if progress_bar_type is not None:
172+
if progress_bar_type != "NOT_SET":
172173
kwargs["progress_bar_type"] = progress_bar_type
173174
# END: new kwargs
174175

pandas/tests/io/test_gbq.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def mock_read_gbq(sql, **kwargs):
131131
assert "use_bqstorage_api" not in captured_kwargs
132132

133133

134-
@pytest.mark.parametrize("progress_bar", [None, "foo"])
134+
@pytest.mark.parametrize("progress_bar", [None, "foo", "NOT_SET"])
135135
def test_read_gbq_progress_bar_type_kwarg(monkeypatch, progress_bar):
136136
# GH 29857
137137
captured_kwargs = {}
@@ -142,11 +142,10 @@ def mock_read_gbq(sql, **kwargs):
142142

143143
monkeypatch.setattr("pandas_gbq.read_gbq", mock_read_gbq)
144144
pd.read_gbq("SELECT 1", progress_bar_type=progress_bar)
145-
146-
if progress_bar:
147-
assert "progress_bar_type" in captured_kwargs
148-
else:
145+
if progress_bar == "NOT_SET":
149146
assert "progress_bar_type" not in captured_kwargs
147+
else:
148+
assert "progress_bar_type" in captured_kwargs
150149

151150

152151
@pytest.mark.single

0 commit comments

Comments
 (0)