Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup spanner tests. #1633

Merged
merged 2 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spanner/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-spanner==1.3.0
google-cloud-spanner==1.4.0
futures==3.2.0; python_version < "3"
14 changes: 7 additions & 7 deletions spanner/cloud-client/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ def read_stale_data(instance_id, database_id):
keyset = spanner.KeySet(all_=True)
results = snapshot.read(
table='Albums',
columns=('SingerId', 'AlbumId', 'AlbumTitle',),
columns=('SingerId', 'AlbumId', 'MarketingBudget',),
keyset=keyset)

for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))
print(u'SingerId: {}, AlbumId: {}, MarketingBudget: {}'.format(
*row))
# [END spanner_read_stale_data]


Expand Down Expand Up @@ -562,9 +563,8 @@ def update_data_with_timestamp(instance_id, database_id):
columns=(
'SingerId', 'AlbumId', 'MarketingBudget', 'LastUpdateTime'),
values=[
(1, 4, 11000, spanner.COMMIT_TIMESTAMP),
(1, 19, 15000, spanner.COMMIT_TIMESTAMP),
(2, 42, 7000, spanner.COMMIT_TIMESTAMP)])
(1, 1, 1000000, spanner.COMMIT_TIMESTAMP),
(2, 2, 750000, spanner.COMMIT_TIMESTAMP)])

print('Updated data.')
# [END spanner_update_data_with_timestamp_column]
Expand All @@ -590,11 +590,11 @@ def query_data_with_timestamp(instance_id, database_id):

with database.snapshot() as snapshot:
results = snapshot.execute_sql(
'SELECT SingerId, AlbumId, AlbumTitle FROM Albums '
'SELECT SingerId, AlbumId, MarketingBudget FROM Albums '
'ORDER BY LastUpdateTime DESC')

for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))
print(u'SingerId: {}, AlbumId: {}, MarketingBudget: {}'.format(*row))
# [END spanner_query_data_with_timestamp_column]


Expand Down
Loading