google-cloud-bigquery 1.57.0 → 1.59.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: dbe17241cff1bf35169627f5be2bc589b24e4830077b1966192d74cb478efcc0
4
- data.tar.gz: a6060857441bd335b1a8c67509f742d586026e043269d48893c22e4ffe3a3b9f
3
+ metadata.gz: d1f6d09bd925b1c1b03aa149fc848ab6e1524207045ef6abb2101f57254f9b5c
4
+ data.tar.gz: 28e45683731235e96448f1b4d5eb3e20d14be7966fa0ad7e12f4cf342342dd3d
5
5
  SHA512:
6
- metadata.gz: 361370e039788d37aaebe2c3dc368e3715e7f09c65ffc85727285c1cdfe608412e09352570e3f1c88abb52b52c851646540c67e3c023c344ef1d8f37cab78086
7
- data.tar.gz: 8b86e329d6843a4d4387f1c1daf1ed3feaabe47284ad4e8320ce3c9e39a492fadbecfe46006e1b0a38fedbe94250795aa0968a2148c94e0f1bf25a4514ad2d92
6
+ metadata.gz: 84e4dbca7f7e8194694b7ee127f822fb405d482610f84a6245b994d4b100c91e110a5d60737b9a889dd99cc5c28154bb62c64bff467078d4ced7bd78845dd268
7
+ data.tar.gz: ee80b48d42b3a99e2f3cbc4cfb9297ccaa02f2c715bde3221dba31380eac3745822de30c7e50a9b263f3179108b62495238cf155a6bc7f4c6c6e33fb3a05b5e0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ### 1.59.0 (2025-09-17)
4
+
5
+ #### Features
6
+
7
+ * Support collation feature ([#30919](https://github.com/googleapis/google-cloud-ruby/issues/30919))
8
+
9
+ ### 1.58.0 (2025-09-03)
10
+
11
+ #### Features
12
+
13
+ * Add support for remote function options ([#30822](https://github.com/googleapis/google-cloud-ruby/issues/30822))
14
+
3
15
  ### 1.57.0 (2025-08-28)
4
16
 
5
17
  #### Features
@@ -197,6 +197,37 @@ module Google
197
197
  patch_gapi! :description
198
198
  end
199
199
 
200
+ ##
201
+ # The default collation of the dataset.
202
+ #
203
+ # @return [String, nil] The default collation, or `nil` if not present or the object is a
204
+ # reference (see {#reference?}).
205
+ #
206
+ # @!group Attributes
207
+ #
208
+ def default_collation
209
+ return nil if reference?
210
+ ensure_full_data!
211
+ @gapi.default_collation
212
+ end
213
+
214
+ ##
215
+ # Updates the default collation of the dataset.
216
+ #
217
+ # If the dataset is not a full resource representation (see
218
+ # {#resource_full?}), the full representation will be retrieved before
219
+ # the update to comply with ETag-based optimistic concurrency control.
220
+ #
221
+ # @param [String] new_default_collation The new default collation for the dataset.
222
+ #
223
+ # @!group Attributes
224
+ #
225
+ def default_collation= new_default_collation
226
+ reload! unless resource_full?
227
+ @gapi.update! default_collation: new_default_collation
228
+ patch_gapi! :default_collation
229
+ end
230
+
200
231
  ##
201
232
  # The default lifetime of all tables in the dataset, in milliseconds.
202
233
  #
@@ -0,0 +1,156 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Cloud
17
+ module Bigquery
18
+ ##
19
+ # # RemoteFunctionOptions
20
+ #
21
+ # Options for a remote user-defined function.
22
+ #
23
+ class RemoteFunctionOptions
24
+ ##
25
+ # @private The Google API Client object.
26
+ # @return [Google::Apis::BigqueryV2::RemoteFunctionOptions]
27
+ attr_accessor :gapi
28
+
29
+ ##
30
+ # Creates a new RemoteFunctionOptions object.
31
+ #
32
+ # @example
33
+ # require "google/cloud/bigquery"
34
+ #
35
+ # remote_function_options = Google::Cloud::Bigquery::RemoteFunctionOptions.new.tap do |rfo|
36
+ # rfo.endpoint = "https://us-east1-my_gcf_project.cloudfunctions.net/remote_add"
37
+ # rfo.connection = "projects/my-project/locations/us-east1/connections/my-connection"
38
+ # rfo.user_defined_context = { "foo" => "bar" }
39
+ # end
40
+ #
41
+ def initialize
42
+ @gapi = Google::Apis::BigqueryV2::RemoteFunctionOptions.new
43
+ end
44
+
45
+ ##
46
+ # The endpoint of the user-provided remote service, e.g.
47
+ # `https://us-east1-my_gcf_project.cloudfunctions.net/remote_add`.
48
+ #
49
+ # @return [String] The endpoint of the user-provided remote service.
50
+ # Returns an empty string if the endpoint is not configured.
51
+ #
52
+ def endpoint
53
+ @gapi.endpoint || ""
54
+ end
55
+
56
+ ##
57
+ # Sets the endpoint of the user-provided remote service.
58
+ #
59
+ # @param [String, nil] new_endpoint The new endpoint. Passing `nil` will
60
+ # clear the endpoint, indicating that no remote service is configured.
61
+ #
62
+ def endpoint= new_endpoint
63
+ @gapi.endpoint = new_endpoint
64
+ end
65
+
66
+ ##
67
+ # The fully qualified name of the user-provided connection object which
68
+ # holds the authentication information to send requests to the remote
69
+ # service.
70
+ #
71
+ # Format:
72
+ # `projects/{projectId}/locations/{locationId}/connections/{connectionId}`
73
+ #
74
+ # @return [String] The fully qualified name of the user-provided
75
+ # connection object. Returns an empty string if the connection is not
76
+ # configured.
77
+ #
78
+ def connection
79
+ @gapi.connection || ""
80
+ end
81
+
82
+ ##
83
+ # Sets the fully qualified name of the user-provided connection object.
84
+ #
85
+ # @param [String, nil] new_connection The new connection. Passing `nil`
86
+ # will clear the connection, indicating that no authentication
87
+ # information is configured for the remote service.
88
+ #
89
+ def connection= new_connection
90
+ @gapi.connection = new_connection
91
+ end
92
+
93
+ ##
94
+ # User-defined context as a set of key/value pairs, which will be sent
95
+ # as function invocation context together with batched arguments in the
96
+ # requests to the remote service. The total number of bytes of keys and
97
+ # values must be less than 8KB.
98
+ #
99
+ # @return [Hash] The user-defined context. Returns an empty hash if no
100
+ # context is configured.
101
+ #
102
+ def user_defined_context
103
+ @gapi.user_defined_context || {}
104
+ end
105
+
106
+ ##
107
+ # Sets the user-defined context.
108
+ #
109
+ # @param [Hash, nil] new_user_defined_context The new user-defined
110
+ # context. Passing `nil` will clear the context, meaning no
111
+ # user-defined key-value pairs will be sent.
112
+ #
113
+ def user_defined_context= new_user_defined_context
114
+ @gapi.user_defined_context = new_user_defined_context
115
+ end
116
+
117
+ ##
118
+ # Max number of rows in each batch sent to the remote service. If absent
119
+ # or if 0, BigQuery dynamically decides the number of rows in a batch.
120
+ #
121
+ # @return [Integer] Max number of rows in each batch. Returns `0` if not
122
+ # set, which indicates that BigQuery dynamically decides the number of
123
+ # rows.
124
+ #
125
+ def max_batching_rows
126
+ @gapi.max_batching_rows || 0
127
+ end
128
+
129
+ ##
130
+ # Sets the max number of rows in each batch sent to the remote service.
131
+ #
132
+ # @param [Integer, nil] new_max_batching_rows The new max batching rows.
133
+ # Passing `nil` or `0` will reset the batch size, indicating that
134
+ # BigQuery should dynamically decide the number of rows in each batch.
135
+ #
136
+ def max_batching_rows= new_max_batching_rows
137
+ @gapi.max_batching_rows = new_max_batching_rows
138
+ end
139
+
140
+ # @private New RemoteFunctionOptions from a Google API Client object.
141
+ def self.from_gapi gapi
142
+ return nil if gapi.nil?
143
+ new.tap do |rfo|
144
+ rfo.instance_variable_set :@gapi, gapi
145
+ end
146
+ end
147
+
148
+ ##
149
+ # @private Returns the Google API Client object.
150
+ def to_gapi
151
+ @gapi
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
@@ -18,6 +18,7 @@ require "google/cloud/bigquery/convert"
18
18
  require "google/cloud/bigquery/service"
19
19
  require "google/cloud/bigquery/routine/list"
20
20
  require "google/cloud/bigquery/argument"
21
+ require "google/cloud/bigquery/remote_function_options"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -743,6 +744,55 @@ module Google
743
744
  update_gapi!
744
745
  end
745
746
 
747
+ ##
748
+ # Remote function specific options. Optional.
749
+ #
750
+ # @return [RemoteFunctionOptions, nil] The remote function options, or `nil` if not set or the object is a
751
+ # reference (see {#reference?}).
752
+ #
753
+ # @example
754
+ # require "google/cloud/bigquery"
755
+ #
756
+ # bigquery = Google::Cloud::Bigquery.new
757
+ # dataset = bigquery.dataset "my_dataset"
758
+ # routine = dataset.routine "my_routine"
759
+ #
760
+ # puts routine.remote_function_options.endpoint
761
+ #
762
+ # @!group Attributes
763
+ #
764
+ def remote_function_options
765
+ return nil if reference?
766
+ ensure_full_data!
767
+ RemoteFunctionOptions.from_gapi @gapi.remote_function_options
768
+ end
769
+
770
+ ##
771
+ # Updates the remote function specific options. Optional.
772
+ #
773
+ # @param [RemoteFunctionOptions] new_remote_function_options The new remote function options.
774
+ #
775
+ # @example
776
+ # require "google/cloud/bigquery"
777
+ #
778
+ # bigquery = Google::Cloud::Bigquery.new
779
+ # dataset = bigquery.dataset "my_dataset"
780
+ # routine = dataset.routine "my_routine"
781
+ #
782
+ # rfo = Google::Cloud::Bigquery::RemoteFunctionOptions.new.tap do |rfo|
783
+ # rfo.endpoint = "https://us-east1-my_gcf_project.cloudfunctions.net/remote_add"
784
+ # rfo.connection = "projects/my-project/locations/us-east1/connections/my-connection"
785
+ # end
786
+ # routine.remote_function_options = rfo
787
+ #
788
+ # @!group Attributes
789
+ #
790
+ def remote_function_options= new_remote_function_options
791
+ ensure_full_data!
792
+ @gapi.remote_function_options = new_remote_function_options.to_gapi
793
+ update_gapi!
794
+ end
795
+
746
796
  ##
747
797
  # Updates the routine with changes made in the given block in a single update request. The following attributes
748
798
  # may be set: {Updater#routine_type=}, {Updater#language=}, {Updater#arguments=}, {Updater#return_type=},
@@ -1275,6 +1325,32 @@ module Google
1275
1325
  @gapi.data_governance_type = new_data_governance_type
1276
1326
  end
1277
1327
 
1328
+ ##
1329
+ # Updates the remote function specific options. Optional.
1330
+ #
1331
+ # @param [Google::Cloud::Bigquery::RemoteFunctionOptions] new_remote_function_options The new
1332
+ # remote function options.
1333
+ #
1334
+ # @example
1335
+ # require "google/cloud/bigquery"
1336
+ #
1337
+ # bigquery = Google::Cloud::Bigquery.new
1338
+ # dataset = bigquery.dataset "my_dataset"
1339
+ # routine = dataset.routine "my_routine"
1340
+ #
1341
+ # routine.update do |r|
1342
+ # rfo = Google::Cloud::Bigquery::RemoteFunctionOptions.new
1343
+ # rfo.endpoint = "https://us-east1-my_gcf_project.cloudfunctions.net/remote_add"
1344
+ # rfo.connection = "projects/my-project/locations/us-east1/connections/my-connection"
1345
+ # r.remote_function_options = rfo
1346
+ # end
1347
+ #
1348
+ # @!group Attributes
1349
+ #
1350
+ def remote_function_options= new_remote_function_options
1351
+ @gapi.remote_function_options = new_remote_function_options.to_gapi
1352
+ end
1353
+
1278
1354
  def update
1279
1355
  raise "not implemented in #{self.class}"
1280
1356
  end
@@ -351,6 +351,31 @@ module Google
351
351
  @gapi.scale
352
352
  end
353
353
 
354
+ ##
355
+ # The collation of the field.
356
+ #
357
+ # Collation can be set only when the type of field is `STRING`.
358
+ # The following values are supported:
359
+ #
360
+ # * `und:ci`: undetermined locale, case insensitive.
361
+ # * (empty string): Default to case-sensitive behavior.
362
+ #
363
+ # @return [String, nil] The collation for the field, or `nil`.
364
+ #
365
+ def collation
366
+ @gapi.collation
367
+ end
368
+
369
+ ##
370
+ # Updates the collation of the field.
371
+ #
372
+ # @param [String] new_collation The new collation. See {#collation}
373
+ # for supported values.
374
+ #
375
+ def collation= new_collation
376
+ @gapi.update! collation: new_collation
377
+ end
378
+
354
379
  ##
355
380
  # Checks if the type of the field is `STRING`.
356
381
  #
@@ -568,7 +593,7 @@ module Google
568
593
  # @param [Integer] max_length The maximum UTF-8 length of strings
569
594
  # allowed in the field.
570
595
  #
571
- def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
596
+ def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, collation: nil
572
597
  record_check!
573
598
 
574
599
  add_field name,
@@ -576,7 +601,8 @@ module Google
576
601
  description: description,
577
602
  mode: mode,
578
603
  policy_tags: policy_tags,
579
- max_length: max_length
604
+ max_length: max_length,
605
+ collation: collation
580
606
  end
581
607
 
582
608
  ##
@@ -1029,7 +1055,8 @@ module Google
1029
1055
  policy_tags: nil,
1030
1056
  max_length: nil,
1031
1057
  precision: nil,
1032
- scale: nil
1058
+ scale: nil,
1059
+ collation: nil
1033
1060
  frozen_check!
1034
1061
 
1035
1062
  new_gapi = Google::Apis::BigqueryV2::TableFieldSchema.new(
@@ -1046,6 +1073,7 @@ module Google
1046
1073
  new_gapi.max_length = max_length if max_length
1047
1074
  new_gapi.precision = precision if precision
1048
1075
  new_gapi.scale = scale if scale
1076
+ new_gapi.collation = collation if collation
1049
1077
  # Remove any existing field of this name
1050
1078
  @gapi.fields ||= []
1051
1079
  @gapi.fields.reject! { |f| f.name == new_gapi.name }
@@ -318,13 +318,14 @@ module Google
318
318
  # "[CURRENT_DATE(), DATE '2020-01-01'"]
319
319
  #
320
320
  def string name, description: nil, mode: :nullable, policy_tags: nil,
321
- max_length: nil, default_value_expression: nil
321
+ max_length: nil, default_value_expression: nil, collation: nil
322
322
  add_field name, :string,
323
323
  description: description,
324
324
  mode: mode,
325
325
  policy_tags: policy_tags,
326
326
  max_length: max_length,
327
- default_value_expression: default_value_expression
327
+ default_value_expression: default_value_expression,
328
+ collation: collation
328
329
  end
329
330
 
330
331
  ##
@@ -981,7 +982,8 @@ module Google
981
982
  max_length: nil,
982
983
  precision: nil,
983
984
  scale: nil,
984
- default_value_expression: nil
985
+ default_value_expression: nil,
986
+ collation: nil
985
987
  frozen_check!
986
988
 
987
989
  new_gapi = Google::Apis::BigqueryV2::TableFieldSchema.new(
@@ -999,6 +1001,7 @@ module Google
999
1001
  new_gapi.precision = precision if precision
1000
1002
  new_gapi.scale = scale if scale
1001
1003
  new_gapi.default_value_expression = default_value_expression if default_value_expression
1004
+ new_gapi.collation = collation if collation
1002
1005
  # Remove any existing field of this name
1003
1006
  @gapi.fields ||= []
1004
1007
  @gapi.fields.reject! { |f| f.name == new_gapi.name }
@@ -752,6 +752,37 @@ module Google
752
752
  patch_gapi! :description
753
753
  end
754
754
 
755
+ ##
756
+ # The default collation of the table.
757
+ #
758
+ # @return [String, nil] The default collation, or `nil` if not present or the object is a
759
+ # reference (see {#reference?}).
760
+ #
761
+ # @!group Attributes
762
+ #
763
+ def default_collation
764
+ return nil if reference?
765
+ ensure_full_data!
766
+ @gapi.default_collation
767
+ end
768
+
769
+ ##
770
+ # Updates the default collation of the table.
771
+ #
772
+ # If the table is not a full resource representation (see
773
+ # {#resource_full?}), the full representation will be retrieved before
774
+ # the update to comply with ETag-based optimistic concurrency control.
775
+ #
776
+ # @param [String] new_default_collation The new default collation for the table.
777
+ #
778
+ # @!group Attributes
779
+ #
780
+ def default_collation= new_default_collation
781
+ reload! unless resource_full?
782
+ @gapi.update! default_collation: new_default_collation
783
+ patch_gapi! :default_collation
784
+ end
785
+
755
786
  ##
756
787
  # The number of bytes in the table.
757
788
  #
@@ -3706,7 +3737,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3706
3737
  # At most 1 policy tag is currently allowed.
3707
3738
  # @param [Integer] max_length The maximum UTF-8 length of strings
3708
3739
  # allowed in the field.
3709
- # @param default_value_expression [String] The default value of a field
3740
+ # @param [String] default_value_expression The default value of a field
3710
3741
  # using a SQL expression. It can only be set for top level fields (columns).
3711
3742
  # Use a struct or array expression to specify default value for the entire struct or
3712
3743
  # array. The valid SQL expressions are:
@@ -3722,6 +3753,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3722
3753
  # `ST_GEOPOINT`
3723
3754
  # - Struct or array composed with the above allowed functions, for example:
3724
3755
  # "[CURRENT_DATE(), DATE '2020-01-01'"]
3756
+ # @param [String] collation The collation of the field.
3757
+ # Collation can be set only when the type of field is `STRING`.
3758
+ # The following values are supported:
3759
+ # - `und:ci`: undetermined locale, case insensitive.
3760
+ # - (empty string): Default to case-sensitive behavior.
3725
3761
  #
3726
3762
  # @example
3727
3763
  # require "google/cloud/bigquery"
@@ -3743,9 +3779,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3743
3779
  #
3744
3780
  # @!group Schema
3745
3781
  def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil,
3746
- default_value_expression: nil
3782
+ default_value_expression: nil, collation: nil
3747
3783
  schema.string name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length,
3748
- default_value_expression: default_value_expression
3784
+ default_value_expression: default_value_expression, collation: collation
3749
3785
  end
3750
3786
 
3751
3787
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.57.0".freeze
19
+ VERSION = "1.59.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.57.0
4
+ version: 1.59.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -165,6 +165,7 @@ files:
165
165
  - lib/google/cloud/bigquery/project.rb
166
166
  - lib/google/cloud/bigquery/project/list.rb
167
167
  - lib/google/cloud/bigquery/query_job.rb
168
+ - lib/google/cloud/bigquery/remote_function_options.rb
168
169
  - lib/google/cloud/bigquery/routine.rb
169
170
  - lib/google/cloud/bigquery/routine/list.rb
170
171
  - lib/google/cloud/bigquery/schema.rb