Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit cb34e6b

Browse files
committed
Fixed geolography test failing issue
1 parent 00274e0 commit cb34e6b

3 files changed

Lines changed: 26 additions & 19 deletions

File tree

sqlalchemy_bigquery/base.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,19 @@ def _get_table(self, connection, table_name, schema=None):
972972
return table
973973

974974
def has_table(self, connection, table_name, schema=None, **kw):
975-
"""
976-
No kw are supported
975+
"""Checks whether a table exists in BigQuery.
976+
977+
Args:
978+
connection (google.cloud.bigquery.client.Client): The client
979+
object used to interact with BigQuery.
980+
table_name (str): The name of the table to check for.
981+
schema (str, optional): The name of the schema to which the table
982+
belongs. Defaults to the default schema.
983+
**kw (dict): Any extra keyword arguments will be ignored.
984+
985+
Returns:
986+
bool: True if the table exists, False otherwise.
987+
977988
"""
978989
try:
979990
self._get_table(connection, table_name, schema)

tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,21 @@
4141
QuotedNameArgumentTest,
4242
SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest,
4343
TimestampMicrosecondsTest as _TimestampMicrosecondsTest,
44-
TrueDivTest as _TrueDivTest,
45-
IntegerTest as _IntegerTest,
46-
NumericTest as _NumericTest,
47-
DifficultParametersTest as _DifficultParametersTest,
48-
FetchLimitOffsetTest as _FetchLimitOffsetTest,
4944
)
5045

5146
if packaging.version.parse(sqlalchemy.__version__) >= packaging.version.parse("2.0"):
5247
from sqlalchemy.sql import type_coerce
48+
from sqlalchemy.testing.suite import (
49+
TrueDivTest as _TrueDivTest,
50+
IntegerTest as _IntegerTest,
51+
NumericTest as _NumericTest,
52+
DifficultParametersTest as _DifficultParametersTest,
53+
FetchLimitOffsetTest as _FetchLimitOffsetTest,
54+
)
5355

5456
class TimestampMicrosecondsTest(_TimestampMicrosecondsTest):
5557
data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC)
5658

57-
# TimestampMicrosecondsTest literal() no literal_execute parameter? Go back and add to literal()"
58-
@pytest.mark.skip("")
59-
def test_literal(self, literal_round_trip):
60-
pass
61-
6259
def test_select_direct(self, connection):
6360
# This func added because this test was failing when passed the
6461
# UTC timezone.
@@ -93,14 +90,12 @@ def test_round_trip_executemany(self, connection):
9390
test_round_trip_executemany
9491
)
9592

96-
# TrueDivTest issue because SQLAlchemy always rounded down. The assertion cannot reconcile 1.5==1 thusly
9793
class TrueDivTest(_TrueDivTest):
98-
@pytest.mark.skip("Bigquery rounds based on datatype")
94+
@pytest.mark.skip("BQ rounds based on datatype")
9995
def test_floordiv_integer(self):
100-
# TODO: possibly compare rounded result instead?
10196
pass
10297

103-
@pytest.mark.skip("Bigquery rounds based on datatype")
98+
@pytest.mark.skip("BQ rounds based on datatype")
10499
def test_floordiv_integer_bound(self):
105100
pass
106101

@@ -138,7 +133,6 @@ class InsertBehaviorTest(_InsertBehaviorTest):
138133
def test_insert_from_select_autoinc(cls):
139134
pass
140135

141-
# TODO: Find cause of error
142136
@pytest.mark.skip(
143137
"BQ has no autoinc and client-side defaults can't work for select."
144138
)
@@ -167,7 +161,7 @@ def run(type_, input_, output, filter_=None, check_scale=False):
167161

168162
where_expr = True
169163

170-
# Adding where clause
164+
# Adding where clause for 2.0 compatibility
171165
connection.execute(t.delete().where(where_expr))
172166

173167
# test that this is actually a number!

tests/system/test_geography.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ def test_geoalchemy2_core(bigquery_dataset):
128128
int(
129129
list(
130130
conn.execute(
131-
select(lake_table.c.geog.st_area(), lake_table.c.name == "test2")
131+
select(lake_table.c.geog.st_area()).where(
132+
lake_table.c.name == "test2"
133+
)
132134
)
133135
)[0][0]
134136
)

0 commit comments

Comments
 (0)