google-cloud-spanner 2.23.0 → 2.25.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32575eadb5e1598ba5b49fc7dc27cc70e2d6f370c52aa42cdad5e9fa3059cf41
4
- data.tar.gz: b5bec492eed277a46d4f4031e7f9ef9ef40472df57f747a1ea88266b397fafca
3
+ metadata.gz: 6bc284cfdecb9d6261e1a545a6b7868205e21346a27f48e4d86a8051533b1746
4
+ data.tar.gz: f4cdc9f44e8723639ab0f8c07aedb4c6e3e6c989db95b8175a24a0ae232c0902
5
5
  SHA512:
6
- metadata.gz: c826d09f5ff0abe190d1f51a942f120ee67b032b508edba22de82b42b079e8c833ed7e044570c5f1138c0d4e85aeb9fb3d93d571ce5db8deca898f0d456cf267
7
- data.tar.gz: e06690d05125c1af27c8fb2e5f29f0b75b1a2d9eecd31fa6865e80fc0592caba84bc2cdb864ff25bd18a8b333019fabb52f13647b42521acf0c0706049bbc0f5
6
+ metadata.gz: 5f379e7460d19707ed13e73d6caebf00224d1fb97ba26bcba9efd72c00a300a7a81ac510688138143c35437ab5d75057c775a4e8445fe72e7462c66be141c0b3
7
+ data.tar.gz: 0d0fe1dbfd3f7bb47502b06f1854ac87233dc86bcd291f1732d4d6a6ba762483adac6883d9c8f534296811772dcb7930b2b4d8d6f39a59dcc27e8049a59ca380
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Release History
2
2
 
3
+ ### 2.25.0 (2025-01-29)
4
+
5
+ #### Features
6
+
7
+ * Support Protobuf Columns ([#124](https://github.com/googleapis/ruby-spanner/issues/124))
8
+ * Update minimum Ruby version to 3.0 ([#140](https://github.com/googleapis/ruby-spanner/issues/140))
9
+
10
+ ### 2.24.0 (2024-08-27)
11
+
12
+ #### Features
13
+
14
+ * Support 1.x versions of low-level spanner clients ([#113](https://github.com/googleapis/ruby-spanner/issues/113))
15
+ #### Bug Fixes
16
+
17
+ * Correct the field mask when adding labels to an instance that had none previously ([#114](https://github.com/googleapis/ruby-spanner/issues/114))
18
+
3
19
  ### 2.23.0 (2024-06-27)
4
20
 
5
21
  #### Features
data/CONTRIBUTING.md CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-spanner console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-spanner requires Ruby 2.5+. You may choose to
27
+ 1. Install Ruby. google-cloud-spanner requires Ruby 3.0+. You may choose to
28
28
  manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
29
  [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
@@ -156,7 +156,7 @@ module Google
156
156
  # object. Operation object is a backup operation.
157
157
  #
158
158
  def self.from_grpc grpc, service
159
- operations_client = \
159
+ operations_client =
160
160
  service.databases.instance_variable_get "@operations_client"
161
161
  jobs = new(Array(grpc.response.operations).map do |job_grpc|
162
162
  Job.from_grpc \
@@ -1022,10 +1022,10 @@ module Google
1022
1022
  # | `TIMESTAMP` | `Time`, `DateTime` | |
1023
1023
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
1024
1024
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
1025
+ # | `PROTO` | Determined by proto_fqn | |
1025
1026
  #
1026
1027
  # See [Data
1027
1028
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
1028
- #
1029
1029
  # @param [Boolean] exclude_txn_from_change_streams If set to true,
1030
1030
  # mutations will not be recorded in change streams with DDL option
1031
1031
  # `allow_txn_exclusion=true`.
@@ -1169,6 +1169,7 @@ module Google
1169
1169
  # | `TIMESTAMP` | `Time`, `DateTime` | |
1170
1170
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
1171
1171
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
1172
+ # | `PROTO` | Determined by proto_fqn | |
1172
1173
  #
1173
1174
  # See [Data
1174
1175
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -1314,6 +1315,7 @@ module Google
1314
1315
  # | `TIMESTAMP` | `Time`, `DateTime` | |
1315
1316
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
1316
1317
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
1318
+ # | `PROTO` | Determined by proto_fqn | |
1317
1319
  #
1318
1320
  # See [Data
1319
1321
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -1460,6 +1462,7 @@ module Google
1460
1462
  # | `TIMESTAMP` | `Time`, `DateTime` | |
1461
1463
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
1462
1464
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
1465
+ # | `PROTO` | Determined by proto_fqn | |
1463
1466
  #
1464
1467
  # See [Data
1465
1468
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -76,6 +76,7 @@ module Google
76
76
  # | `TIMESTAMP` | `Time`, `DateTime` | |
77
77
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
78
78
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
79
+ # | `PROTO` | Determined by proto_fqn | |
79
80
  #
80
81
  # See [Data
81
82
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -93,19 +94,7 @@ module Google
93
94
  # end
94
95
  #
95
96
  def upsert table, *rows
96
- rows = Array(rows).flatten
97
- return rows if rows.empty?
98
- rows.compact
99
- rows.delete_if(&:empty?)
100
- @mutations += rows.map do |row|
101
- V1::Mutation.new(
102
- insert_or_update: V1::Mutation::Write.new(
103
- table: table, columns: row.keys.map(&:to_s),
104
- values: [Convert.object_to_grpc_value(row.values).list_value]
105
- )
106
- )
107
- end
108
- rows
97
+ mutations_from_rows table, rows, "insert_or_update"
109
98
  end
110
99
  alias save upsert
111
100
 
@@ -136,6 +125,7 @@ module Google
136
125
  # | `TIMESTAMP` | `Time`, `DateTime` | |
137
126
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
138
127
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
128
+ # | `PROTO` | Determined by proto_fqn | |
139
129
  #
140
130
  # See [Data
141
131
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -153,19 +143,7 @@ module Google
153
143
  # end
154
144
  #
155
145
  def insert table, *rows
156
- rows = Array(rows).flatten
157
- return rows if rows.empty?
158
- rows.compact
159
- rows.delete_if(&:empty?)
160
- @mutations += rows.map do |row|
161
- V1::Mutation.new(
162
- insert: V1::Mutation::Write.new(
163
- table: table, columns: row.keys.map(&:to_s),
164
- values: [Convert.object_to_grpc_value(row.values).list_value]
165
- )
166
- )
167
- end
168
- rows
146
+ mutations_from_rows table, rows, "insert"
169
147
  end
170
148
 
171
149
  ##
@@ -195,6 +173,7 @@ module Google
195
173
  # | `TIMESTAMP` | `Time`, `DateTime` | |
196
174
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
197
175
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
176
+ # | `PROTO` | Determined by proto_fqn | |
198
177
  #
199
178
  # See [Data
200
179
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -212,19 +191,7 @@ module Google
212
191
  # end
213
192
  #
214
193
  def update table, *rows
215
- rows = Array(rows).flatten
216
- return rows if rows.empty?
217
- rows.compact
218
- rows.delete_if(&:empty?)
219
- @mutations += rows.map do |row|
220
- V1::Mutation.new(
221
- update: V1::Mutation::Write.new(
222
- table: table, columns: row.keys.map(&:to_s),
223
- values: [Convert.object_to_grpc_value(row.values).list_value]
224
- )
225
- )
226
- end
227
- rows
194
+ mutations_from_rows table, rows, "update"
228
195
  end
229
196
 
230
197
  ##
@@ -256,6 +223,7 @@ module Google
256
223
  # | `TIMESTAMP` | `Time`, `DateTime` | |
257
224
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
258
225
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
226
+ # | `PROTO` | Determined by proto_fqn | |
259
227
  #
260
228
  # See [Data
261
229
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -273,19 +241,7 @@ module Google
273
241
  # end
274
242
  #
275
243
  def replace table, *rows
276
- rows = Array(rows).flatten
277
- return rows if rows.empty?
278
- rows.compact
279
- rows.delete_if(&:empty?)
280
- @mutations += rows.map do |row|
281
- V1::Mutation.new(
282
- replace: V1::Mutation::Write.new(
283
- table: table, columns: row.keys.map(&:to_s),
284
- values: [Convert.object_to_grpc_value(row.values).list_value]
285
- )
286
- )
287
- end
288
- rows
244
+ mutations_from_rows table, rows, "replace"
289
245
  end
290
246
 
291
247
  ##
@@ -330,6 +286,42 @@ module Google
330
286
 
331
287
  protected
332
288
 
289
+ ##
290
+ # @private
291
+ # Generates mutations from `rows` to be performed on a given table, converting
292
+ # given rows to their corresponding column and gRPC values.
293
+ #
294
+ # @param [String] table The name of the table in the database to be
295
+ # modified.
296
+ # @param [Array<Hash>] rows One or more hash objects with the hash keys
297
+ # matching the table's columns, and the hash values matching the
298
+ # table's values.
299
+ # @param [String] type The type of mutation to be performed.
300
+ #
301
+ def mutations_from_rows table, rows, type
302
+ rows = Array(rows).flatten
303
+ return rows if rows.empty?
304
+ rows.compact
305
+ rows.delete_if { |row| row.respond_to?(:empty?) && row.empty? }
306
+ @mutations += rows.map do |row|
307
+ # This case applies whenever a Protobuf object is the row itself, and not part of individual column fields.
308
+ if row.class.respond_to? :descriptor
309
+ columns = row.class.descriptor.map(&:name)
310
+ values = [Google::Protobuf::ListValue.new(values: [Convert.object_to_grpc_value(row, :PROTO)])]
311
+ else
312
+ columns = row.keys.map(&:to_s)
313
+ values = [Convert.object_to_grpc_value(row.values).list_value]
314
+ end
315
+ V1::Mutation.new(
316
+ "#{type}": V1::Mutation::Write.new(
317
+ table: table, columns: columns,
318
+ values: values
319
+ )
320
+ )
321
+ end
322
+ rows
323
+ end
324
+
333
325
  def key_set keys
334
326
  return V1::KeySet.new all: true if keys.nil?
335
327
  keys = [keys] unless keys.is_a? Array
@@ -45,9 +45,16 @@ module Google
45
45
  end
46
46
 
47
47
  field ||= field_for_object obj
48
- [object_to_grpc_value(obj, field), grpc_type_for_field(field)]
48
+ [object_to_grpc_value(obj, field), grpc_type_for_field(field, obj)]
49
49
  end
50
50
 
51
+ ##
52
+ # @private
53
+ # Convert objects to their corresponding gRPC values.
54
+ #
55
+ # `field` is used to determine whether the object itself is a value or
56
+ # a collection of values.
57
+ #
51
58
  def object_to_grpc_value obj, field = nil
52
59
  obj = obj.to_column_value if obj.respond_to? :to_column_value
53
60
 
@@ -101,12 +108,17 @@ module Google
101
108
  else
102
109
  Google::Protobuf::Value.new string_value: obj.to_json
103
110
  end
111
+ when Google::Protobuf::MessageExts
112
+ proto_class = obj.class
113
+ content = proto_class.encode obj
114
+ encoded_content = Base64.strict_encode64(content)
115
+ Google::Protobuf::Value.new string_value: encoded_content
104
116
  else
105
117
  if obj.respond_to?(:read) && obj.respond_to?(:rewind)
106
118
  obj.rewind
107
119
  content = obj.read.force_encoding("ASCII-8BIT")
108
120
  encoded_content = Base64.strict_encode64(content)
109
- Google::Protobuf::Value.new(string_value: encoded_content)
121
+ Google::Protobuf::Value.new string_value: encoded_content
110
122
  else
111
123
  raise ArgumentError,
112
124
  "A value of type #{obj.class} is not supported."
@@ -161,6 +173,8 @@ module Google
161
173
  Fields.new Hash[raw_type_pairs]
162
174
  when Data
163
175
  obj.fields
176
+ when Google::Protobuf::MessageExts
177
+ :PROTO
164
178
  else
165
179
  if obj.respond_to?(:read) && obj.respond_to?(:rewind)
166
180
  :BYTES
@@ -171,7 +185,7 @@ module Google
171
185
  end
172
186
  end
173
187
 
174
- def grpc_type_for_field field
188
+ def grpc_type_for_field field, obj = nil
175
189
  return field.to_grpc_type if field.respond_to? :to_grpc_type
176
190
 
177
191
  case field
@@ -184,11 +198,20 @@ module Google
184
198
  V1::Type.new(code: :NUMERIC, type_annotation: :PG_NUMERIC)
185
199
  when :PG_JSONB
186
200
  V1::Type.new(code: :JSON, type_annotation: :PG_JSONB)
201
+ when :PROTO
202
+ V1::Type.new(code: :PROTO, proto_type_fqn: obj.nil? ? "" : obj.class.descriptor.name)
187
203
  else
188
204
  V1::Type.new(code: field)
189
205
  end
190
206
  end
191
207
 
208
+ ##
209
+ # Converts a gRPC value to a Ruby object.
210
+ #
211
+ # @param [Google::Protobuf::Value] value The gRPC value to convert.
212
+ # @param [Google::Spanner::V1::Type] type The underlying type for data.
213
+ # @return [::Object] The Ruby object that represents the value, converted to the closest
214
+ # matching Ruby class based on the gRPC type.
192
215
  def grpc_value_to_object value, type
193
216
  return nil if value.kind == :null_value
194
217
 
@@ -229,6 +252,10 @@ module Google
229
252
  BigDecimal value.string_value
230
253
  when :JSON
231
254
  JSON.parse value.string_value
255
+ when :PROTO
256
+ descriptor = Google::Protobuf::DescriptorPool.generated_pool.lookup(type.proto_type_fqn).msgclass
257
+ content = Base64.decode64 value.string_value
258
+ descriptor.decode content
232
259
  end
233
260
  end
234
261
 
@@ -156,7 +156,7 @@ module Google
156
156
  # object. Operation object is a database operation.
157
157
  #
158
158
  def self.from_grpc grpc, service
159
- operations_client = \
159
+ operations_client =
160
160
  service.databases.instance_variable_get "@operations_client"
161
161
  jobs = new(Array(grpc.response.operations).map do |job_grpc|
162
162
  Job.from_grpc \
@@ -238,6 +238,10 @@ module Google
238
238
  # valid identifier: `[a-z][a-z0-9_]*`. Will raise
239
239
  # {Google::Cloud::AlreadyExistsError} if the named operation already
240
240
  # exists. Optional.
241
+ # @param [Google::Protobuf::FileDescriptorSet, String] descriptor_set The file
242
+ # descriptor set object to be used in the update, or alternatively, an absolute
243
+ # path to the generated file descriptor set. The descriptor set is only used
244
+ # during DDL statements, such as `CREATE PROTO BUNDLE`.
241
245
  #
242
246
  # @return [Database::Job] The job representing the long-running,
243
247
  # asynchronous processing of a database schema update operation.
@@ -248,22 +252,48 @@ module Google
248
252
  # spanner = Google::Cloud::Spanner.new
249
253
  # database = spanner.database "my-instance", "my-database"
250
254
  #
251
- # add_users_table_sql = %q(
252
- # CREATE TABLE users (
253
- # id INT64 NOT NULL,
254
- # username STRING(25) NOT NULL,
255
- # name STRING(45) NOT NULL,
256
- # email STRING(128),
257
- # ) PRIMARY KEY(id)
258
- # )
255
+ # add_users_table_sql =
256
+ # <<~SQL
257
+ # CREATE TABLE users (
258
+ # id INT64 NOT NULL,
259
+ # username STRING(25) NOT NULL,
260
+ # name STRING(45) NOT NULL,
261
+ # email STRING(128),
262
+ # ) PRIMARY KEY(id)
263
+ # SQL
259
264
  #
260
265
  # database.update statements: [add_users_table_sql]
261
266
  #
262
- def update statements: [], operation_id: nil
267
+ # @example
268
+ # require "google/cloud/spanner"
269
+ #
270
+ # spanner = Google::Cloud::Spanner.new
271
+ # database = spanner.database "my-instance", "my-database"
272
+ #
273
+ # create_proto_bundle_sql =
274
+ # <<~SQL
275
+ # CREATE PROTO BUNDLE (
276
+ # `examples.User`
277
+ # )
278
+ # SQL
279
+ #
280
+ # create_users_table_sql =
281
+ # <<~SQL
282
+ # CREATE TABLE users (
283
+ # id INT64 NOT NULL,
284
+ # user `examples.User` NOT NULL
285
+ # ) PRIMARY KEY (id)
286
+ # SQL
287
+ #
288
+ # database.update statements: [create_proto_bundle_sql, create_users_table_sql],
289
+ # descriptor_set: "/usr/local/user_descriptors.pb"
290
+ #
291
+ def update statements: [], operation_id: nil, descriptor_set: nil
263
292
  ensure_service!
264
293
  grpc = service.update_database_ddl instance_id, database_id,
265
294
  statements: statements,
266
- operation_id: operation_id
295
+ operation_id: operation_id,
296
+ descriptor_set: descriptor_set
267
297
  Database::Job.from_grpc grpc, service
268
298
  end
269
299
 
@@ -68,6 +68,7 @@ module Google
68
68
  # * `:INT64`
69
69
  # * `:STRING`
70
70
  # * `:TIMESTAMP`
71
+ # * `:PROTO`
71
72
  # * `Array` - Lists are specified by providing the type code in an
72
73
  # array. For example, an array of integers are specified as
73
74
  # `[:INT64]`.
@@ -275,24 +276,23 @@ module Google
275
276
  return Data.from_grpc nil, @grpc_fields
276
277
  elsif data.is_a? Array
277
278
  # Convert data in the order it was recieved
278
- values = data.map.with_index do |datum, index|
279
- Convert.object_to_grpc_value_and_type(datum, cached_types[index]).first
279
+ values_and_types = data.map.with_index do |datum, index|
280
+ Convert.object_to_grpc_value_and_type(datum, cached_types[index])
280
281
  end
281
- return Data.from_grpc values, @grpc_fields
282
282
  elsif data.is_a? Hash
283
283
  # Pull values from hash in order of the fields,
284
284
  # we can't always trust the Hash to be in order.
285
- values = @grpc_fields.map.with_index do |field, index|
285
+ values_and_types = @grpc_fields.map.with_index do |field, index|
286
286
  if data.key? index
287
287
  Convert.object_to_grpc_value_and_type(data[index],
288
- cached_types[index]).first
288
+ cached_types[index])
289
289
  elsif !field.name.to_s.empty?
290
290
  if data.key? field.name.to_s
291
291
  Convert.object_to_grpc_value_and_type(data[field.name.to_s],
292
- cached_types[index]).first
292
+ cached_types[index])
293
293
  elsif data.key? field.name.to_s.to_sym
294
294
  Convert.object_to_grpc_value_and_type(data[field.name.to_s.to_sym],
295
- cached_types[index]).first
295
+ cached_types[index])
296
296
  else
297
297
  raise "data value for field #{field.name} missing"
298
298
  end
@@ -300,9 +300,18 @@ module Google
300
300
  raise "data value for field #{index} missing"
301
301
  end
302
302
  end
303
- return Data.from_grpc values, @grpc_fields
303
+ else
304
+ raise ArgumentError, "can only accept Array or Hash"
305
+ end
306
+
307
+ # This is not ideal since we loop through `@grpc_fields` a second time after
308
+ # initialization. Refactoring can be done to perform this step later on when
309
+ # all information for the type is available.
310
+ values, grpc_types = values_and_types.transpose
311
+ grpc_types&.each_with_index do |grpc_type, index|
312
+ @grpc_fields[index].type = grpc_type
304
313
  end
305
- raise ArgumentError, "can only accept Array or Hash"
314
+ Data.from_grpc values, @grpc_fields
306
315
  end
307
316
  alias data struct
308
317
  alias new struct
@@ -258,12 +258,13 @@ module Google
258
258
  ensure_service!
259
259
 
260
260
  field_mask = []
261
- @current_values.each do |field, value|
262
- field_mask << field unless @grpc[field.to_s] == value
261
+ new_values = @grpc.to_h
262
+ (@current_values.keys + new_values.keys).uniq.each do |field|
263
+ field_mask << field unless new_values[field] == @current_values[field]
263
264
  end
264
265
 
265
266
  job_grpc = service.update_instance @grpc, field_mask: field_mask
266
- @current_values = @grpc.to_h
267
+ @current_values = new_values
267
268
  Instance::Job.from_grpc job_grpc, service
268
269
  end
269
270
  alias update save
@@ -173,7 +173,7 @@ module Google
173
173
  # TODO: raise if hash[:execute_query].nil? && hash[:read].nil?
174
174
  new.tap do |p|
175
175
  if data[:execute]
176
- execute_sql_grpc = \
176
+ execute_sql_grpc =
177
177
  V1::ExecuteSqlRequest.decode(
178
178
  Base64.decode64(data[:execute])
179
179
  )
@@ -74,7 +74,7 @@ module Google
74
74
 
75
75
  def service
76
76
  return mocked_service if mocked_service
77
- @service ||= \
77
+ @service ||=
78
78
  V1::Spanner::Client.new do |config|
79
79
  config.credentials = channel
80
80
  config.quota_project = @quota_project
@@ -89,7 +89,7 @@ module Google
89
89
 
90
90
  def instances
91
91
  return mocked_instances if mocked_instances
92
- @instances ||= \
92
+ @instances ||=
93
93
  Admin::Instance::V1::InstanceAdmin::Client.new do |config|
94
94
  config.credentials = channel
95
95
  config.quota_project = @quota_project
@@ -104,7 +104,7 @@ module Google
104
104
 
105
105
  def databases
106
106
  return mocked_databases if mocked_databases
107
- @databases ||= \
107
+ @databases ||=
108
108
  Admin::Database::V1::DatabaseAdmin::Client.new do |config|
109
109
  config.credentials = channel
110
110
  config.quota_project = @quota_project
@@ -257,12 +257,27 @@ module Google
257
257
  end
258
258
 
259
259
  def update_database_ddl instance_id, database_id, statements: [],
260
- operation_id: nil, call_options: nil
260
+ operation_id: nil, call_options: nil, descriptor_set: nil
261
+ bin_data =
262
+ case descriptor_set
263
+ when Google::Protobuf::FileDescriptorSet
264
+ Google::Protobuf::FileDescriptorSet.encode descriptor_set
265
+ when String
266
+ File.binread descriptor_set
267
+ when NilClass
268
+ nil
269
+ else
270
+ raise ArgumentError,
271
+ "A value of type #{descriptor_set.class} is not supported."
272
+ end
273
+
274
+ proto_descriptors = bin_data unless bin_data.nil?
261
275
  opts = default_options call_options: call_options
262
276
  request = {
263
277
  database: database_path(instance_id, database_id),
264
278
  statements: Array(statements),
265
- operation_id: operation_id
279
+ operation_id: operation_id,
280
+ proto_descriptors: proto_descriptors
266
281
  }
267
282
  databases.update_database_ddl request, opts
268
283
  end
@@ -125,6 +125,7 @@ module Google
125
125
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
126
126
  # | `ARRAY` | `Array` | Nested arrays are not supported. |
127
127
  # | `STRUCT` | `Hash`, {Data} | |
128
+ # | `PROTO` | Determined by proto_fqn | |
128
129
  #
129
130
  # See [Data
130
131
  # types](https://cloud.google.com/spanner/docs/data-definition-language#data_types).
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.23.0".freeze
19
+ VERSION = "2.25.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.23.0
4
+ version: 2.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2025-01-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bigdecimal
@@ -45,56 +44,56 @@ dependencies:
45
44
  requirements:
46
45
  - - "~>"
47
46
  - !ruby/object:Gem::Version
48
- version: '1.5'
47
+ version: '1.7'
49
48
  type: :runtime
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
52
  - - "~>"
54
53
  - !ruby/object:Gem::Version
55
- version: '1.5'
54
+ version: '1.7'
56
55
  - !ruby/object:Gem::Dependency
57
56
  name: google-cloud-spanner-admin-database-v1
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
59
  - - "~>"
61
60
  - !ruby/object:Gem::Version
62
- version: '0.1'
61
+ version: '1.4'
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
66
  - - "~>"
68
67
  - !ruby/object:Gem::Version
69
- version: '0.1'
68
+ version: '1.4'
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: google-cloud-spanner-admin-instance-v1
72
71
  requirement: !ruby/object:Gem::Requirement
73
72
  requirements:
74
73
  - - "~>"
75
74
  - !ruby/object:Gem::Version
76
- version: '0.1'
75
+ version: '1.6'
77
76
  type: :runtime
78
77
  prerelease: false
79
78
  version_requirements: !ruby/object:Gem::Requirement
80
79
  requirements:
81
80
  - - "~>"
82
81
  - !ruby/object:Gem::Version
83
- version: '0.1'
82
+ version: '1.6'
84
83
  - !ruby/object:Gem::Dependency
85
84
  name: google-cloud-spanner-v1
86
85
  requirement: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - "~>"
89
88
  - !ruby/object:Gem::Version
90
- version: '0.2'
89
+ version: '1.6'
91
90
  type: :runtime
92
91
  prerelease: false
93
92
  version_requirements: !ruby/object:Gem::Requirement
94
93
  requirements:
95
94
  - - "~>"
96
95
  - !ruby/object:Gem::Version
97
- version: '0.2'
96
+ version: '1.6'
98
97
  description: google-cloud-spanner is the official library for Google Cloud Spanner
99
98
  API.
100
99
  email:
@@ -169,7 +168,6 @@ homepage: https://github.com/googleapis/ruby-spanner/blob/main/google-cloud-span
169
168
  licenses:
170
169
  - Apache-2.0
171
170
  metadata: {}
172
- post_install_message:
173
171
  rdoc_options: []
174
172
  require_paths:
175
173
  - lib
@@ -177,15 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
175
  requirements:
178
176
  - - ">="
179
177
  - !ruby/object:Gem::Version
180
- version: '2.7'
178
+ version: '3.0'
181
179
  required_rubygems_version: !ruby/object:Gem::Requirement
182
180
  requirements:
183
181
  - - ">="
184
182
  - !ruby/object:Gem::Version
185
183
  version: '0'
186
184
  requirements: []
187
- rubygems_version: 3.5.6
188
- signing_key:
185
+ rubygems_version: 3.6.2
189
186
  specification_version: 4
190
187
  summary: API Client library for Google Cloud Spanner API
191
188
  test_files: []