Skip to content

Commit b32fcb6

Browse files
committed
perf(sqlalchemy-bigquery): implement session-scoped table reuse for geography system tests
1 parent 5fe322d commit b32fcb6

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

packages/sqlalchemy-bigquery/tests/system/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ def bigquery_dataset(
9292
)
9393
view.view_query = f"SELECT string FROM `{dataset_id}.sample`"
9494
bigquery_client.create_table(view)
95+
96+
# Pre-create session-scoped lake table for geography tests
97+
lake_table = bigquery.Table(
98+
f"{project_id}.{dataset_id}.lake",
99+
schema=[
100+
bigquery.SchemaField("name", "STRING"),
101+
bigquery.SchemaField("geog", "GEOGRAPHY"),
102+
],
103+
)
104+
bigquery_client.create_table(lake_table)
105+
95106
yield dataset_id
96107
bigquery_client.delete_dataset(dataset_id, delete_contents=True)
97108

packages/sqlalchemy-bigquery/tests/system/test_geography.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ def test_geoalchemy2_core(engine, bigquery_dataset):
4040

4141
from sqlalchemy_bigquery import GEOGRAPHY
4242

43-
metadata = MetaData()
4443
lake_table = Table(
4544
"lake", metadata, Column("name", String), Column("geog", GEOGRAPHY)
4645
)
4746

48-
lake_table.create(engine)
49-
5047
# Insertions
5148

5249
conn = engine.connect()

0 commit comments

Comments
 (0)