Skip to content

Commit

Permalink
Merge pull request #244 from GoogleCloudPlatform/spanner-cleanup
Browse files Browse the repository at this point in the history
Clean up Spanner region tags.
  • Loading branch information
jmdobry authored Mar 1, 2018
2 parents c691a87 + 5af6a2a commit fb76ce6
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions spanner/spanner_samples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

def create_database project_id:, instance_id:, database_id:
# [START create_database]
# [START spanner_create_database]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand Down Expand Up @@ -44,11 +44,11 @@ def create_database project_id:, instance_id:, database_id:
job.wait_until_done!

puts "Created database #{database_id} on instance #{instance_id}"
# [END create_database]
# [END spanner_create_database]
end

def insert_data project_id:, instance_id:, database_id:
# [START insert_data]
# [START spanner_insert_data]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand Down Expand Up @@ -76,11 +76,11 @@ def insert_data project_id:, instance_id:, database_id:
end

puts "Inserted data"
# [END insert_data]
# [END spanner_insert_data]
end

def query_data project_id:, instance_id:, database_id:
# [START query_data]
# [START spanner_query_data]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -93,11 +93,11 @@ def query_data project_id:, instance_id:, database_id:
client.execute("SELECT SingerId, AlbumId, AlbumTitle FROM Albums").rows.each do |row|
puts "#{row[:SingerId]} #{row[:AlbumId]} #{row[:AlbumTitle]}"
end
# [END query_data]
# [END spanner_query_data]
end

def read_data project_id:, instance_id:, database_id:
# [START read_data]
# [START spanner_read_data]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -110,11 +110,11 @@ def read_data project_id:, instance_id:, database_id:
client.read("Albums", [:SingerId, :AlbumId, :AlbumTitle]).rows.each do |row|
puts "#{row[:SingerId]} #{row[:AlbumId]} #{row[:AlbumTitle]}"
end
# [END read_data]
# [END spanner_read_data]
end

def read_stale_data project_id:, instance_id:, database_id:
# [START read_stale_data]
# [START spanner_read_stale_data]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -129,11 +129,11 @@ def read_stale_data project_id:, instance_id:, database_id:
puts "#{row[:SingerId]} #{row[:AlbumId]} #{row[:AlbumTitle]}"
end
end
# [END read_stale_data]
# [END spanner_read_stale_data]
end

def create_index project_id:, instance_id:, database_id:
# [START create_index]
# [START spanner_create_index]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -153,11 +153,11 @@ def create_index project_id:, instance_id:, database_id:
job.wait_until_done!

puts "Added the AlbumsByAlbumTitle index"
# [END create_index]
# [END spanner_create_index]
end

def create_storing_index project_id:, instance_id:, database_id:
# [START create_storing_index]
# [START spanner_create_storing_index]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -178,11 +178,11 @@ def create_storing_index project_id:, instance_id:, database_id:
job.wait_until_done!

puts "Added the AlbumsByAlbumTitle2 storing index"
# [END create_storing_index]
# [END spanner_create_storing_index]
end

def add_column project_id:, instance_id:, database_id:
# [START add_column]
# [START spanner_add_column]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -202,11 +202,11 @@ def add_column project_id:, instance_id:, database_id:
job.wait_until_done!

puts "Added the MarketingBudget column"
# [END add_column]
# [END spanner_add_column]
end

def update_data project_id:, instance_id:, database_id:
# [START update_data]
# [START spanner_update_data]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -224,11 +224,11 @@ def update_data project_id:, instance_id:, database_id:
end

puts "Updated data"
# [END update_data]
# [END spanner_update_data]
end

def query_data_with_new_column project_id:, instance_id:, database_id:
# [START query_data_with_new_column]
# [START spanner_query_data_with_new_column]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -241,11 +241,11 @@ def query_data_with_new_column project_id:, instance_id:, database_id:
client.execute("SELECT SingerId, AlbumId, MarketingBudget FROM Albums").rows.each do |row|
puts "#{row[:SingerId]} #{row[:AlbumId]} #{row[:MarketingBudget]}"
end
# [END query_data_with_new_column]
# [END spanner_query_data_with_new_column]
end

def read_write_transaction project_id:, instance_id:, database_id:
# [START read_write_transaction]
# [START spanner_read_write_transaction]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand Down Expand Up @@ -273,11 +273,11 @@ def read_write_transaction project_id:, instance_id:, database_id:
end

puts "Transaction complete"
# [END read_write_transaction]
# [END spanner_read_write_transaction]
end

def query_data_with_index project_id:, instance_id:, database_id:, start_title: "Ardvark", end_title: "Goo"
# [START query_data_with_index]
# [START spanner_query_data_with_index]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -299,11 +299,11 @@ def query_data_with_index project_id:, instance_id:, database_id:, start_title:
client.execute(sql_query, params: params, types: param_types).rows.each do |row|
puts "#{row[:AlbumId]} #{row[:AlbumTitle]} #{row[:MarketingBudget]}"
end
# [END query_data_with_index]
# [END spanner_query_data_with_index]
end

def read_data_with_index project_id:, instance_id:, database_id:
# [START read_data_with_index]
# [START spanner_read_data_with_index]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -319,11 +319,11 @@ def read_data_with_index project_id:, instance_id:, database_id:
result.rows.each do |row|
puts "#{row[:AlbumId]} #{row[:AlbumTitle]}"
end
# [END read_data_with_index]
# [END spanner_read_data_with_index]
end

def read_data_with_storing_index project_id:, instance_id:, database_id:
# [START read_data_with_storing_index]
# [START spanner_read_data_with_storing_index]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -339,11 +339,11 @@ def read_data_with_storing_index project_id:, instance_id:, database_id:
result.rows.each do |row|
puts "#{row[:AlbumId]} #{row[:AlbumTitle]} #{row[:MarketingBudget]}"
end
# [END read_data_with_storing_index]
# [END spanner_read_data_with_storing_index]
end

def read_only_transaction project_id:, instance_id:, database_id:
# [START read_only_transaction]
# [START spanner_read_only_transaction]
# project_id = "Your Google Cloud project ID"
# instance_id = "Your Spanner instance ID"
# database_id = "Your Spanner database ID"
Expand All @@ -364,7 +364,7 @@ def read_only_transaction project_id:, instance_id:, database_id:
puts "#{row[:AlbumId]} #{row[:AlbumTitle]} #{row[:SingerId]}"
end
end
# [END read_only_transaction]
# [END spanner_read_only_transaction]
end

def usage
Expand Down

0 comments on commit fb76ce6

Please sign in to comment.