714f5084c8653e1370aa72f25747e464a5ac6d11,spanner/cloud-client/snippets.py,,read_data_with_index,#Any#Any#,198
Before Change
database = instance.database(database_id)
keyset = spanner.KeySet(all_=True)
results = database.read(
table="Albums",
columns=("AlbumId", "AlbumTitle"),
keyset=keyset,
index="AlbumsByAlbumTitle")
for row in results:
print("AlbumId: {}, AlbumTitle: {}".format(*row))
def add_storing_index(instance_id, database_id):
Adds an storing index to the example database.
spanner_client = spanner.Client()
instance = spanner_client.instance(instance_id)
After Change
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)
with database.snapshot() as snapshot:
keyset = spanner.KeySet(all_=True)
results = snapshot.read(
table="Albums",
columns=("AlbumId", "AlbumTitle"),
keyset=keyset,
index="AlbumsByAlbumTitle")
for row in results:
print("AlbumId: {}, AlbumTitle: {}".format(*row))
def add_storing_index(instance_id, database_id):
Adds an storing index to the example database.
spanner_client = spanner.Client()
instance = spanner_client.instance(instance_id)
In pattern: SUPERPATTERN
Frequency: 6
Non-data size: 9
Instances
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/snippets.py
Class Name:
Method Name: read_data_with_index
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/snippets.py
Class Name:
Method Name: read_data_with_storing_index
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/snippets.py
Class Name:
Method Name: query_data_with_index
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/snippets.py
Class Name:
Method Name: query_data
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/snippets.py
Class Name:
Method Name: query_data_with_new_column
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 714f5084c8653e1370aa72f25747e464a5ac6d11
Time: 2017-08-29
Author: dpebot@google.com
File Name: spanner/cloud-client/quickstart.py
Class Name:
Method Name: run_quickstart