Skip to content
Permalink
Browse files
feat: update query stats samples (#373)
  • Loading branch information
larkee committed Jun 22, 2021
1 parent ed9e124 commit c1ee8c2685a794f9f89329e16f7c461e135114af
Showing with 9 additions and 2 deletions.
  1. +9 −2 samples/samples/snippets.py
@@ -1703,7 +1703,10 @@ def query_data_with_query_options(instance_id, database_id):
with database.snapshot() as snapshot:
results = snapshot.execute_sql(
"SELECT VenueId, VenueName, LastUpdateTime FROM Venues",
query_options={"optimizer_version": "1"},
query_options={
"optimizer_version": "1",
"optimizer_statistics_package": "latest"
},
)

for row in results:
@@ -1716,7 +1719,11 @@ def create_client_with_query_options(instance_id, database_id):
# [START spanner_create_client_with_query_options]
# instance_id = "your-spanner-instance"
# database_id = "your-spanner-db-id"
spanner_client = spanner.Client(query_options={"optimizer_version": "1"})
spanner_client = spanner.Client(
query_options={
"optimizer_version": "1",
"optimizer_statistics_package": "auto_20191128_14_47_22UTC"
})
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

0 comments on commit c1ee8c2

Please sign in to comment.