google-cloud-bigquery 1.14.1 → 1.15.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/google/cloud/bigquery/external.rb +46 -0
- data/lib/google/cloud/bigquery/extract_job.rb +46 -7
- data/lib/google/cloud/bigquery/model.rb +76 -0
- data/lib/google/cloud/bigquery/table.rb +0 -1
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4df9efe3b6ac3249b82a3745877dd0aab98407b753ca178f37c9e321f3d30751
|
4
|
+
data.tar.gz: 51e19ccf8ade5f37117eec63548fbefc72fb84c2537a62d6ffd539c2f4ad4360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d1d3d6e81228fb7c52939a72079c4016dbdf41826a79b2b010d0115bd1002b9931865d178a777a8139092fc5a147ab2046262bac2031ec2ea1de181344bca2
|
7
|
+
data.tar.gz: 2061b50a1e721dd602b0a689294c326ab2e12fe379c1081b3b2de6305a8b83122d3c8065c4b3c6df725b0a0c65395d1f92a12df659ee24a4205047a0278ac08c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.15.0 / 2019-09-30
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Add Model encryption
|
8
|
+
* Add Model#encryption
|
9
|
+
* Add Model#encryption=
|
10
|
+
* Add range support for Google Sheets
|
11
|
+
* Add External::SheetsSource#range
|
12
|
+
* Add External::SheetsSource#range=
|
13
|
+
* Support use_avro_logical_types on extract jobs
|
14
|
+
* Add ExtractJob#use_avro_logical_types?
|
15
|
+
* Add ExtractJob::Updater#use_avro_logical_types=
|
16
|
+
|
3
17
|
### 1.14.1 / 2019-09-04
|
4
18
|
|
5
19
|
#### Documentation
|
@@ -1224,6 +1224,52 @@ module Google
|
|
1224
1224
|
frozen_check!
|
1225
1225
|
@gapi.google_sheets_options.skip_leading_rows = row_count
|
1226
1226
|
end
|
1227
|
+
|
1228
|
+
##
|
1229
|
+
# Range of a sheet to query from. Only used when non-empty. Typical
|
1230
|
+
# format: `{sheet_name}!{top_left_cell_id}:{bottom_right_cell_id}`.
|
1231
|
+
#
|
1232
|
+
# @return [String] Range of a sheet to query from.
|
1233
|
+
#
|
1234
|
+
# @example
|
1235
|
+
# require "google/cloud/bigquery"
|
1236
|
+
#
|
1237
|
+
# bigquery = Google::Cloud::Bigquery.new
|
1238
|
+
#
|
1239
|
+
# sheets_url = "https://docs.google.com/spreadsheets/d/1234567980"
|
1240
|
+
# sheets_table = bigquery.external sheets_url do |sheets|
|
1241
|
+
# sheets.range = "sheet1!A1:B20"
|
1242
|
+
# end
|
1243
|
+
#
|
1244
|
+
# sheets_table.range #=> "sheet1!A1:B20"
|
1245
|
+
#
|
1246
|
+
def range
|
1247
|
+
@gapi.google_sheets_options.range
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
##
|
1251
|
+
# Set the range of a sheet to query from. Only used when non-empty.
|
1252
|
+
# Typical format:
|
1253
|
+
# `{sheet_name}!{top_left_cell_id}:{bottom_right_cell_id}`.
|
1254
|
+
#
|
1255
|
+
# @param [String] new_range New range of a sheet to query from.
|
1256
|
+
#
|
1257
|
+
# @example
|
1258
|
+
# require "google/cloud/bigquery"
|
1259
|
+
#
|
1260
|
+
# bigquery = Google::Cloud::Bigquery.new
|
1261
|
+
#
|
1262
|
+
# sheets_url = "https://docs.google.com/spreadsheets/d/1234567980"
|
1263
|
+
# sheets_table = bigquery.external sheets_url do |sheets|
|
1264
|
+
# sheets.range = "sheet1!A1:B20"
|
1265
|
+
# end
|
1266
|
+
#
|
1267
|
+
# sheets_table.range #=> "sheet1!A1:B20"
|
1268
|
+
#
|
1269
|
+
def range= new_range
|
1270
|
+
frozen_check!
|
1271
|
+
@gapi.google_sheets_options.range = new_range
|
1272
|
+
end
|
1227
1273
|
end
|
1228
1274
|
|
1229
1275
|
##
|
@@ -156,6 +156,20 @@ module Google
|
|
156
156
|
Hash[destinations.zip destinations_file_counts]
|
157
157
|
end
|
158
158
|
|
159
|
+
##
|
160
|
+
# If `#avro?` (`#format` is set to `"AVRO"`), this flag indicates
|
161
|
+
# whether to enable extracting applicable column types (such as
|
162
|
+
# `TIMESTAMP`) to their corresponding AVRO logical types
|
163
|
+
# (`timestamp-micros`), instead of only using their raw types
|
164
|
+
# (`avro-long`).
|
165
|
+
#
|
166
|
+
# @return [Boolean] `true` when applicable column types will use their
|
167
|
+
# corresponding AVRO logical types, `false` otherwise.
|
168
|
+
#
|
169
|
+
def use_avro_logical_types?
|
170
|
+
@gapi.configuration.extract.use_avro_logical_types
|
171
|
+
end
|
172
|
+
|
159
173
|
##
|
160
174
|
# Yielded to a block to accumulate changes for an API request.
|
161
175
|
class Updater < ExtractJob
|
@@ -175,11 +189,8 @@ module Google
|
|
175
189
|
storage_urls = Array(storage_files).map do |url|
|
176
190
|
url.respond_to?(:to_gs_url) ? url.to_gs_url : url
|
177
191
|
end
|
178
|
-
|
179
|
-
|
180
|
-
dest_format = Convert.derive_source_format storage_urls.first
|
181
|
-
end
|
182
|
-
req = Google::Apis::BigqueryV2::Job.new(
|
192
|
+
options[:format] ||= Convert.derive_source_format storage_urls.first
|
193
|
+
job = Google::Apis::BigqueryV2::Job.new(
|
183
194
|
job_reference: job_ref,
|
184
195
|
configuration: Google::Apis::BigqueryV2::JobConfiguration.new(
|
185
196
|
extract: Google::Apis::BigqueryV2::JobConfigurationExtract.new(
|
@@ -190,12 +201,24 @@ module Google
|
|
190
201
|
)
|
191
202
|
)
|
192
203
|
|
193
|
-
|
204
|
+
from_job_and_options job, options
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# @private Create an Updater from a Job and options hash.
|
209
|
+
#
|
210
|
+
# @return [Google::Cloud::Bigquery::ExtractJob::Updater] A job
|
211
|
+
# configuration object for setting query options.
|
212
|
+
def self.from_job_and_options request, options = {}
|
213
|
+
updater = ExtractJob::Updater.new request
|
194
214
|
updater.compression = options[:compression]
|
195
215
|
updater.delimiter = options[:delimiter]
|
196
|
-
updater.format =
|
216
|
+
updater.format = options[:format]
|
197
217
|
updater.header = options[:header]
|
198
218
|
updater.labels = options[:labels] if options[:labels]
|
219
|
+
unless options[:use_avro_logical_types].nil?
|
220
|
+
updater.use_avro_logical_types = options[:use_avro_logical_types]
|
221
|
+
end
|
199
222
|
updater
|
200
223
|
end
|
201
224
|
|
@@ -300,6 +323,22 @@ module Google
|
|
300
323
|
@gapi.configuration.update! labels: value
|
301
324
|
end
|
302
325
|
|
326
|
+
##
|
327
|
+
# Indicate whether to enable extracting applicable column types (such
|
328
|
+
# as `TIMESTAMP`) to their corresponding AVRO logical types
|
329
|
+
# (`timestamp-micros`), instead of only using their raw types
|
330
|
+
# (`avro-long`).
|
331
|
+
#
|
332
|
+
# Only used when `#format` is set to `"AVRO"` (`#avro?`).
|
333
|
+
#
|
334
|
+
# @param [Boolean] value Whether applicable column types will use
|
335
|
+
# their corresponding AVRO logical types.
|
336
|
+
#
|
337
|
+
# @!group Attributes
|
338
|
+
def use_avro_logical_types= value
|
339
|
+
@gapi.configuration.extract.use_avro_logical_types = value
|
340
|
+
end
|
341
|
+
|
303
342
|
##
|
304
343
|
# @private Returns the Google API client library version of this job.
|
305
344
|
#
|
@@ -366,6 +366,82 @@ module Google
|
|
366
366
|
patch_gapi! labels: new_labels
|
367
367
|
end
|
368
368
|
|
369
|
+
##
|
370
|
+
# The {EncryptionConfiguration} object that represents the custom
|
371
|
+
# encryption method used to protect this model. If not set, default
|
372
|
+
# encryption is used.
|
373
|
+
#
|
374
|
+
# Present only if this model is using custom encryption.
|
375
|
+
#
|
376
|
+
# @see https://cloud.google.com/bigquery/docs/customer-managed-encryption
|
377
|
+
# Protecting Data with Cloud KMS Keys
|
378
|
+
#
|
379
|
+
# @return [EncryptionConfiguration, nil] The encryption configuration.
|
380
|
+
#
|
381
|
+
# @!group Attributes
|
382
|
+
#
|
383
|
+
# @example
|
384
|
+
# require "google/cloud/bigquery"
|
385
|
+
#
|
386
|
+
# bigquery = Google::Cloud::Bigquery.new
|
387
|
+
# dataset = bigquery.dataset "my_dataset"
|
388
|
+
# model = dataset.model "my_model"
|
389
|
+
#
|
390
|
+
# encrypt_config = model.encryption
|
391
|
+
#
|
392
|
+
# @!group Attributes
|
393
|
+
#
|
394
|
+
def encryption
|
395
|
+
return nil if reference?
|
396
|
+
return nil if @gapi_json[:encryptionConfiguration].nil?
|
397
|
+
# We have to create a gapic object from the hash because that is what
|
398
|
+
# EncryptionConfiguration is expecing.
|
399
|
+
json_cmek = @gapi_json[:encryptionConfiguration].to_json
|
400
|
+
gapi_cmek = \
|
401
|
+
Google::Apis::BigqueryV2::EncryptionConfiguration.from_json(
|
402
|
+
json_cmek
|
403
|
+
)
|
404
|
+
EncryptionConfiguration.from_gapi(gapi_cmek).freeze
|
405
|
+
end
|
406
|
+
|
407
|
+
##
|
408
|
+
# Set the {EncryptionConfiguration} object that represents the custom
|
409
|
+
# encryption method used to protect this model. If not set, default
|
410
|
+
# encryption is used.
|
411
|
+
#
|
412
|
+
# Present only if this model is using custom encryption.
|
413
|
+
#
|
414
|
+
# If the model is not a full resource representation (see
|
415
|
+
# {#resource_full?}), the full representation will be retrieved before
|
416
|
+
# the update to comply with ETag-based optimistic concurrency control.
|
417
|
+
#
|
418
|
+
# @see https://cloud.google.com/bigquery/docs/customer-managed-encryption
|
419
|
+
# Protecting Data with Cloud KMS Keys
|
420
|
+
#
|
421
|
+
# @param [EncryptionConfiguration] value The new encryption config.
|
422
|
+
#
|
423
|
+
# @example
|
424
|
+
# require "google/cloud/bigquery"
|
425
|
+
#
|
426
|
+
# bigquery = Google::Cloud::Bigquery.new
|
427
|
+
# dataset = bigquery.dataset "my_dataset"
|
428
|
+
# model = dataset.model "my_model"
|
429
|
+
#
|
430
|
+
# key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
|
431
|
+
# encrypt_config = bigquery.encryption kms_key: key_name
|
432
|
+
#
|
433
|
+
# model.encryption = encrypt_config
|
434
|
+
#
|
435
|
+
# @!group Attributes
|
436
|
+
#
|
437
|
+
def encryption= value
|
438
|
+
ensure_full_data!
|
439
|
+
# We have to create a hash from the gapic object's JSON because that
|
440
|
+
# is what Model is expecing.
|
441
|
+
json_cmek = JSON.parse value.to_gapi.to_json, symbolize_names: true
|
442
|
+
patch_gapi! encryptionConfiguration: json_cmek
|
443
|
+
end
|
444
|
+
|
369
445
|
##
|
370
446
|
# The input feature columns that were used to train this model.
|
371
447
|
#
|
@@ -906,7 +906,6 @@ module Google
|
|
906
906
|
# {#resource_full?}), the full representation will be retrieved before
|
907
907
|
# the update to comply with ETag-based optimistic concurrency control.
|
908
908
|
#
|
909
|
-
#
|
910
909
|
# @see https://cloud.google.com/bigquery/docs/customer-managed-encryption
|
911
910
|
# Protecting Data with Cloud KMS Keys
|
912
911
|
#
|
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.
|
4
|
+
version: 1.15.0
|
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: 2019-09-
|
12
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0.
|
34
|
+
version: '0.31'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
41
|
+
version: '0.31'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: googleauth
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|