Skip to content

Send None parameter to pandas-gbq to set no progress bar #33477

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

Merged
merged 1 commit into from
Jun 4, 2020
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
2 changes: 1 addition & 1 deletion ci/deps/travis-36-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- numexpr
- numpy
- openpyxl
- pandas-gbq=0.8.0
- pandas-gbq=0.12.0
- psycopg2=2.6.2
- pymysql=0.7.11
- pytables
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ lxml 3.8.0 HTML parser for read_html (see :ref
matplotlib 2.2.2 Visualization
numba 0.46.0 Alternative execution engine for rolling operations
openpyxl 2.5.7 Reading / writing for xlsx files
pandas-gbq 0.8.0 Google Big Query access
pandas-gbq 0.12.0 Google Big Query access
psycopg2 PostgreSQL engine for sqlalchemy
pyarrow 0.12.0 Parquet, ORC (requires 0.13.0), and feather reading / writing
pymysql 0.7.11 MySQL engine for sqlalchemy
Expand Down
3 changes: 3 additions & 0 deletions doc/source/whatsnew/v1.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Other enhancements
- Make :class:`pandas.core.window.Rolling` and :class:`pandas.core.window.Expanding` iterable(:issue:`11704`)
- Make ``option_context`` a :class:`contextlib.ContextDecorator`, which allows it to be used as a decorator over an entire function (:issue:`34253`).
- :meth:`groupby.transform` now allows ``func`` to be ``pad``, ``backfill`` and ``cumcount`` (:issue:`31269`).
- :meth `~pandas.io.gbq.read_gbq` now allows to disable progress bar (:issue:`33360`).

.. ---------------------------------------------------------------------------

Expand Down Expand Up @@ -355,6 +356,8 @@ Optional libraries below the lowest tested version may still work, but are not c
+-----------------+-----------------+---------+
| xlwt | 1.2.0 | |
+-----------------+-----------------+---------+
| pandas-gbq | 1.2.0 | X |
+-----------------+-----------------+---------+

See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.

Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"numexpr": "2.6.2",
"odfpy": "1.3.0",
"openpyxl": "2.5.7",
"pandas_gbq": "0.8.0",
"pandas_gbq": "0.12.0",
"pyarrow": "0.13.0",
"pytables": "3.4.3",
"pytest": "5.0.1",
Expand Down
5 changes: 2 additions & 3 deletions pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,13 @@ def read_gbq(
"""
pandas_gbq = _try_import()

kwargs: Dict[str, Union[str, bool]] = {}
kwargs: Dict[str, Union[str, bool, None]] = {}

# START: new kwargs. Don't populate unless explicitly set.
if use_bqstorage_api is not None:
kwargs["use_bqstorage_api"] = use_bqstorage_api

if progress_bar_type is not None:
kwargs["progress_bar_type"] = progress_bar_type
kwargs["progress_bar_type"] = progress_bar_type
# END: new kwargs

return pandas_gbq.read_gbq(
Expand Down
6 changes: 1 addition & 5 deletions pandas/tests/io/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ def mock_read_gbq(sql, **kwargs):

monkeypatch.setattr("pandas_gbq.read_gbq", mock_read_gbq)
pd.read_gbq("SELECT 1", progress_bar_type=progress_bar)

if progress_bar:
assert "progress_bar_type" in captured_kwargs
else:
assert "progress_bar_type" not in captured_kwargs
assert "progress_bar_type" in captured_kwargs


@pytest.mark.single
Expand Down