Skip to content

Commit

Permalink
feat: update query stats samples (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
larkee authored Jun 22, 2021
1 parent ed9e124 commit c1ee8c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions samples/samples/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit c1ee8c2

Please sign in to comment.