FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: fix Shapely import in GEOGRAPHY sample by tswast · Pull Request #431 · googleapis/python-bigquery · GitHub

This repository was archived by the owner on Mar 6, 2026. It is now read-only.
/ python-bigquery Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 4 additions & 2 deletions samples/geography/insert_wkt.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def insert_wkt(override_values={}):
# [START bigquery_insert_geography_wkt]
from google.cloud import bigquery
import shapely
import shapely.geometry
import shapely.wkt

bigquery_client = bigquery.Client()
Expand All @@ -32,7 +32,9 @@ def insert_wkt(override_values={}):

# Use the Shapely library to generate WKT of a line from LAX to
# JFK airports. Alternatively, you may define WKT data directly.
my_geography = shapely.LineString([(-118.4085, 33.9416), (-73.7781, 40.6413)])
my_geography = shapely.geometry.LineString(
[(-118.4085, 33.9416), (-73.7781, 40.6413)]
)
rows = [
# Convert data into a WKT string.
{"geo": shapely.wkt.dumps(my_geography)},
Expand Down
6 changes: 3 additions & 3 deletions samples/geography/insert_wkt_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from . import insert_geojson
from . import insert_wkt


def test_insert_geojson(table_id):
errors = insert_geojson.insert_geojson(override_values={"table_id": table_id})
def test_insert_wkt(table_id):
errors = insert_wkt.insert_wkt(override_values={"table_id": table_id})
assert not errors

Back | FazBrowse Home | New Git URL