internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: googleapis/python-bigquery

Issue:
add test session to nox without installing any "extras"
https://github.com/googleapis/python-bigquery/pull/613 is making me a bit nervous that we might accidentally introduce a required dependency that we thought was optional. It wouldn't be the first time this has happened (https://github.com/googleapis/python-bigquery/issues/549), so I'd like at least a unit test session that runs without any extras.


Discussion:

Resolving patch:
diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -31,6 +31,7 @@
 
 # 'docfx' is excluded since it only needs to run in 'docs-presubmit'
 nox.options.sessions = [
+    "unit_noextras",
     "unit",
     "system",
     "snippets",
@@ -42,7 +43,7 @@
 ]
 
 
-def default(session):
+def default(session, install_extras=True):
     """Default unit test session.
 
     This is intended to be run **without** an interpreter set, so
@@ -65,7 +66,8 @@ def default(session):
         constraints_path,
     )
 
-    session.install("-e", ".[all]", "-c", constraints_path)
+    install_target = ".[all]" if install_extras else "."
+    session.install("-e", install_target, "-c", constraints_path)
 
     session.install("ipython", "-c", constraints_path)
 
@@ -90,6 +92,12 @@ def unit(session):
     default(session)
 
 
+@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
+def unit_noextras(session):
+    """Run the unit test suite."""
+    default(session, install_extras=False)
+
+
 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
 def system(session):
     """Run the system test suite."""


Test patch:
diff --git a/tests/unit/test__pandas_helpers.py b/tests/unit/test__pandas_helpers.py
--- a/tests/unit/test__pandas_helpers.py
+++ b/tests/unit/test__pandas_helpers.py
@@ -1464,6 +1464,7 @@ def test_download_dataframe_row_iterator_dict_sequence_schema(module_under_test)
         result = next(results_gen)
 
 
+@pytest.mark.skipif(pandas is None, reason="Requires `pandas`")
 def test_table_data_listpage_to_dataframe_skips_stop_iteration(module_under_test):
     dataframe = module_under_test._row_iterator_page_to_dataframe([], [], {})
     assert isinstance(dataframe, pandas.DataFrame)
diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py
--- a/tests/unit/test_client.py
+++ b/tests/unit/test_client.py
@@ -65,7 +65,12 @@
 from tests.unit.helpers import make_connection
 
 PANDAS_MINIUM_VERSION = pkg_resources.parse_version("1.0.0")
-PANDAS_INSTALLED_VERSION = pkg_resources.get_distribution("pandas").parsed_version
+
+if pandas is not None:
+    PANDAS_INSTALLED_VERSION = pkg_resources.get_distribution("pandas").parsed_version
+else:
+    # Set to less than MIN version.
+    PANDAS_INSTALLED_VERSION = pkg_resources.parse_version("0.0.0")
 
 
 def _make_credentials():
Repository: googleapis/python-bigquery

Issue:
google.auth.exceptions.TransportError is not being retried
Hi, 

Recently i faced an error can you please consider using this exception as a retry one also. Since i have faced this error in one of our production system

https://github.com/googleapis/python-storage/issues/414




Discussion:
Based on the context from @busunkim96 in the linked issue, this is a reasonable request. We'll need a PR similar to https://github.com/googleapis/python-bigquery/pull/571 (retry ConnectionError by default)

Resolving patch:
diff --git a/google/cloud/bigquery/retry.py b/google/cloud/bigquery/retry.py
--- a/google/cloud/bigquery/retry.py
+++ b/google/cloud/bigquery/retry.py
@@ -14,6 +14,7 @@
 
 from google.api_core import exceptions
 from google.api_core import retry
+from google.auth import exceptions as auth_exceptions
 import requests.exceptions
 
 
@@ -27,6 +28,7 @@
     exceptions.InternalServerError,
     exceptions.BadGateway,
     requests.exceptions.ConnectionError,
+    auth_exceptions.TransportError,
 )
 
 


Test patch:
diff --git a/tests/unit/test_retry.py b/tests/unit/test_retry.py
--- a/tests/unit/test_retry.py
+++ b/tests/unit/test_retry.py
@@ -51,6 +51,12 @@ def test_w_unstructured_requests_connectionerror(self):
         exc = requests.exceptions.ConnectionError()
         self.assertTrue(self._call_fut(exc))
 
+    def test_w_auth_transporterror(self):
+        from google.auth.exceptions import TransportError
+
+        exc = TransportError("testing")
+        self.assertTrue(self._call_fut(exc))
+
     def test_w_unstructured_too_many_requests(self):
         from google.api_core.exceptions import TooManyRequests
Repository: googleapis/python-bigquery

Issue:
feat: Extended DB API parameter syntax to optionally provide parameter types
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)

Fixes #609 🦕



Discussion:

Resolving patch:
diff --git a/google/cloud/bigquery/_helpers.py b/google/cloud/bigquery/_helpers.py
--- a/google/cloud/bigquery/_helpers.py
+++ b/google/cloud/bigquery/_helpers.py
@@ -363,6 +363,11 @@ def _time_to_json(value):
     "DATETIME": _datetime_to_json,
     "DATE": _date_to_json,
     "TIME": _time_to_json,
+    # Make sure DECIMAL and BIGDECIMAL are handled, even though
+    # requests for them should be converted to NUMERIC.  Better safe
+    # than sorry.
+    "DECIMAL": _decimal_to_json,
+    "BIGDECIMAL": _decimal_to_json,
 }
 
 
diff --git a/google/cloud/bigquery/enums.py b/google/cloud/bigquery/enums.py
--- a/google/cloud/bigquery/enums.py
+++ b/google/cloud/bigquery/enums.py
@@ -203,8 +203,8 @@ class SqlTypeNames(str, enum.Enum):
     INT64 = "INTEGER"
     FLOAT = "FLOAT"
     FLOAT64 = "FLOAT"
-    NUMERIC = "NUMERIC"
-    BIGNUMERIC = "BIGNUMERIC"
+    DECIMAL = NUMERIC = "NUMERIC"
+    BIGDECIMAL = BIGNUMERIC = "BIGNUMERIC"
     BOOLEAN = "BOOLEAN"
     BOOL = "BOOLEAN"
     GEOGRAPHY = "GEOGRAPHY"  # NOTE: not available in legacy types
@@ -227,6 +227,8 @@ class SqlParameterScalarTypes:
     FLOAT64 = ScalarQueryParameterType("FLOAT64")
     NUMERIC = ScalarQueryParameterType("NUMERIC")
     BIGNUMERIC = ScalarQueryParameterType("BIGNUMERIC")
+    DECIMAL = ScalarQueryParameterType("NUMERIC")
+    BIGDECIMAL = ScalarQueryParameterType("BIGNUMERIC")
     BOOLEAN = ScalarQueryParameterType("BOOL")
     BOOL = ScalarQueryParameterType("BOOL")
     GEOGRAPHY = ScalarQueryParameterType("GEOGRAPHY")


Test patch:
Repository: googleapis/python-bigquery

Issue:
deps: expand extras to support pyarrow v4
We're actually already testing with pyarrow v4 in some of the samples tests, so this should be safe to expand in our `setup.py`


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -47,10 +47,10 @@
         # grpc.Channel.close() method isn't added until 1.32.0.
         # https://github.com/grpc/grpc/pull/15254
         "grpcio >= 1.32.0, < 2.0dev",
-        "pyarrow >= 1.0.0, < 4.0dev",
+        "pyarrow >= 1.0.0, < 5.0dev",
     ],
-    "pandas": ["pandas>=0.23.0", "pyarrow >= 1.0.0, < 4.0dev"],
-    "bignumeric_type": ["pyarrow >= 3.0.0, < 4.0dev"],
+    "pandas": ["pandas>=0.23.0", "pyarrow >= 1.0.0, < 5.0dev"],
+    "bignumeric_type": ["pyarrow >= 3.0.0, < 5.0dev"],
     "tqdm": ["tqdm >= 4.7.4, <5.0.0dev"],
     "opentelemetry": [
         "opentelemetry-api >= 0.11b0",


Test patch:
diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt
--- a/testing/constraints-3.9.txt
+++ b/testing/constraints-3.9.txt
@@ -0,0 +1,7 @@
+# This constraints file is used to make sure that the latest dependency versions
+# we claim to support in setup.py are indeed installed in test sessions in the most
+# recent Python version supported (3.9 at the time of writing - 2021-05-05).
+#
+# NOTE: Not comprehensive yet, will eventually be maintained semi-automatically by
+# the renovate bot.
+pyarrow>=4.0.0
Repository: googleapis/python-bigquery

Issue:
chore: use paths for --cov arguments in noxfile
https://github.com/googleapis/python-bigquery/blob/6a48e80bc7d347f381b181f4cf81fef105d0ad0d/noxfile.py#L80-L81

To pull https://github.com/googleapis/synthtool/pull/859 from templates.


Discussion:

Resolving patch:
diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -77,8 +77,8 @@ def default(session, install_extras=True):
     session.run(
         "py.test",
         "--quiet",
-        "--cov=google.cloud.bigquery",
-        "--cov=tests.unit",
+        "--cov=google/cloud/bigquery",
+        "--cov=tests/unit",
         "--cov-append",
         "--cov-config=.coveragerc",
         "--cov-report=",


Test patch:
Repository: googleapis/python-bigquery

Issue:
The release attrs==21.1.0 broke pytype check
Running the `pytype` check on `master` fails:
```
$ nox -s pytype
```

```
...
    return attr.evolve(self, *args, **kwargs)
  File "/home/peter/workspace/python-bigquery/.nox/pytype/lib/python3.8/site-packages/attr/_funcs.py", line 347, in evolve
    changes[init_name] = evolve(value, **changes[init_name])
TypeError: evolve() argument after ** must be a mapping, not NamedType
...
```

This happens with the most recent `attrs` release, namely [21.1.0](https://github.com/python-attrs/attrs/releases/tag/21.1.0). The error does not happen in a release before that ([attrs==20.3.0](https://github.com/python-attrs/attrs/releases/tag/20.3.0)).

A possible workaround is to temporarily force installing that version before running `pytype`.


Discussion:

Resolving patch:
diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -103,6 +103,10 @@ def unit_noextras(session):
 @nox.session(python=DEFAULT_PYTHON_VERSION)
 def pytype(session):
     """Run type checks."""
+    # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less
+    # recent version avoids the error until a possibly better fix is found.
+    # https://github.com/googleapis/python-bigquery/issues/655
+    session.install("attrs==20.3.0")
     session.install("-e", ".[all]")
     session.install("ipython")
     session.install(PYTYPE_VERSION)


Test patch:
Repository: googleapis/python-bigquery

Issue:
DB API rowcount incorrect for executemany

```
(3.9) jim@ds9:~/p/g/python-bigquery$ python
>>> from google.cloud.bigquery.dbapi import connect
>>> conn = connect()
>>> cursor = conn.cursor()
>>> cursor.executemany("select %s", [[1],[2],[3]])
>>> cursor.rowcount
1
```


Discussion:

Resolving patch:
diff --git a/google/cloud/bigquery/dbapi/cursor.py b/google/cloud/bigquery/dbapi/cursor.py
--- a/google/cloud/bigquery/dbapi/cursor.py
+++ b/google/cloud/bigquery/dbapi/cursor.py
@@ -218,6 +218,7 @@ def executemany(self, operation, seq_of_parameters):
                 Sequence of many sets of parameter values.
         """
         if seq_of_parameters:
+            rowcount = 0
             # There's no reason to format the line more than once, as
             # the operation only barely depends on the parameters.  So
             # we just use the first set of parameters. If there are
@@ -230,6 +231,9 @@ def executemany(self, operation, seq_of_parameters):
                 self._execute(
                     formatted_operation, parameters, None, None, parameter_types
                 )
+                rowcount += self.rowcount
+
+            self.rowcount = rowcount
 
     def _try_fetch(self, size=None):
         """Try to start fetching data, if not yet started.


Test patch:
diff --git a/tests/unit/test_dbapi_cursor.py b/tests/unit/test_dbapi_cursor.py
--- a/tests/unit/test_dbapi_cursor.py
+++ b/tests/unit/test_dbapi_cursor.py
@@ -612,7 +612,7 @@ def test_executemany_w_dml(self):
             (("test",), ("anothertest",)),
         )
         self.assertIsNone(cursor.description)
-        self.assertEqual(cursor.rowcount, 12)
+        self.assertEqual(cursor.rowcount, 24)  # 24 because 2 * 12 because cumulatve.
 
     def test_executemany_empty(self):
         from google.cloud.bigquery.dbapi import connect
Repository: googleapis/python-bigquery

Issue:
AttributeError in `resource_name_to_date()` samples fixture
See this samples [test run](https://source.cloud.google.com/results/invocations/e5c424d5-84a6-4505-ae44-3bc70fa94e44/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-bigquery%2Fsamples%2Fpython3.6%2Fpresubmit/log). A bug in [this fixture](https://github.com/googleapis/python-bigquery/blob/bd7dbdae5c972b16bafc53c67911eeaa3255a880/samples/snippets/conftest.py#L33-L36) made all of them fail.

> AttributeError: module 'datetime' has no attribute 'strptime'

I wonder how this got in in the first place?



Discussion:

Resolving patch:
diff --git a/samples/snippets/conftest.py b/samples/snippets/conftest.py
--- a/samples/snippets/conftest.py
+++ b/samples/snippets/conftest.py
@@ -33,7 +33,7 @@ def resource_prefix() -> str:
 def resource_name_to_date(resource_name: str):
     start_date = len(RESOURCE_PREFIX) + 1
     date_string = resource_name[start_date : start_date + RESOURCE_DATE_LENGTH]
-    return datetime.strptime(date_string, RESOURCE_DATE_FORMAT)
+    return datetime.datetime.strptime(date_string, RESOURCE_DATE_FORMAT)
 
 
 @pytest.fixture(scope="session", autouse=True)


Test patch:
Repository: googleapis/python-bigquery

Issue:
Noxfile is not updated with Sphinx version pin
`noxfile.py` is not updated with Sphinx version pin, please help take a look!


Discussion:
The BigQuery library uses a hand-written `noxfile.py`. There's a tendency to use an autogenerated version of it, but not there yet.

Related: https://github.com/googleapis/python-bigquery/issues/366

Resolving patch:
diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -271,7 +271,7 @@ def blacken(session):
 def docs(session):
     """Build the docs."""
 
-    session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme")
+    session.install("ipython", "recommonmark", "sphinx==4.0.1", "sphinx_rtd_theme")
     session.install("google-cloud-storage")
     session.install("-e", ".[all]")
 
@@ -295,7 +295,9 @@ def docfx(session):
     """Build the docfx yaml files for this library."""
 
     session.install("-e", ".")
-    session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml")
+    session.install(
+        "sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml"
+    )
 
     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
     session.run(


Test patch:
Repository: googleapis/python-bigquery

Issue:
free(): invalid pointer Aborted error when importing from google.cloud import bigquery  in python
I started facing this peculiar issue  while import importing BigQuery in python scripts as well as in the terminal. 
Can anyone help me out here?
I even tried to downgrade the bigquery package from 2.20 to 2.1 its still give me the same error

```
root@f6968ce75f9d:~# python 
Python 3.7.10 (default, May 28 2021, 10:36:10) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import bigquery
free(): invalid pointer
Aborted
```

<img width="858" alt="Screenshot 2021-06-07 at 10 31 45 PM" src="https://user-images.githubusercontent.com/20011105/121060374-2c9cb000-c7e0-11eb-8819-8153137ac41a.png">





Discussion:
@rituraj17 This sounds a lot like an [issue](https://github.com/googleapis/python-pubsub/issues/414) opened in the Pub/Sub repo. It's an issue in `grpcio` that has now been [fixed](https://github.com/googleapis/python-pubsub/issues/414#issuecomment-856452925), just not released yet.

Until it's released, does the [workaround](https://github.com/googleapis/python-pubsub/issues/414#issuecomment-844068391) posted in the related issue work for you?
(essentially, `grpc` should be imported before `proto.message`)
```py
import grpc
import proto.message
from google.cloud import bigquery
```

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -29,6 +29,7 @@
 # 'Development Status :: 5 - Production/Stable'
 release_status = "Development Status :: 5 - Production/Stable"
 dependencies = [
+    "grpcio >= 1.38.1, < 2.0dev",  # https://github.com/googleapis/python-bigquery/issues/695
     "google-api-core[grpc] >= 1.29.0, < 2.0.0dev",
     "proto-plus >= 1.10.0",
     "google-cloud-core >= 1.4.1, < 2.0dev",
@@ -46,7 +47,7 @@
         # See: https://github.com/googleapis/python-bigquery/issues/83 The
         # grpc.Channel.close() method isn't added until 1.32.0.
         # https://github.com/grpc/grpc/pull/15254
-        "grpcio >= 1.32.0, < 2.0dev",
+        "grpcio >= 1.38.1, < 2.0dev",
         "pyarrow >= 1.0.0, < 5.0dev",
     ],
     "pandas": ["pandas>=0.23.0", "pyarrow >= 1.0.0, < 5.0dev"],


Test patch:
diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt
--- a/testing/constraints-3.6.txt
+++ b/testing/constraints-3.6.txt
@@ -9,7 +9,7 @@ google-api-core==1.29.0
 google-cloud-bigquery-storage==2.0.0
 google-cloud-core==1.4.1
 google-resumable-media==0.6.0
-grpcio==1.32.0
+grpcio==1.38.1
 opentelemetry-api==0.11b0
 opentelemetry-instrumentation==0.11b0
 opentelemetry-sdk==0.11b0
Repository: googleapis/python-bigquery

Issue:
Cannot insert NaN and non-finite float values using Client.insert_rows()
Trying to insert a NaN using `Client.insert_rows` fails. I tracked it down to 

```
def _float_to_json(value):
    """Coerce 'value' to an JSON-compatible representation."""
    return value if value is None else float(value)
```

which should return "NaN" to be compatible with the REST API. Currently it returns an actual nan float value. Probably similar issues occur with other non-finite floats.

#### Environment details

  - OS type and version:
  - Python version: `Python 3.6.8`
  - pip version: `pip 21.1`
  - `google-cloud-bigquery` version: `2.20.0`

#### Steps to reproduce

  1. Try to insert a NaN value into existing table

#### Code example

```python
from google.cloud.bigquery import Client

client = Client(project='bar')
client.insert_rows(table=client.get_table('foo'), rows=[{'bar': float('NaN')}])
```

#### Stack trace
```
google.api_core.exceptions.BadRequest: 400 POST (REDACTED): Invalid JSON payload received. Unexpected token.
json": {"bar": NaN}, "insertId": "1
```


Discussion:
For anyone else running into this, using `insert_rows_json` is a valid workaround, as long as the row is already json-compatible

Resolving patch:
diff --git a/google/cloud/bigquery/_helpers.py b/google/cloud/bigquery/_helpers.py
--- a/google/cloud/bigquery/_helpers.py
+++ b/google/cloud/bigquery/_helpers.py
@@ -17,6 +17,7 @@
 import base64
 import datetime
 import decimal
+import math
 import re
 
 from google.cloud._helpers import UTC
@@ -305,7 +306,12 @@ def _int_to_json(value):
 
 def _float_to_json(value):
     """Coerce 'value' to an JSON-compatible representation."""
-    return value if value is None else float(value)
+    if value is None:
+        return None
+    elif math.isnan(value) or math.isinf(value):
+        return str(value)
+    else:
+        return float(value)
 
 
 def _decimal_to_json(value):


Test patch:
diff --git a/tests/unit/test__helpers.py b/tests/unit/test__helpers.py
--- a/tests/unit/test__helpers.py
+++ b/tests/unit/test__helpers.py
@@ -656,9 +656,24 @@ def _call_fut(self, value):
 
         return _float_to_json(value)
 
+    def test_w_none(self):
+        self.assertEqual(self._call_fut(None), None)
+
     def test_w_float(self):
         self.assertEqual(self._call_fut(1.23), 1.23)
 
+    def test_w_nan(self):
+        result = self._call_fut(float("nan"))
+        self.assertEqual(result.lower(), "nan")
+
+    def test_w_infinity(self):
+        result = self._call_fut(float("inf"))
+        self.assertEqual(result.lower(), "inf")
+
+    def test_w_negative_infinity(self):
+        result = self._call_fut(float("-inf"))
+        self.assertEqual(result.lower(), "-inf")
+
 
 class Test_decimal_to_json(unittest.TestCase):
     def _call_fut(self, value):
Repository: googleapis/python-bigquery

Issue:
missing docs for enums: switch to module-based reference docs for enums module
There are several enums in https://github.com/googleapis/python-bigquery/blob/master/google/cloud/bigquery/enums.py which are undocumented.

I recall we were doing class-based docs mostly because the "jobs" module was too huge to properly browse. It should be safe to use module-based docs for the smaller modules like enums, so we don't have to keep remembering to keep `reference.rst` in sync.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -110,6 +110,7 @@
 # directories to ignore when looking for source files.
 exclude_patterns = [
     "_build",
+    "**/.nox/**/*",
     "samples/AUTHORING_GUIDE.md",
     "samples/CONTRIBUTING.md",
     "samples/snippets/README.rst",


Test patch:
Repository: googleapis/python-bigquery

Issue:
Expand range for 'google-{api-core,cloud-core,resumable-media}' to allow 2.x versions



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -30,10 +30,10 @@
 release_status = "Development Status :: 5 - Production/Stable"
 dependencies = [
     "grpcio >= 1.38.1, < 2.0dev",  # https://github.com/googleapis/python-bigquery/issues/695
-    "google-api-core[grpc] >= 1.29.0, < 2.0.0dev",
+    "google-api-core[grpc] >= 1.29.0, < 3.0.0dev",
     "proto-plus >= 1.10.0",
-    "google-cloud-core >= 1.4.1, < 2.0dev",
-    "google-resumable-media >= 0.6.0, < 2.0dev",
+    "google-cloud-core >= 1.4.1, < 3.0dev",
+    "google-resumable-media >= 0.6.0, < 3.0dev",
     "packaging >= 14.3",
     "protobuf >= 3.12.0",
     "requests >= 2.18.0, < 3.0.0dev",


Test patch:
Repository: googleapis/python-bigquery

Issue:
ChunkedEncodingError is not retried when fetching data with list_rows()
Original issue: https://github.com/googleapis/python-bigquery-storage/issues/242

A user reported that they saw an error in production when fetching table data with `Client.list_rows()`. That method uses the [default retry object](https://github.com/googleapis/python-bigquery/blob/7e0e2bafc4c3f98a4246100f504fd78a01a28e7d/google/cloud/bigquery/retry.py#L49), which currently does not consider `requests.exceptions.ChunkedEncodingError` retryable.

(it does retry `requests.exceptions.ConnectionError`, but `ChunkedEncodingError` is not a subclass of that.


Discussion:

Resolving patch:
diff --git a/google/cloud/bigquery/retry.py b/google/cloud/bigquery/retry.py
--- a/google/cloud/bigquery/retry.py
+++ b/google/cloud/bigquery/retry.py
@@ -27,6 +27,7 @@
     exceptions.TooManyRequests,
     exceptions.InternalServerError,
     exceptions.BadGateway,
+    requests.exceptions.ChunkedEncodingError,
     requests.exceptions.ConnectionError,
     auth_exceptions.TransportError,
 )


Test patch:
diff --git a/tests/unit/test_retry.py b/tests/unit/test_retry.py
--- a/tests/unit/test_retry.py
+++ b/tests/unit/test_retry.py
@@ -51,6 +51,10 @@ def test_w_unstructured_requests_connectionerror(self):
         exc = requests.exceptions.ConnectionError()
         self.assertTrue(self._call_fut(exc))
 
+    def test_w_unstructured_requests_chunked_encoding_error(self):
+        exc = requests.exceptions.ChunkedEncodingError()
+        self.assertTrue(self._call_fut(exc))
+
     def test_w_auth_transporterror(self):
         from google.auth.exceptions import TransportError