google-cloud-spanner 2.4.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +56 -0
- data/CONTRIBUTING.md +1 -1
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +1 -1
- data/lib/google-cloud-spanner.rb +2 -0
- data/lib/google/cloud/spanner/backup.rb +67 -4
- data/lib/google/cloud/spanner/backup/job.rb +8 -8
- data/lib/google/cloud/spanner/backup/job/list.rb +2 -2
- data/lib/google/cloud/spanner/backup/list.rb +2 -2
- data/lib/google/cloud/spanner/batch_snapshot.rb +11 -4
- data/lib/google/cloud/spanner/batch_update.rb +3 -1
- data/lib/google/cloud/spanner/client.rb +315 -83
- data/lib/google/cloud/spanner/commit.rb +4 -0
- data/lib/google/cloud/spanner/data.rb +4 -5
- data/lib/google/cloud/spanner/database.rb +88 -2
- data/lib/google/cloud/spanner/database/job/list.rb +2 -2
- data/lib/google/cloud/spanner/database/list.rb +4 -4
- data/lib/google/cloud/spanner/fields.rb +5 -3
- data/lib/google/cloud/spanner/instance.rb +91 -3
- data/lib/google/cloud/spanner/instance/config/list.rb +4 -4
- data/lib/google/cloud/spanner/instance/list.rb +4 -4
- data/lib/google/cloud/spanner/partition.rb +4 -2
- data/lib/google/cloud/spanner/policy.rb +3 -2
- data/lib/google/cloud/spanner/pool.rb +10 -10
- data/lib/google/cloud/spanner/project.rb +65 -5
- data/lib/google/cloud/spanner/results.rb +13 -9
- data/lib/google/cloud/spanner/service.rb +42 -23
- data/lib/google/cloud/spanner/session.rb +38 -15
- data/lib/google/cloud/spanner/snapshot.rb +10 -2
- data/lib/google/cloud/spanner/status.rb +4 -1
- data/lib/google/cloud/spanner/transaction.rb +61 -6
- data/lib/google/cloud/spanner/version.rb +1 -1
- metadata +10 -10
@@ -83,6 +83,7 @@ module Google
|
|
83
83
|
# | `BOOL` | `true`/`false` | |
|
84
84
|
# | `INT64` | `Integer` | |
|
85
85
|
# | `FLOAT64` | `Float` | |
|
86
|
+
# | `NUMERIC` | `BigDecimal` | |
|
86
87
|
# | `STRING` | `String` | |
|
87
88
|
# | `DATE` | `Date` | |
|
88
89
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -108,6 +109,7 @@ module Google
|
|
108
109
|
# * `:BYTES`
|
109
110
|
# * `:DATE`
|
110
111
|
# * `:FLOAT64`
|
112
|
+
# * `:NUMERIC`
|
111
113
|
# * `:INT64`
|
112
114
|
# * `:STRING`
|
113
115
|
# * `:TIMESTAMP`
|
@@ -125,6 +127,8 @@ module Google
|
|
125
127
|
# * `:optimizer_version` (String) The version of optimizer to use.
|
126
128
|
# Empty to use database default. "latest" to use the latest
|
127
129
|
# available optimizer version.
|
130
|
+
# * `:optimizer_statistics_package` (String) Statistics package to
|
131
|
+
# use. Empty to use the database default.
|
128
132
|
# @param [Hash] call_options A hash of values to specify the custom
|
129
133
|
# call options, e.g., timeout, retries, etc. Call options are
|
130
134
|
# optional. The following settings can be provided:
|
@@ -249,7 +253,10 @@ module Google
|
|
249
253
|
#
|
250
254
|
# db.snapshot do |snp|
|
251
255
|
# results = snp.execute_query \
|
252
|
-
# "SELECT * FROM users", query_options: {
|
256
|
+
# "SELECT * FROM users", query_options: {
|
257
|
+
# optimizer_version: "1",
|
258
|
+
# optimizer_statistics_package: "auto_20191128_14_47_22UTC"
|
259
|
+
# }
|
253
260
|
#
|
254
261
|
# results.rows.each do |row|
|
255
262
|
# puts "User #{row[:id]} is #{row[:name]}"
|
@@ -373,12 +380,13 @@ module Google
|
|
373
380
|
# Hash values must contain the type value. If a Hash is used the
|
374
381
|
# fields will be created using the same order as the Hash keys.
|
375
382
|
#
|
376
|
-
# Supported type values
|
383
|
+
# Supported type values include:
|
377
384
|
#
|
378
385
|
# * `:BOOL`
|
379
386
|
# * `:BYTES`
|
380
387
|
# * `:DATE`
|
381
388
|
# * `:FLOAT64`
|
389
|
+
# * `:NUMERIC`
|
382
390
|
# * `:INT64`
|
383
391
|
# * `:STRING`
|
384
392
|
# * `:TIMESTAMP`
|
@@ -113,6 +113,7 @@ module Google
|
|
113
113
|
# | `BOOL` | `true`/`false` | |
|
114
114
|
# | `INT64` | `Integer` | |
|
115
115
|
# | `FLOAT64` | `Float` | |
|
116
|
+
# | `NUMERIC` | `BigDecimal` | |
|
116
117
|
# | `STRING` | `String` | |
|
117
118
|
# | `DATE` | `Date` | |
|
118
119
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -138,6 +139,7 @@ module Google
|
|
138
139
|
# * `:BYTES`
|
139
140
|
# * `:DATE`
|
140
141
|
# * `:FLOAT64`
|
142
|
+
# * `:NUMERIC`
|
141
143
|
# * `:INT64`
|
142
144
|
# * `:STRING`
|
143
145
|
# * `:TIMESTAMP`
|
@@ -155,6 +157,16 @@ module Google
|
|
155
157
|
# * `:optimizer_version` (String) The version of optimizer to use.
|
156
158
|
# Empty to use database default. "latest" to use the latest
|
157
159
|
# available optimizer version.
|
160
|
+
# * `:optimizer_statistics_package` (String) Statistics package to
|
161
|
+
# use. Empty to use the database default.
|
162
|
+
# @param [Hash] request_options Common request options.
|
163
|
+
#
|
164
|
+
# * `:priority` (String) The relative priority for requests.
|
165
|
+
# The priority acts as a hint to the Cloud Spanner scheduler
|
166
|
+
# and does not guarantee priority or order of execution.
|
167
|
+
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
168
|
+
# `:PRIORITY_HIGH`. If priority not set then default is
|
169
|
+
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
158
170
|
# @param [Hash] call_options A hash of values to specify the custom
|
159
171
|
# call options, e.g., timeout, retries, etc. Call options are
|
160
172
|
# optional. The following settings can be provided:
|
@@ -280,7 +292,10 @@ module Google
|
|
280
292
|
#
|
281
293
|
# db.transaction do |tx|
|
282
294
|
# results = tx.execute_query \
|
283
|
-
# "SELECT * FROM users", query_options: {
|
295
|
+
# "SELECT * FROM users", query_options: {
|
296
|
+
# optimizer_version: "1",
|
297
|
+
# optimizer_statistics_package: "auto_20191128_14_47_22UTC"
|
298
|
+
# }
|
284
299
|
#
|
285
300
|
# results.rows.each do |row|
|
286
301
|
# puts "User #{row[:id]} is #{row[:name]}"
|
@@ -312,7 +327,7 @@ module Google
|
|
312
327
|
# end
|
313
328
|
#
|
314
329
|
def execute_query sql, params: nil, types: nil, query_options: nil,
|
315
|
-
call_options: nil
|
330
|
+
request_options: nil, call_options: nil
|
316
331
|
ensure_session!
|
317
332
|
|
318
333
|
@seqno += 1
|
@@ -321,6 +336,7 @@ module Google
|
|
321
336
|
session.execute_query sql, params: params, types: types,
|
322
337
|
transaction: tx_selector, seqno: @seqno,
|
323
338
|
query_options: query_options,
|
339
|
+
request_options: request_options,
|
324
340
|
call_options: call_options
|
325
341
|
end
|
326
342
|
alias execute execute_query
|
@@ -350,6 +366,7 @@ module Google
|
|
350
366
|
# | `BOOL` | `true`/`false` | |
|
351
367
|
# | `INT64` | `Integer` | |
|
352
368
|
# | `FLOAT64` | `Float` | |
|
369
|
+
# | `NUMERIC` | `BigDecimal` | |
|
353
370
|
# | `STRING` | `String` | |
|
354
371
|
# | `DATE` | `Date` | |
|
355
372
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -376,6 +393,7 @@ module Google
|
|
376
393
|
# * `:BYTES`
|
377
394
|
# * `:DATE`
|
378
395
|
# * `:FLOAT64`
|
396
|
+
# * `:NUMERIC`
|
379
397
|
# * `:INT64`
|
380
398
|
# * `:STRING`
|
381
399
|
# * `:TIMESTAMP`
|
@@ -391,6 +409,16 @@ module Google
|
|
391
409
|
# * `:optimizer_version` (String) The version of optimizer to use.
|
392
410
|
# Empty to use database default. "latest" to use the latest
|
393
411
|
# available optimizer version.
|
412
|
+
# * `:optimizer_statistics_package` (String) Statistics package to
|
413
|
+
# use. Empty to use the database default.
|
414
|
+
# @param [Hash] request_options Common request options.
|
415
|
+
#
|
416
|
+
# * `:priority` (String) The relative priority for requests.
|
417
|
+
# The priority acts as a hint to the Cloud Spanner scheduler
|
418
|
+
# and does not guarantee priority or order of execution.
|
419
|
+
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
420
|
+
# `:PRIORITY_HIGH`. If priority not set then default is
|
421
|
+
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
394
422
|
# @param [Hash] call_options A hash of values to specify the custom
|
395
423
|
# call options, e.g., timeout, retries, etc. Call options are
|
396
424
|
# optional. The following settings can be provided:
|
@@ -441,7 +469,10 @@ module Google
|
|
441
469
|
# db.transaction do |tx|
|
442
470
|
# row_count = tx.execute_update(
|
443
471
|
# "UPDATE users SET name = 'Charlie' WHERE id = 1",
|
444
|
-
# query_options: {
|
472
|
+
# query_options: {
|
473
|
+
# optimizer_version: "1",
|
474
|
+
# optimizer_statistics_package: "auto_20191128_14_47_22UTC"
|
475
|
+
# }
|
445
476
|
# )
|
446
477
|
# end
|
447
478
|
#
|
@@ -468,9 +499,10 @@ module Google
|
|
468
499
|
# end
|
469
500
|
#
|
470
501
|
def execute_update sql, params: nil, types: nil, query_options: nil,
|
471
|
-
call_options: nil
|
502
|
+
request_options: nil, call_options: nil
|
472
503
|
results = execute_query sql, params: params, types: types,
|
473
504
|
query_options: query_options,
|
505
|
+
request_options: request_options,
|
474
506
|
call_options: call_options
|
475
507
|
# Stream all PartialResultSet to get ResultSetStats
|
476
508
|
results.rows.to_a
|
@@ -485,6 +517,14 @@ module Google
|
|
485
517
|
##
|
486
518
|
# Executes DML statements in a batch.
|
487
519
|
#
|
520
|
+
# @param [Hash] request_options Common request options.
|
521
|
+
#
|
522
|
+
# * `:priority` (String) The relative priority for requests.
|
523
|
+
# The priority acts as a hint to the Cloud Spanner scheduler
|
524
|
+
# and does not guarantee priority or order of execution.
|
525
|
+
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
526
|
+
# `:PRIORITY_HIGH`. If priority not set then default is
|
527
|
+
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
488
528
|
# @param [Hash] call_options A hash of values to specify the custom
|
489
529
|
# call options, e.g., timeout, retries, etc. Call options are
|
490
530
|
# optional. The following settings can be provided:
|
@@ -554,10 +594,11 @@ module Google
|
|
554
594
|
# end
|
555
595
|
# end
|
556
596
|
#
|
557
|
-
def batch_update call_options: nil, &block
|
597
|
+
def batch_update request_options: nil, call_options: nil, &block
|
558
598
|
ensure_session!
|
559
599
|
@seqno += 1
|
560
600
|
session.batch_update tx_selector, @seqno,
|
601
|
+
request_options: request_options,
|
561
602
|
call_options: call_options, &block
|
562
603
|
end
|
563
604
|
|
@@ -577,6 +618,14 @@ module Google
|
|
577
618
|
# Optional.
|
578
619
|
# @param [Integer] limit If greater than zero, no more than this number
|
579
620
|
# of rows will be returned. The default is no limit.
|
621
|
+
# @param [Hash] request_options Common request options.
|
622
|
+
#
|
623
|
+
# * `:priority` (String) The relative priority for requests.
|
624
|
+
# The priority acts as a hint to the Cloud Spanner scheduler
|
625
|
+
# and does not guarantee priority or order of execution.
|
626
|
+
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
627
|
+
# `:PRIORITY_HIGH`. If priority not set then default is
|
628
|
+
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
580
629
|
# @param [Hash] call_options A hash of values to specify the custom
|
581
630
|
# call options, e.g., timeout, retries, etc. Call options are
|
582
631
|
# optional. The following settings can be provided:
|
@@ -609,7 +658,7 @@ module Google
|
|
609
658
|
# end
|
610
659
|
#
|
611
660
|
def read table, columns, keys: nil, index: nil, limit: nil,
|
612
|
-
call_options: nil
|
661
|
+
request_options: nil, call_options: nil
|
613
662
|
ensure_session!
|
614
663
|
|
615
664
|
columns = Array(columns).map(&:to_s)
|
@@ -617,6 +666,7 @@ module Google
|
|
617
666
|
|
618
667
|
session.read table, columns, keys: keys, index: index, limit: limit,
|
619
668
|
transaction: tx_selector,
|
669
|
+
request_options: request_options,
|
620
670
|
call_options: call_options
|
621
671
|
end
|
622
672
|
|
@@ -641,6 +691,7 @@ module Google
|
|
641
691
|
# | `BOOL` | `true`/`false` | |
|
642
692
|
# | `INT64` | `Integer` | |
|
643
693
|
# | `FLOAT64` | `Float` | |
|
694
|
+
# | `NUMERIC` | `BigDecimal` | |
|
644
695
|
# | `STRING` | `String` | |
|
645
696
|
# | `DATE` | `Date` | |
|
646
697
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -687,6 +738,7 @@ module Google
|
|
687
738
|
# | `BOOL` | `true`/`false` | |
|
688
739
|
# | `INT64` | `Integer` | |
|
689
740
|
# | `FLOAT64` | `Float` | |
|
741
|
+
# | `NUMERIC` | `BigDecimal` | |
|
690
742
|
# | `STRING` | `String` | |
|
691
743
|
# | `DATE` | `Date` | |
|
692
744
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -732,6 +784,7 @@ module Google
|
|
732
784
|
# | `BOOL` | `true`/`false` | |
|
733
785
|
# | `INT64` | `Integer` | |
|
734
786
|
# | `FLOAT64` | `Float` | |
|
787
|
+
# | `NUMERIC` | `BigDecimal` | |
|
735
788
|
# | `STRING` | `String` | |
|
736
789
|
# | `DATE` | `Date` | |
|
737
790
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -779,6 +832,7 @@ module Google
|
|
779
832
|
# | `BOOL` | `true`/`false` | |
|
780
833
|
# | `INT64` | `Integer` | |
|
781
834
|
# | `FLOAT64` | `Float` | |
|
835
|
+
# | `NUMERIC` | `BigDecimal` | |
|
782
836
|
# | `STRING` | `String` | |
|
783
837
|
# | `DATE` | `Date` | |
|
784
838
|
# | `TIMESTAMP` | `Time`, `DateTime` | |
|
@@ -880,6 +934,7 @@ module Google
|
|
880
934
|
# * `:BYTES`
|
881
935
|
# * `:DATE`
|
882
936
|
# * `:FLOAT64`
|
937
|
+
# * `:NUMERIC`
|
883
938
|
# * `:INT64`
|
884
939
|
# * `:STRING`
|
885
940
|
# * `:TIMESTAMP`
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-spanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
90
|
+
version: 1.25.1
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.
|
97
|
+
version: 1.25.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: minitest
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,28 +227,28 @@ dependencies:
|
|
227
227
|
requirements:
|
228
228
|
- - "~>"
|
229
229
|
- !ruby/object:Gem::Version
|
230
|
-
version: 1.
|
230
|
+
version: '1.36'
|
231
231
|
type: :development
|
232
232
|
prerelease: false
|
233
233
|
version_requirements: !ruby/object:Gem::Requirement
|
234
234
|
requirements:
|
235
235
|
- - "~>"
|
236
236
|
- !ruby/object:Gem::Version
|
237
|
-
version: 1.
|
237
|
+
version: '1.36'
|
238
238
|
- !ruby/object:Gem::Dependency
|
239
239
|
name: grpc-tools
|
240
240
|
requirement: !ruby/object:Gem::Requirement
|
241
241
|
requirements:
|
242
242
|
- - "~>"
|
243
243
|
- !ruby/object:Gem::Version
|
244
|
-
version: 1.
|
244
|
+
version: '1.36'
|
245
245
|
type: :development
|
246
246
|
prerelease: false
|
247
247
|
version_requirements: !ruby/object:Gem::Requirement
|
248
248
|
requirements:
|
249
249
|
- - "~>"
|
250
250
|
- !ruby/object:Gem::Version
|
251
|
-
version: 1.
|
251
|
+
version: '1.36'
|
252
252
|
description: google-cloud-spanner is the official library for Google Cloud Spanner
|
253
253
|
API.
|
254
254
|
email:
|
@@ -324,14 +324,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
324
324
|
requirements:
|
325
325
|
- - ">="
|
326
326
|
- !ruby/object:Gem::Version
|
327
|
-
version: '2.
|
327
|
+
version: '2.5'
|
328
328
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
329
329
|
requirements:
|
330
330
|
- - ">="
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
|
-
rubygems_version: 3.2.
|
334
|
+
rubygems_version: 3.2.17
|
335
335
|
signing_key:
|
336
336
|
specification_version: 4
|
337
337
|
summary: API Client library for Google Cloud Spanner API
|