Repository: googleapis/python-bigquery

Issue:
bug: Missing attribute: WKTReader
An issue that appears to be in this library popped up while running a test in a related bigquery library.

```
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/table.py:46: in <module>
    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
E   AttributeError: module 'shapely.geos' has no attribute 'WKTReader'
```

Based on a quick review, it appears that `shapely.geos` no longer has a `WKTReader` class and it appears that the `WKTReader` class has been removed from the library entirely and they might be relying on a function elsewhere in the codebase. If I had to wager a guess, I might look at the [from_wkt method in io.py](https://github.com/shapely/shapely/blob/e941610b0f748999aa1b6bb3ad3ec5eb6e20bc4e/shapely/io.py#L224).


#### Environment details

N/A

#### Steps to reproduce

N/A

#### Code example

N/A

#### Stack trace
```
nox > py.test --quiet --junitxml=prerelease_unit_3.8_sponge_log.xml tests/unit
ImportError while loading conftest '/tmpfs/src/github/python-bigquery-sqlalchemy/tests/unit/conftest.py'.
tests/unit/conftest.py:28: in <module>
    from . import fauxdbi
tests/unit/fauxdbi.py:29: in <module>
    import google.cloud.bigquery.schema
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/__init__.py:35: in <module>
    from google.cloud.bigquery.client import Client
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/client.py:63: in <module>
    from google.cloud.bigquery import _job_helpers
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/_job_helpers.py:24: in <module>
    from google.cloud.bigquery import job
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/job/__init__.py:27: in <module>
    from google.cloud.bigquery.job.copy_ import CopyJob
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/job/copy_.py:21: in <module>
    from google.cloud.bigquery.table import TableReference
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/table.py:46: in <module>
    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
E   AttributeError: module 'shapely.geos' has no attribute 'WKTReader'
```



Discussion:

Resolving patch:
diff --git a/google/cloud/bigquery/_pandas_helpers.py b/google/cloud/bigquery/_pandas_helpers.py
--- a/google/cloud/bigquery/_pandas_helpers.py
+++ b/google/cloud/bigquery/_pandas_helpers.py
@@ -57,15 +57,9 @@
     if pandas is not None:  # pragma: NO COVER
 
         def _to_wkb():
-            # Create a closure that:
-            # - Adds a not-null check. This allows the returned function to
-            #   be used directly with apply, unlike `shapely.wkb.dumps`.
-            # - Avoid extra work done by `shapely.wkb.dumps` that we don't need.
-            # - Caches the WKBWriter (and write method lookup :) )
-            # - Avoids adding WKBWriter, lgeos, and notnull to the module namespace.
-            from shapely.geos import WKBWriter, lgeos  # type: ignore
-
-            write = WKBWriter(lgeos).write
+            from shapely import wkb  # type: ignore
+
+            write = wkb.dumps
             notnull = pandas.notnull
 
             def _to_wkb(v):
diff --git a/google/cloud/bigquery/table.py b/google/cloud/bigquery/table.py
--- a/google/cloud/bigquery/table.py
+++ b/google/cloud/bigquery/table.py
@@ -39,11 +39,11 @@
     _COORDINATE_REFERENCE_SYSTEM = "EPSG:4326"
 
 try:
-    import shapely.geos  # type: ignore
+    import shapely  # type: ignore
 except ImportError:
     shapely = None
 else:
-    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
+    _read_wkt = shapely.wkt.loads
 
 import google.api_core.exceptions
 from google.api_core.page_iterator import HTTPIterator


Test patch: