Skip to content

Commit c1ee8c2

Browse files
authored
feat: update query stats samples (#373)
1 parent ed9e124 commit c1ee8c2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

samples/samples/snippets.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,10 @@ def query_data_with_query_options(instance_id, database_id):
17031703
with database.snapshot() as snapshot:
17041704
results = snapshot.execute_sql(
17051705
"SELECT VenueId, VenueName, LastUpdateTime FROM Venues",
1706-
query_options={"optimizer_version": "1"},
1706+
query_options={
1707+
"optimizer_version": "1",
1708+
"optimizer_statistics_package": "latest"
1709+
},
17071710
)
17081711

17091712
for row in results:
@@ -1716,7 +1719,11 @@ def create_client_with_query_options(instance_id, database_id):
17161719
# [START spanner_create_client_with_query_options]
17171720
# instance_id = "your-spanner-instance"
17181721
# database_id = "your-spanner-db-id"
1719-
spanner_client = spanner.Client(query_options={"optimizer_version": "1"})
1722+
spanner_client = spanner.Client(
1723+
query_options={
1724+
"optimizer_version": "1",
1725+
"optimizer_statistics_package": "auto_20191128_14_47_22UTC"
1726+
})
17201727
instance = spanner_client.instance(instance_id)
17211728
database = instance.database(database_id)
17221729

0 commit comments

Comments
 (0)