Skip to content

Commit 62c1c2b

Browse files
committed
perf(sqlalchemy-bigquery): implement session-scoped table reuse for geography system tests
1 parent 7ed6861 commit 62c1c2b

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
@@ -38,13 +38,10 @@ def test_geoalchemy2_core(engine, bigquery_dataset):
3838

3939
from sqlalchemy_bigquery import GEOGRAPHY, WKT
4040

41-
metadata = MetaData()
4241
lake_table = Table(
4342
"lake", metadata, Column("name", String), Column("geog", GEOGRAPHY)
4443
)
4544

46-
lake_table.create(engine)
47-
4845
# Insertions
4946

5047
conn = engine.connect()

0 commit comments

Comments
 (0)