Repository: googleapis/python-bigquery

Issue:
tqdm deprecation warning
#### Environment details

  - OS type and version: Ubuntu 20.04 LTS
  - Python version: 3.8.10
  - pip version: 22.0.3
  - `google-cloud-bigquery` version: 2.34.0

#### Steps to reproduce

```
from google.cloud import bigquery

query = bigquery.Client().query('SELECT 1')
data = query.to_dataframe(progress_bar_type='tqdm_notebook')
```

The snippet above causes a deprecation warning that breaks strict pytest runs (using `'filterwarnings': ['error']`):
```
.../site-packages/google/cloud/bigquery/_tqdm_helpers.py:51: in get_progress_bar
    return tqdm.tqdm_notebook(desc=description, total=total, unit=unit)
...
        from .notebook import tqdm as _tqdm_notebook
>       warn("This function will be removed in tqdm==5.0.0\n"
             "Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`",
             TqdmDeprecationWarning, stacklevel=2)
E       tqdm.std.TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0
E       Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`

.../site-packages/tqdm/__init__.py:25: TqdmDeprecationWarning
```


Discussion:
Thanks for bringing this to our attention! Seeing as we set the max tqdm version to <5.0.0, I'll mark this as "process" for now, but I do think we need to do this before tqdm 5.0.0 comes out since "extras" aren't always enforced by PyPI and in principle we should support the latest version of our dependencies.
Thank you! It seems that this has been deprecated for years now though, the commit adding the deprecation warning is from 2019: https://github.com/tqdm/tqdm/commit/49471d3b437a8ec5fddbef78cdd02af4da417937#diff-c2228f13f6b0bdaf4c1012a108f937d0e0eceece0d87e60b0b3c3172f9038bedR5. It seems to be a relatively simple change, would it be possible to increase the priority a bit?

Resolving patch:
diff --git a/google/cloud/bigquery/_tqdm_helpers.py b/google/cloud/bigquery/_tqdm_helpers.py
--- a/google/cloud/bigquery/_tqdm_helpers.py
+++ b/google/cloud/bigquery/_tqdm_helpers.py
@@ -22,6 +22,7 @@
 
 try:
     import tqdm  # type: ignore
+
 except ImportError:  # pragma: NO COVER
     tqdm = None
 
@@ -48,7 +49,7 @@ def get_progress_bar(progress_bar_type, description, total, unit):
         if progress_bar_type == "tqdm":
             return tqdm.tqdm(desc=description, total=total, unit=unit)
         elif progress_bar_type == "tqdm_notebook":
-            return tqdm.tqdm_notebook(desc=description, total=total, unit=unit)
+            return tqdm.notebook.tqdm(desc=description, total=total, unit=unit)
         elif progress_bar_type == "tqdm_gui":
             return tqdm.tqdm_gui(desc=description, total=total, unit=unit)
     except (KeyError, TypeError):


Test patch:
diff --git a/tests/unit/test_table.py b/tests/unit/test_table.py
--- a/tests/unit/test_table.py
+++ b/tests/unit/test_table.py
@@ -45,7 +45,9 @@
     geopandas = None
 
 try:
-    from tqdm import tqdm
+    import tqdm
+    from tqdm.std import TqdmDeprecationWarning
+
 except (ImportError, AttributeError):  # pragma: NO COVER
     tqdm = None
 
@@ -2798,7 +2800,7 @@ def test_to_arrow_w_bqstorage_no_streams(self):
 
     @unittest.skipIf(tqdm is None, "Requires `tqdm`")
     @mock.patch("tqdm.tqdm_gui")
-    @mock.patch("tqdm.tqdm_notebook")
+    @mock.patch("tqdm.notebook.tqdm")
     @mock.patch("tqdm.tqdm")
     def test_to_arrow_progress_bar(self, tqdm_mock, tqdm_notebook_mock, tqdm_gui_mock):
         from google.cloud.bigquery.schema import SchemaField
@@ -3146,7 +3148,7 @@ def test_to_dataframe_datetime_out_of_pyarrow_bounds(self):
     @unittest.skipIf(pandas is None, "Requires `pandas`")
     @unittest.skipIf(tqdm is None, "Requires `tqdm`")
     @mock.patch("tqdm.tqdm_gui")
-    @mock.patch("tqdm.tqdm_notebook")
+    @mock.patch("tqdm.notebook.tqdm")
     @mock.patch("tqdm.tqdm")
     def test_to_dataframe_progress_bar(
         self, tqdm_mock, tqdm_notebook_mock, tqdm_gui_mock
@@ -3249,7 +3251,7 @@ def test_to_dataframe_no_tqdm(self):
     @unittest.skipIf(pandas is None, "Requires `pandas`")
     @unittest.skipIf(tqdm is None, "Requires `tqdm`")
     @mock.patch("tqdm.tqdm_gui", new=None)  # will raise TypeError on call
-    @mock.patch("tqdm.tqdm_notebook", new=None)  # will raise TypeError on call
+    @mock.patch("tqdm.notebook.tqdm", new=None)  # will raise TypeError on call
     @mock.patch("tqdm.tqdm", new=None)  # will raise TypeError on call
     def test_to_dataframe_tqdm_error(self):
         from google.cloud.bigquery.schema import SchemaField
@@ -3281,7 +3283,10 @@ def test_to_dataframe_tqdm_error(self):
             # Warn that a progress bar was requested, but creating the tqdm
             # progress bar failed.
             for warning in warned:
-                self.assertIs(warning.category, UserWarning)
+                self.assertIn(
+                    warning.category,
+                    [UserWarning, DeprecationWarning, TqdmDeprecationWarning],
+                )
 
     @unittest.skipIf(pandas is None, "Requires `pandas`")
     def test_to_dataframe_w_empty_results(self):