google-cloud-spanner 2.21.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/lib/google/cloud/spanner/admin/database.rb +9 -11
  4. data/lib/google/cloud/spanner/admin/instance.rb +9 -11
  5. data/lib/google/cloud/spanner/backup/job/list.rb +1 -2
  6. data/lib/google/cloud/spanner/backup/job.rb +1 -2
  7. data/lib/google/cloud/spanner/backup/list.rb +1 -3
  8. data/lib/google/cloud/spanner/backup/restore/job.rb +1 -2
  9. data/lib/google/cloud/spanner/batch_client.rb +3 -2
  10. data/lib/google/cloud/spanner/batch_snapshot.rb +14 -9
  11. data/lib/google/cloud/spanner/batch_update.rb +3 -2
  12. data/lib/google/cloud/spanner/batch_write.rb +72 -0
  13. data/lib/google/cloud/spanner/batch_write_results.rb +142 -0
  14. data/lib/google/cloud/spanner/client.rb +245 -28
  15. data/lib/google/cloud/spanner/commit.rb +4 -0
  16. data/lib/google/cloud/spanner/convert.rb +2 -2
  17. data/lib/google/cloud/spanner/database/job/list.rb +1 -2
  18. data/lib/google/cloud/spanner/database/job.rb +2 -4
  19. data/lib/google/cloud/spanner/database/list.rb +2 -3
  20. data/lib/google/cloud/spanner/fields.rb +2 -1
  21. data/lib/google/cloud/spanner/instance/config/list.rb +2 -3
  22. data/lib/google/cloud/spanner/instance/job.rb +2 -3
  23. data/lib/google/cloud/spanner/instance/list.rb +2 -3
  24. data/lib/google/cloud/spanner/lar_headers.rb +4 -0
  25. data/lib/google/cloud/spanner/mutation_group.rb +288 -0
  26. data/lib/google/cloud/spanner/project.rb +9 -27
  27. data/lib/google/cloud/spanner/results.rb +2 -2
  28. data/lib/google/cloud/spanner/service.rb +32 -6
  29. data/lib/google/cloud/spanner/session.rb +167 -17
  30. data/lib/google/cloud/spanner/snapshot.rb +5 -2
  31. data/lib/google/cloud/spanner/transaction.rb +18 -3
  32. data/lib/google/cloud/spanner/version.rb +1 -1
  33. data/lib/google-cloud-spanner.rb +6 -3
  34. metadata +26 -191
@@ -18,6 +18,7 @@ require "google/cloud/spanner/results"
18
18
  require "google/cloud/spanner/commit"
19
19
  require "google/cloud/spanner/commit_response"
20
20
  require "google/cloud/spanner/batch_update"
21
+ require "google/cloud/spanner/batch_write"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -116,6 +117,7 @@ module Google
116
117
  # | `BOOL` | `true`/`false` | |
117
118
  # | `INT64` | `Integer` | |
118
119
  # | `FLOAT64` | `Float` | |
120
+ # | `FLOAT32` | `Float` | |
119
121
  # | `NUMERIC` | `BigDecimal` | |
120
122
  # | `STRING` | `String` | |
121
123
  # | `DATE` | `Date` | |
@@ -142,6 +144,7 @@ module Google
142
144
  # * `:BYTES`
143
145
  # * `:DATE`
144
146
  # * `:FLOAT64`
147
+ # * `:FLOAT32`
145
148
  # * `:NUMERIC`
146
149
  # * `:INT64`
147
150
  # * `:STRING`
@@ -562,6 +565,9 @@ module Google
562
565
  # @param [String] transaction_id The identifier of previously-started
563
566
  # transaction to be used instead of starting a new transaction.
564
567
  # Optional.
568
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
569
+ # mutations will not be recorded in change streams with DDL option
570
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
565
571
  # @param [Hash] commit_options A hash of commit options.
566
572
  # e.g., return_commit_stats. Commit options are optional.
567
573
  # The following options can be provided:
@@ -639,13 +645,14 @@ module Google
639
645
  # puts commit_resp.timestamp
640
646
  # puts commit_resp.stats.mutation_count
641
647
  #
642
- def commit transaction_id: nil, commit_options: nil,
643
- request_options: nil, call_options: nil
648
+ def commit transaction_id: nil, exclude_txn_from_change_streams: false,
649
+ commit_options: nil, request_options: nil, call_options: nil
644
650
  ensure_service!
645
651
  commit = Commit.new
646
652
  yield commit
647
653
  commit_resp = service.commit path, commit.mutations,
648
654
  transaction_id: transaction_id,
655
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
649
656
  commit_options: commit_options,
650
657
  request_options: request_options,
651
658
  call_options: call_options
@@ -654,6 +661,103 @@ module Google
654
661
  commit_options ? resp : resp.timestamp
655
662
  end
656
663
 
664
+ ##
665
+ # Batches the supplied mutation groups in a collection of efficient
666
+ # transactions.
667
+ #
668
+ # All mutations in a group are committed atomically. However, mutations
669
+ # across groups can be committed non-atomically in an unspecified order
670
+ # and thus they must be independent of each other. Partial failure is
671
+ # possible, i.e., some groups may have been committed successfully,
672
+ # while others may have failed. The results of individual batches are
673
+ # streamed into the response as the batches are applied.
674
+ #
675
+ # BatchWrite requests are not replay protected, meaning that each mutation
676
+ # group may be applied more than once. Replays of non-idempotent mutations
677
+ # may have undesirable effects. For example, replays of an insert mutation
678
+ # may produce an already exists error or if you use generated or commit
679
+ # timestamp-based keys, it may result in additional rows being added to the
680
+ # mutation's table. We recommend structuring your mutation groups to be
681
+ # idempotent to avoid this issue.
682
+ #
683
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
684
+ # mutations will not be recorded in change streams with DDL option
685
+ # `allow_txn_exclusion=true`.
686
+ # @param [Hash] request_options Common request options.
687
+ #
688
+ # * `:priority` (String) The relative priority for requests.
689
+ # The priority acts as a hint to the Cloud Spanner scheduler
690
+ # and does not guarantee priority or order of execution.
691
+ # Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
692
+ # `:PRIORITY_HIGH`. If priority not set then default is
693
+ # `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
694
+ # * `:tag` (String) A per-request tag which can be applied to
695
+ # queries or reads, used for statistics collection. Tag must be a
696
+ # valid identifier of the form: `[a-zA-Z][a-zA-Z0-9_\-]` between 2
697
+ # and 64 characters in length.
698
+ #
699
+ # @param [Hash] call_options A hash of values to specify the custom
700
+ # call options, e.g., timeout, retries, etc. Call options are
701
+ # optional. The following settings can be provided:
702
+ #
703
+ # * `:timeout` (Numeric) A numeric value of custom timeout in seconds
704
+ # that overrides the default setting.
705
+ # * `:retry_policy` (Hash) A hash of values that overrides the default
706
+ # setting of retry policy with the following keys:
707
+ # * `:initial_delay` (`Numeric`) - The initial delay in seconds.
708
+ # * `:max_delay` (`Numeric`) - The max delay in seconds.
709
+ # * `:multiplier` (`Numeric`) - The incremental backoff multiplier.
710
+ # * `:retry_codes` (`Array<String>`) - The error codes that should
711
+ # trigger a retry.
712
+ #
713
+ # @yield [batch_write] a batch write object
714
+ # @yieldparam [Google::Cloud::Spanner::BatchWrite] batch_write a batch
715
+ # write object used to add mutaion groups through {MutationGroup}.
716
+ #
717
+ # @return [Google::Cloud::Spanner::BatchWriteResults] The results of
718
+ # the batch write operation. This is a stream of responses, each
719
+ # covering a set of the mutation groups that were either applied or
720
+ # failed together.
721
+ #
722
+ # @example
723
+ # require "google/cloud/spanner"
724
+ #
725
+ # spanner = Google::Cloud::Spanner.new
726
+ #
727
+ # db = spanner.client "my-instance", "my-database"
728
+ #
729
+ # results = db.batch_write do |b|
730
+ # # First mutation group
731
+ # b.mutation_group do |mg|
732
+ # mg.upsert "Singers", [{ SingerId: 16, FirstName: "Charlie", LastName: "Terry" }]
733
+ # end
734
+ #
735
+ # # Second mutation group
736
+ # b.mutation_group do |mg|
737
+ # mg.upsert "Singers", [{ SingerId: 17, FirstName: "Catalina", LastName: "Smith" }]
738
+ # mg.update "Albums", [{ SingerId: 17, AlbumId: 1, AlbumTitle: "Go Go Go" }]
739
+ # end
740
+ # end
741
+ #
742
+ # results.each do |response|
743
+ # puts "groups applied: #{response.indexes}" if response.ok?
744
+ # end
745
+ #
746
+ def batch_write exclude_txn_from_change_streams: false,
747
+ request_options: nil,
748
+ call_options: nil
749
+ ensure_service!
750
+ b = BatchWrite.new
751
+ yield b
752
+ response = service.batch_write path, b.mutation_groups_grpc,
753
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
754
+ request_options: request_options,
755
+ call_options: call_options
756
+ results = BatchWriteResults.new response
757
+ @last_updated_at = Time.now
758
+ results
759
+ end
760
+
657
761
  ##
658
762
  # Inserts or updates rows in a table. If any of the rows already exist,
659
763
  # then its column values are overwritten with the ones provided. Any
@@ -672,6 +776,7 @@ module Google
672
776
  # | `BOOL` | `true`/`false` | |
673
777
  # | `INT64` | `Integer` | |
674
778
  # | `FLOAT64` | `Float` | |
779
+ # | `FLOAT32` | `Float` | |
675
780
  # | `NUMERIC` | `BigDecimal` | |
676
781
  # | `STRING` | `String` | |
677
782
  # | `DATE` | `Date` | |
@@ -682,6 +787,12 @@ module Google
682
787
  # See [Data
683
788
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
684
789
  #
790
+ # @param [String] transaction_id The identifier of previously-started
791
+ # transaction to be used instead of starting a new transaction.
792
+ # Optional.
793
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
794
+ # mutations will not be recorded in change streams with DDL option
795
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
685
796
  # @param [Hash] commit_options A hash of commit options.
686
797
  # e.g., return_commit_stats. Commit options are optional.
687
798
  # The following options can be provided:
@@ -752,10 +863,12 @@ module Google
752
863
  # puts commit_resp.timestamp
753
864
  # puts commit_resp.stats.mutation_count
754
865
  #
755
- def upsert table, *rows, transaction_id: nil, commit_options: nil,
756
- request_options: nil, call_options: nil
866
+ def upsert table, *rows,
867
+ transaction_id: nil, exclude_txn_from_change_streams: false,
868
+ commit_options: nil, request_options: nil, call_options: nil
757
869
  opts = {
758
870
  transaction_id: transaction_id,
871
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
759
872
  commit_options: commit_options,
760
873
  request_options: request_options,
761
874
  call_options: call_options
@@ -783,6 +896,7 @@ module Google
783
896
  # | `BOOL` | `true`/`false` | |
784
897
  # | `INT64` | `Integer` | |
785
898
  # | `FLOAT64` | `Float` | |
899
+ # | `FLOAT32` | `Float` | |
786
900
  # | `NUMERIC` | `BigDecimal` | |
787
901
  # | `STRING` | `String` | |
788
902
  # | `DATE` | `Date` | |
@@ -793,6 +907,12 @@ module Google
793
907
  # See [Data
794
908
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
795
909
  #
910
+ # @param [String] transaction_id The identifier of previously-started
911
+ # transaction to be used instead of starting a new transaction.
912
+ # Optional.
913
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
914
+ # mutations will not be recorded in change streams with DDL option
915
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
796
916
  # @param [Hash] commit_options A hash of commit options.
797
917
  # e.g., return_commit_stats. Commit options are optional.
798
918
  # The following options can be provided:
@@ -863,10 +983,12 @@ module Google
863
983
  # puts commit_resp.timestamp
864
984
  # puts commit_resp.stats.mutation_count
865
985
  #
866
- def insert table, *rows, transaction_id: nil, commit_options: nil,
867
- request_options: nil, call_options: nil
986
+ def insert table, *rows,
987
+ transaction_id: nil, exclude_txn_from_change_streams: false,
988
+ commit_options: nil, request_options: nil, call_options: nil
868
989
  opts = {
869
990
  transaction_id: transaction_id,
991
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
870
992
  commit_options: commit_options,
871
993
  request_options: request_options,
872
994
  call_options: call_options
@@ -893,6 +1015,7 @@ module Google
893
1015
  # | `BOOL` | `true`/`false` | |
894
1016
  # | `INT64` | `Integer` | |
895
1017
  # | `FLOAT64` | `Float` | |
1018
+ # | `FLOAT32` | `Float` | |
896
1019
  # | `NUMERIC` | `BigDecimal` | |
897
1020
  # | `STRING` | `String` | |
898
1021
  # | `DATE` | `Date` | |
@@ -903,6 +1026,12 @@ module Google
903
1026
  # See [Data
904
1027
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
905
1028
  #
1029
+ # @param [String] transaction_id The identifier of previously-started
1030
+ # transaction to be used instead of starting a new transaction.
1031
+ # Optional.
1032
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
1033
+ # mutations will not be recorded in change streams with DDL option
1034
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
906
1035
  # @param [Hash] commit_options A hash of commit options.
907
1036
  # e.g., return_commit_stats. Commit options are optional.
908
1037
  # The following options can be provided:
@@ -973,10 +1102,12 @@ module Google
973
1102
  # puts commit_resp.timestamp
974
1103
  # puts commit_resp.stats.mutation_count
975
1104
  #
976
- def update table, *rows, transaction_id: nil, commit_options: nil,
977
- request_options: nil, call_options: nil
1105
+ def update table, *rows,
1106
+ transaction_id: nil, exclude_txn_from_change_streams: false,
1107
+ commit_options: nil, request_options: nil, call_options: nil
978
1108
  opts = {
979
1109
  transaction_id: transaction_id,
1110
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
980
1111
  commit_options: commit_options,
981
1112
  request_options: request_options,
982
1113
  call_options: call_options
@@ -1005,6 +1136,7 @@ module Google
1005
1136
  # | `BOOL` | `true`/`false` | |
1006
1137
  # | `INT64` | `Integer` | |
1007
1138
  # | `FLOAT64` | `Float` | |
1139
+ # | `FLOAT32` | `Float` | |
1008
1140
  # | `NUMERIC` | `BigDecimal` | |
1009
1141
  # | `STRING` | `String` | |
1010
1142
  # | `DATE` | `Date` | |
@@ -1015,6 +1147,12 @@ module Google
1015
1147
  # See [Data
1016
1148
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
1017
1149
  #
1150
+ # @param [String] transaction_id The identifier of previously-started
1151
+ # transaction to be used instead of starting a new transaction.
1152
+ # Optional.
1153
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
1154
+ # mutations will not be recorded in change streams with DDL option
1155
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
1018
1156
  # @param [Hash] commit_options A hash of commit options.
1019
1157
  # e.g., return_commit_stats. Commit options are optional.
1020
1158
  # The following options can be provided:
@@ -1086,10 +1224,12 @@ module Google
1086
1224
  # puts commit_resp.timestamp
1087
1225
  # puts commit_resp.stats.mutation_count
1088
1226
  #
1089
- def replace table, *rows, transaction_id: nil, commit_options: nil,
1090
- request_options: nil, call_options: nil
1227
+ def replace table, *rows,
1228
+ transaction_id: nil, exclude_txn_from_change_streams: false,
1229
+ commit_options: nil, request_options: nil, call_options: nil
1091
1230
  opts = {
1092
1231
  transaction_id: transaction_id,
1232
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
1093
1233
  commit_options: commit_options,
1094
1234
  request_options: request_options,
1095
1235
  call_options: call_options
@@ -1108,6 +1248,12 @@ module Google
1108
1248
  # @param [Object, Array<Object>] keys A single, or list of keys or key
1109
1249
  # ranges to match returned data to. Values should have exactly as many
1110
1250
  # elements as there are columns in the primary key.
1251
+ # @param [String] transaction_id The identifier of previously-started
1252
+ # transaction to be used instead of starting a new transaction.
1253
+ # Optional.
1254
+ # @param [Boolean] exclude_txn_from_change_streams If set to true,
1255
+ # mutations will not be recorded in change streams with DDL option
1256
+ # `allow_txn_exclusion=true`. Used if starting a new transaction.
1111
1257
  # @param [Hash] commit_options A hash of commit options.
1112
1258
  # e.g., return_commit_stats. Commit options are optional.
1113
1259
  # The following options can be provided:
@@ -1175,10 +1321,12 @@ module Google
1175
1321
  # puts commit_resp.timestamp
1176
1322
  # puts commit_resp.stats.mutation_count
1177
1323
  #
1178
- def delete table, keys = [], transaction_id: nil, commit_options: nil,
1179
- request_options: nil, call_options: nil
1324
+ def delete table, keys = [],
1325
+ transaction_id: nil, exclude_txn_from_change_streams: false,
1326
+ commit_options: nil, request_options: nil, call_options: nil
1180
1327
  opts = {
1181
1328
  transaction_id: transaction_id,
1329
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams,
1182
1330
  commit_options: commit_options,
1183
1331
  request_options: request_options,
1184
1332
  call_options: call_options
@@ -1199,18 +1347,20 @@ module Google
1199
1347
  ##
1200
1348
  # @private
1201
1349
  # Creates a new transaction object every time.
1202
- def create_transaction
1350
+ def create_transaction exclude_txn_from_change_streams: false
1203
1351
  route_to_leader = LARHeaders.begin_transaction true
1204
- tx_grpc = service.begin_transaction path, route_to_leader: route_to_leader
1205
- Transaction.from_grpc tx_grpc, self
1352
+ tx_grpc = service.begin_transaction path,
1353
+ route_to_leader: route_to_leader,
1354
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams
1355
+ Transaction.from_grpc tx_grpc, self, exclude_txn_from_change_streams: exclude_txn_from_change_streams
1206
1356
  end
1207
1357
 
1208
1358
  ##
1209
1359
  # @private
1210
1360
  # Creates a new transaction object without the grpc object
1211
1361
  # within it. Use it for inline-begin of a transaction.
1212
- def create_empty_transaction
1213
- Transaction.from_grpc nil, self
1362
+ def create_empty_transaction exclude_txn_from_change_streams: false
1363
+ Transaction.from_grpc nil, self, exclude_txn_from_change_streams: exclude_txn_from_change_streams
1214
1364
  end
1215
1365
 
1216
1366
  ##
@@ -83,6 +83,7 @@ module Google
83
83
  # | `BOOL` | `true`/`false` | |
84
84
  # | `INT64` | `Integer` | |
85
85
  # | `FLOAT64` | `Float` | |
86
+ # | `FLOAT32` | `Float` | |
86
87
  # | `NUMERIC` | `BigDecimal` | |
87
88
  # | `STRING` | `String` | |
88
89
  # | `DATE` | `Date` | |
@@ -109,6 +110,7 @@ module Google
109
110
  # * `:BYTES`
110
111
  # * `:DATE`
111
112
  # * `:FLOAT64`
113
+ # * `:FLOAT32`
112
114
  # * `:NUMERIC`
113
115
  # * `:INT64`
114
116
  # * `:STRING`
@@ -310,7 +312,7 @@ module Google
310
312
  transaction: tx_selector,
311
313
  query_options: query_options,
312
314
  call_options: call_options,
313
- directed_read_options: (directed_read_options || @directed_read_options)
315
+ directed_read_options: directed_read_options || @directed_read_options
314
316
  end
315
317
  alias execute execute_query
316
318
  alias query execute_query
@@ -387,7 +389,7 @@ module Google
387
389
  session.read table, columns, keys: keys, index: index, limit: limit,
388
390
  transaction: tx_selector,
389
391
  call_options: call_options,
390
- directed_read_options: (directed_read_options || @directed_read_options)
392
+ directed_read_options: directed_read_options || @directed_read_options
391
393
  end
392
394
 
393
395
  ##
@@ -416,6 +418,7 @@ module Google
416
418
  # * `:BYTES`
417
419
  # * `:DATE`
418
420
  # * `:FLOAT64`
421
+ # * `:FLOAT32`
419
422
  # * `:NUMERIC`
420
423
  # * `:INT64`
421
424
  # * `:STRING`
@@ -85,9 +85,13 @@ module Google
85
85
  # @private Transaction tag for statistics collection.
86
86
  attr_accessor :transaction_tag
87
87
 
88
+ # @private Whether to exclude from change streams.
89
+ attr_accessor :exclude_txn_from_change_streams
90
+
88
91
  def initialize
89
92
  @commit = Commit.new
90
93
  @seqno = 0
94
+ @exclude_txn_from_change_streams = false
91
95
 
92
96
  # Mutex to enfore thread safety for transaction creation and query executions.
93
97
  #
@@ -139,6 +143,7 @@ module Google
139
143
  # | `BOOL` | `true`/`false` | |
140
144
  # | `INT64` | `Integer` | |
141
145
  # | `FLOAT64` | `Float` | |
146
+ # | `FLOAT32` | `Float` | |
142
147
  # | `NUMERIC` | `BigDecimal` | |
143
148
  # | `STRING` | `String` | |
144
149
  # | `DATE` | `Date` | |
@@ -165,6 +170,7 @@ module Google
165
170
  # * `:BYTES`
166
171
  # * `:DATE`
167
172
  # * `:FLOAT64`
173
+ # * `:FLOAT32`
168
174
  # * `:NUMERIC`
169
175
  # * `:INT64`
170
176
  # * `:STRING`
@@ -402,6 +408,7 @@ module Google
402
408
  # | `BOOL` | `true`/`false` | |
403
409
  # | `INT64` | `Integer` | |
404
410
  # | `FLOAT64` | `Float` | |
411
+ # | `FLOAT32` | `Float` | |
405
412
  # | `NUMERIC` | `BigDecimal` | |
406
413
  # | `STRING` | `String` | |
407
414
  # | `DATE` | `Date` | |
@@ -429,6 +436,7 @@ module Google
429
436
  # * `:BYTES`
430
437
  # * `:DATE`
431
438
  # * `:FLOAT64`
439
+ # * `:FLOAT32`
432
440
  # * `:NUMERIC`
433
441
  # * `:INT64`
434
442
  # * `:STRING`
@@ -752,6 +760,7 @@ module Google
752
760
  # | `BOOL` | `true`/`false` | |
753
761
  # | `INT64` | `Integer` | |
754
762
  # | `FLOAT64` | `Float` | |
763
+ # | `FLOAT32` | `Float` | |
755
764
  # | `NUMERIC` | `BigDecimal` | |
756
765
  # | `STRING` | `String` | |
757
766
  # | `DATE` | `Date` | |
@@ -799,6 +808,7 @@ module Google
799
808
  # | `BOOL` | `true`/`false` | |
800
809
  # | `INT64` | `Integer` | |
801
810
  # | `FLOAT64` | `Float` | |
811
+ # | `FLOAT32` | `Float` | |
802
812
  # | `NUMERIC` | `BigDecimal` | |
803
813
  # | `STRING` | `String` | |
804
814
  # | `DATE` | `Date` | |
@@ -845,6 +855,7 @@ module Google
845
855
  # | `BOOL` | `true`/`false` | |
846
856
  # | `INT64` | `Integer` | |
847
857
  # | `FLOAT64` | `Float` | |
858
+ # | `FLOAT32` | `Float` | |
848
859
  # | `NUMERIC` | `BigDecimal` | |
849
860
  # | `STRING` | `String` | |
850
861
  # | `DATE` | `Date` | |
@@ -893,6 +904,7 @@ module Google
893
904
  # | `BOOL` | `true`/`false` | |
894
905
  # | `INT64` | `Integer` | |
895
906
  # | `FLOAT64` | `Float` | |
907
+ # | `FLOAT32` | `Float` | |
896
908
  # | `NUMERIC` | `BigDecimal` | |
897
909
  # | `STRING` | `String` | |
898
910
  # | `DATE` | `Date` | |
@@ -995,6 +1007,7 @@ module Google
995
1007
  # * `:BYTES`
996
1008
  # * `:DATE`
997
1009
  # * `:FLOAT64`
1010
+ # * `:FLOAT32`
998
1011
  # * `:NUMERIC`
999
1012
  # * `:INT64`
1000
1013
  # * `:STRING`
@@ -1143,10 +1156,11 @@ module Google
1143
1156
  ##
1144
1157
  # @private Creates a new Transaction instance from a
1145
1158
  # `Google::Cloud::Spanner::V1::Transaction`.
1146
- def self.from_grpc grpc, session
1159
+ def self.from_grpc grpc, session, exclude_txn_from_change_streams: false
1147
1160
  new.tap do |s|
1148
1161
  s.instance_variable_set :@grpc, grpc
1149
1162
  s.instance_variable_set :@session, session
1163
+ s.exclude_txn_from_change_streams = exclude_txn_from_change_streams
1150
1164
  end
1151
1165
  end
1152
1166
 
@@ -1207,11 +1221,12 @@ module Google
1207
1221
  #
1208
1222
  # This method is expected to be called from within `safe_execute()` method's block,
1209
1223
  # since it provides synchronization and gurantees thread safety.
1210
- def tx_selector
1224
+ def tx_selector exclude_txn_from_change_streams: false
1211
1225
  return V1::TransactionSelector.new id: transaction_id if existing_transaction?
1212
1226
  V1::TransactionSelector.new(
1213
1227
  begin: V1::TransactionOptions.new(
1214
- read_write: V1::TransactionOptions::ReadWrite.new
1228
+ read_write: V1::TransactionOptions::ReadWrite.new,
1229
+ exclude_txn_from_change_streams: exclude_txn_from_change_streams
1215
1230
  )
1216
1231
  )
1217
1232
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.21.0".freeze
19
+ VERSION = "2.23.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -74,8 +74,9 @@ module Google
74
74
  # spanner = gcloud.spanner scope: platform_scope
75
75
  #
76
76
  def spanner scope: nil, timeout: nil, lib_name: nil, lib_version: nil
77
+ timeout ||= @timeout
77
78
  Google::Cloud.spanner @project, @keyfile, scope: scope,
78
- timeout: (timeout || @timeout),
79
+ timeout: timeout,
79
80
  lib_name: lib_name,
80
81
  lib_version: lib_version
81
82
  end
@@ -130,8 +131,10 @@ module Google
130
131
  require "google/cloud/spanner"
131
132
  Google::Cloud::Spanner.new project_id: project_id,
132
133
  credentials: credentials,
133
- scope: scope, timeout: timeout,
134
- lib_name: lib_name, lib_version: lib_version
134
+ scope: scope,
135
+ timeout: timeout,
136
+ lib_name: lib_name,
137
+ lib_version: lib_version
135
138
  end
136
139
  end
137
140
  end