google-cloud-bigquery 1.57.0 → 1.58.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: 7eb6ceb935eefe0881476f99a5f6e7bdf85e42debb251ba34ef999a3845ca3ef
4
+ data.tar.gz: 71cb8fa56300a051b257e77fb332fee37a18044fb26317a3e0eebbb57023144d
5
5
  SHA512:
6
- metadata.gz: 361370e039788d37aaebe2c3dc368e3715e7f09c65ffc85727285c1cdfe608412e09352570e3f1c88abb52b52c851646540c67e3c023c344ef1d8f37cab78086
7
- data.tar.gz: 8b86e329d6843a4d4387f1c1daf1ed3feaabe47284ad4e8320ce3c9e39a492fadbecfe46006e1b0a38fedbe94250795aa0968a2148c94e0f1bf25a4514ad2d92
6
+ metadata.gz: 70305f4088f9af6ad6823f07e9326a5db55e2abfd17094d4a3d52ae1dd85dae871df5acaec43b9163130f7cbe226a3339dbcef96bbf181fdbafcbbdfca70bcb8
7
+ data.tar.gz: 93f2a24709c74dae96f6732ee36d328f9f46e9cecb63f87ac1da70d9e37d1a4d03c452ae4c4a772b31adb5145cb53157f4d14869d54f0131208ac2060551cb19
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 1.58.0 (2025-09-03)
4
+
5
+ #### Features
6
+
7
+ * Add support for remote function options ([#30822](https://github.com/googleapis/google-cloud-ruby/issues/30822))
8
+
3
9
  ### 1.57.0 (2025-08-28)
4
10
 
5
11
  #### Features
@@ -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
@@ -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.58.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.58.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