@@ -12,7 +12,7 @@ This directory contains samples for Google Cloud Spanner. `Google Cloud Spanner`
1212
1313
1414
15- .. _Google Cloud Spanner : https://cloud.google.com/spanner/docs
15+ .. _Google Cloud Spanner : https://cloud.google.com/spanner/docs
1616
1717Setup
1818-------------------------------------------------------------------------------
@@ -59,7 +59,7 @@ Snippets
5959+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6060
6161.. image :: https://gstatic.com/cloudssh/images/open-btn.png
62- :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=spanner/cloud-client/snippets.py; spanner/cloud-client/README.rst
62+ :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=spanner/cloud-client/snippets.py, spanner/cloud-client/README.rst
6363
6464
6565
@@ -72,7 +72,7 @@ To run this sample:
7272
7373 usage: snippets.py [-h] [--database-id DATABASE_ID]
7474 instance_id
75- {create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
75+ {create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index,create_table_with_timestamp,insert_data_with_timestamp,add_timestamp_column,update_data_with_timestamp,query_data_with_timestamp }
7676 ...
7777
7878 This application demonstrates how to do basic operations using Cloud
@@ -82,7 +82,7 @@ To run this sample:
8282
8383 positional arguments:
8484 instance_id Your Cloud Spanner instance ID.
85- {create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
85+ {create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index,create_table_with_timestamp,insert_data_with_timestamp,add_timestamp_column,update_data_with_timestamp,query_data_with_timestamp }
8686 create_database Creates a database and tables for sample data.
8787 insert_data Inserts sample data into the given database. The
8888 database and table must already exist and can be
@@ -139,6 +139,34 @@ To run this sample:
139139 Inserts sample data into the given database. The
140140 database and table must already exist and can be
141141 created using ` create_database` .
142+ create_table_with_timestamp
143+ Creates a table with a COMMIT_TIMESTAMP column.
144+ insert_data_with_timestamp
145+ Inserts data with a COMMIT_TIMESTAMP field into a
146+ table.
147+ add_timestamp_column
148+ Adds a new TIMESTAMP column to the Albums table in the
149+ example database.
150+ update_data_with_timestamp
151+ Updates Performances tables in the database with the
152+ COMMIT_TIMESTAMP column. This updates the
153+ ` MarketingBudget` column which must be created before
154+ running this sample. You can add the column by running
155+ the ` add_column` sample or by running this DDL
156+ statement against your database: ALTER TABLE Albums
157+ ADD COLUMN MarketingBudget INT64 In addition this
158+ update expects the LastUpdateTime column added by
159+ applying this DDL statement against your database:
160+ ALTER TABLE Albums ADD COLUMN LastUpdateTime TIMESTAMP
161+ OPTIONS(allow_commit_timestamp=true)
162+ query_data_with_timestamp
163+ Queries sample data from the database using SQL. This
164+ updates the ` LastUpdateTime` column which must be
165+ created before running this sample. You can add the
166+ column by running the ` add_timestamp_column` sample or
167+ by running this DDL statement against your database:
168+ ALTER TABLE Performances ADD COLUMN LastUpdateTime
169+ TIMESTAMP OPTIONS (allow_commit_timestamp=true)
142170
143171 optional arguments:
144172 -h, --help show this help message and exit
0 commit comments