google-cloud-bigquery 1.11.0 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 320433f33bcb051d07a42335735d2b80500b7bbe2546bb20dcdb67e5c62b2f6a
4
- data.tar.gz: 7f91617d36ea5c2917be9c555134ecdd7d9efd07e74852d47ab18c6d9ebfe3c8
3
+ metadata.gz: af312b5a34c7761d3c9023ca0905f486df0ce6be2e1e6c0fbd5ad3eaddf55554
4
+ data.tar.gz: a24f6071b4f439c8f6a2d8ab2c78efdd83dcac355c778043098dc59162402d00
5
5
  SHA512:
6
- metadata.gz: a377500707a12139df115775db7a193ad5e28090394134c8f1116a8ede7a92e0c8c91bcb1eecb736f1240f35a7ec20cc433885a6d143e50e20b19b27e088a5e1
7
- data.tar.gz: 4d7118fb5872d718e2268e980251b9002a1a3e625baf58f56f2f8c1f4f52264ae5d3296fb1c1e2977a5ba62ec63291f8d33cb1749289160e2a5a5621a8497bb6
6
+ metadata.gz: bd85e8b063c0370c7c66ed7ac433d311c1910ae1d772288a83e36b3bb29095e4870ba7d6f886715ee1d2512a0b1b19988e78bd879edc70218c304f61217c082a
7
+ data.tar.gz: e2f2ecfafa58a0c94628e2cecf8ad4f43d78314ece44ae3be1187e27db100b917120df19328593646b288ba09112166dcbb966c2cf7d50627729d138d02e082d
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ### 1.11.1 / 2019-05-21
4
+
5
+ * Declare explicit dependency on mime-types
6
+
3
7
  ### 1.11.0 / 2019-02-01
4
8
 
5
9
  * Make use of Credentials#project_id
@@ -8,7 +12,7 @@
8
12
  This value was added in googleauth 0.7.0.
9
13
  * Loosen googleauth dependency
10
14
  Allow for new releases up to 0.10.
11
- The googleauth devs have committed to maintanining the current API
15
+ The googleauth devs have committed to maintaining the current API
12
16
  and will not make backwards compatible changes before 0.10.
13
17
 
14
18
  ### 1.10.0 / 2018-12-06
@@ -360,6 +360,20 @@ module Google
360
360
  return "DATASTORE_BACKUP" if path.end_with? ".backup_info"
361
361
  nil
362
362
  end
363
+
364
+ ##
365
+ # @private
366
+ #
367
+ # Converts a primitive time value in milliseconds to a Ruby Time object.
368
+ #
369
+ # @return [Time, nil] The Ruby Time object, or nil if the given argument
370
+ # is nil.
371
+ def self.millis_to_time time_millis
372
+ return nil unless time_millis
373
+ time_millis = Integer time_millis
374
+ time_secs = time_millis / 1000.0
375
+ ::Time.at time_secs
376
+ end
363
377
  end
364
378
 
365
379
  # rubocop:enable Metrics/ModuleLength
@@ -439,9 +439,9 @@ module Google
439
439
  #
440
440
  def all request_limit: nil
441
441
  request_limit = request_limit.to_i if request_limit
442
- unless block_given?
443
- return enum_for(:all, request_limit: request_limit)
444
- end
442
+
443
+ return enum_for :all, request_limit: request_limit unless block_given?
444
+
445
445
  results = self
446
446
  loop do
447
447
  results.each { |r| yield r }
@@ -20,6 +20,7 @@ require "google/cloud/bigquery/table"
20
20
  require "google/cloud/bigquery/external"
21
21
  require "google/cloud/bigquery/dataset/list"
22
22
  require "google/cloud/bigquery/dataset/access"
23
+ require "google/cloud/bigquery/convert"
23
24
  require "google/apis/bigquery_v2"
24
25
 
25
26
  module Google
@@ -237,11 +238,7 @@ module Google
237
238
  def created_at
238
239
  return nil if reference?
239
240
  ensure_full_data!
240
- begin
241
- ::Time.at(Integer(@gapi.creation_time) / 1000.0)
242
- rescue StandardError
243
- nil
244
- end
241
+ Convert.millis_to_time @gapi.creation_time
245
242
  end
246
243
 
247
244
  ##
@@ -255,11 +252,7 @@ module Google
255
252
  def modified_at
256
253
  return nil if reference?
257
254
  ensure_full_data!
258
- begin
259
- ::Time.at(Integer(@gapi.last_modified_time) / 1000.0)
260
- rescue StandardError
261
- nil
262
- end
255
+ Convert.millis_to_time @gapi.last_modified_time
263
256
  end
264
257
 
265
258
  ##
@@ -2261,7 +2254,7 @@ module Google
2261
2254
  return [] if array_or_str.nil?
2262
2255
  Array(array_or_str).map do |uri_or_code|
2263
2256
  resource = Google::Apis::BigqueryV2::UserDefinedFunctionResource.new
2264
- if uri_or_code.start_with?("gs://")
2257
+ if uri_or_code.start_with? "gs://"
2265
2258
  resource.resource_uri = uri_or_code
2266
2259
  else
2267
2260
  resource.inline_code = uri_or_code
@@ -935,10 +935,10 @@ module Google
935
935
 
936
936
  # @private
937
937
  def add_access_role_scope_value role, scope, value
938
- role = validate_role(role)
938
+ role = validate_role role
939
939
  scope = validate_scope scope
940
940
  # If scope is special group, make sure value is in the list
941
- value = validate_special_group(value) if scope == :special_group
941
+ value = validate_special_group value if scope == :special_group
942
942
  # Remove any rules of this scope and value
943
943
  @rules.reject!(&find_by_scope_and_value(scope, value))
944
944
  # Add new rule for this role, scope, and value
@@ -949,7 +949,7 @@ module Google
949
949
  # @private
950
950
  def add_access_view value
951
951
  # scope is view, make sure value is in the right format
952
- value = validate_view(value)
952
+ value = validate_view value
953
953
  # Remove existing view rule, if any
954
954
  @rules.reject!(&find_view(value))
955
955
  # Add new rule for this role, scope, and value
@@ -959,10 +959,10 @@ module Google
959
959
 
960
960
  # @private
961
961
  def remove_access_role_scope_value role, scope, value
962
- role = validate_role(role)
962
+ role = validate_role role
963
963
  scope = validate_scope scope
964
964
  # If scope is special group, make sure value is in the list
965
- value = validate_special_group(value) if scope == :special_group
965
+ value = validate_special_group value if scope == :special_group
966
966
  # Remove any rules of this role, scope, and value
967
967
  @rules.reject!(
968
968
  &find_by_role_and_scope_and_value(role, scope, value)
@@ -972,17 +972,17 @@ module Google
972
972
  # @private
973
973
  def remove_access_view value
974
974
  # scope is view, make sure value is in the right format
975
- value = validate_view(value)
975
+ value = validate_view value
976
976
  # Remove existing view rule, if any
977
977
  @rules.reject!(&find_view(value))
978
978
  end
979
979
 
980
980
  # @private
981
981
  def lookup_access_role_scope_value role, scope, value
982
- role = validate_role(role)
982
+ role = validate_role role
983
983
  scope = validate_scope scope
984
984
  # If scope is special group, make sure value is in the list
985
- value = validate_special_group(value) if scope == :special_group
985
+ value = validate_special_group value if scope == :special_group
986
986
  # Detect any rules of this role, scope, and value
987
987
  !(!@rules.detect(
988
988
  &find_by_role_and_scope_and_value(role, scope, value)
@@ -992,7 +992,7 @@ module Google
992
992
  # @private
993
993
  def lookup_access_view value
994
994
  # scope is view, make sure value is in the right format
995
- value = validate_view(value)
995
+ value = validate_view value
996
996
  # Detect view rule, if any
997
997
  !(!@rules.detect(&find_view(value)))
998
998
  end
@@ -124,7 +124,7 @@ module Google
124
124
  def all request_limit: nil
125
125
  request_limit = request_limit.to_i if request_limit
126
126
  unless block_given?
127
- return enum_for(:all, request_limit: request_limit)
127
+ return enum_for :all, request_limit: request_limit
128
128
  end
129
129
  results = self
130
130
  loop do
@@ -16,6 +16,7 @@
16
16
  require "google/cloud/errors"
17
17
  require "google/cloud/bigquery/service"
18
18
  require "google/cloud/bigquery/job/list"
19
+ require "google/cloud/bigquery/convert"
19
20
  require "json"
20
21
 
21
22
  module Google
@@ -172,9 +173,7 @@ module Google
172
173
  # @return [Time, nil] The creation time from the job statistics.
173
174
  #
174
175
  def created_at
175
- ::Time.at(Integer(@gapi.statistics.creation_time) / 1000.0)
176
- rescue StandardError
177
- nil
176
+ Convert.millis_to_time @gapi.statistics.creation_time
178
177
  end
179
178
 
180
179
  ##
@@ -185,9 +184,7 @@ module Google
185
184
  # @return [Time, nil] The start time from the job statistics.
186
185
  #
187
186
  def started_at
188
- ::Time.at(Integer(@gapi.statistics.start_time) / 1000.0)
189
- rescue StandardError
190
- nil
187
+ Convert.millis_to_time @gapi.statistics.start_time
191
188
  end
192
189
 
193
190
  ##
@@ -197,9 +194,7 @@ module Google
197
194
  # @return [Time, nil] The end time from the job statistics.
198
195
  #
199
196
  def ended_at
200
- ::Time.at(Integer(@gapi.statistics.end_time) / 1000.0)
201
- rescue StandardError
202
- nil
197
+ Convert.millis_to_time @gapi.statistics.end_time
203
198
  end
204
199
 
205
200
  ##
@@ -124,7 +124,7 @@ module Google
124
124
  def all request_limit: nil
125
125
  request_limit = request_limit.to_i if request_limit
126
126
  unless block_given?
127
- return enum_for(:all, request_limit: request_limit)
127
+ return enum_for :all, request_limit: request_limit
128
128
  end
129
129
  results = self
130
130
  loop do
@@ -125,7 +125,7 @@ module Google
125
125
  def all request_limit: nil
126
126
  request_limit = request_limit.to_i if request_limit
127
127
  unless block_given?
128
- return enum_for(:all, request_limit: request_limit)
128
+ return enum_for :all, request_limit: request_limit
129
129
  end
130
130
  results = self
131
131
  loop do
@@ -1178,7 +1178,7 @@ module Google
1178
1178
  Array(array_or_str).map do |uri_or_code|
1179
1179
  resource =
1180
1180
  Google::Apis::BigqueryV2::UserDefinedFunctionResource.new
1181
- if uri_or_code.start_with?("gs://")
1181
+ if uri_or_code.start_with? "gs://"
1182
1182
  resource.resource_uri = uri_or_code
1183
1183
  else
1184
1184
  resource.inline_code = uri_or_code
@@ -90,7 +90,9 @@ module Google
90
90
  # Returns the dataset specified by datasetID.
91
91
  def get_dataset dataset_id
92
92
  # The get operation is considered idempotent
93
- execute(backoff: true) { service.get_dataset @project, dataset_id }
93
+ execute backoff: true do
94
+ service.get_dataset @project, dataset_id
95
+ end
94
96
  end
95
97
 
96
98
  ##
@@ -253,7 +255,7 @@ module Google
253
255
  # Cancel the job specified by jobId.
254
256
  def cancel_job job_id, location: nil
255
257
  # The BigQuery team has told us cancelling is considered idempotent
256
- execute(backoff: true) do
258
+ execute backoff: true do
257
259
  service.cancel_job @project, job_id, location: location
258
260
  end
259
261
  end
@@ -262,7 +264,7 @@ module Google
262
264
  # Returns the job specified by jobID.
263
265
  def get_job job_id, location: nil
264
266
  # The get operation is considered idempotent
265
- execute(backoff: true) do
267
+ execute backoff: true do
266
268
  service.get_job @project, job_id, location: location
267
269
  end
268
270
  end
@@ -273,7 +275,9 @@ module Google
273
275
  configuration: config
274
276
  )
275
277
  # Jobs have generated id, so this operation is considered idempotent
276
- execute(backoff: true) { service.insert_job @project, job_object }
278
+ execute backoff: true do
279
+ service.insert_job @project, job_object
280
+ end
277
281
  end
278
282
 
279
283
  def query_job query_job_gapi
@@ -414,7 +418,7 @@ module Google
414
418
 
415
419
  # Generate a random string similar to the BigQuery service job IDs.
416
420
  def generate_id
417
- SecureRandom.urlsafe_base64(21)
421
+ SecureRandom.urlsafe_base64 21
418
422
  end
419
423
 
420
424
  def mime_type_for file
@@ -432,7 +436,7 @@ module Google
432
436
  yield
433
437
  end
434
438
  rescue Google::Apis::Error => e
435
- raise Google::Cloud::Error.from_error(e)
439
+ raise Google::Cloud::Error.from_error e
436
440
  end
437
441
 
438
442
  class Backoff
@@ -22,6 +22,7 @@ require "google/cloud/bigquery/encryption_configuration"
22
22
  require "google/cloud/bigquery/external"
23
23
  require "google/cloud/bigquery/insert_response"
24
24
  require "google/cloud/bigquery/table/async_inserter"
25
+ require "google/cloud/bigquery/convert"
25
26
  require "google/apis/bigquery_v2"
26
27
 
27
28
  module Google
@@ -558,11 +559,7 @@ module Google
558
559
  def created_at
559
560
  return nil if reference?
560
561
  ensure_full_data!
561
- begin
562
- ::Time.at(Integer(@gapi.creation_time) / 1000.0)
563
- rescue StandardError
564
- nil
565
- end
562
+ Convert.millis_to_time @gapi.creation_time
566
563
  end
567
564
 
568
565
  ##
@@ -578,11 +575,7 @@ module Google
578
575
  def expires_at
579
576
  return nil if reference?
580
577
  ensure_full_data!
581
- begin
582
- ::Time.at(Integer(@gapi.expiration_time) / 1000.0)
583
- rescue StandardError
584
- nil
585
- end
578
+ Convert.millis_to_time @gapi.expiration_time
586
579
  end
587
580
 
588
581
  ##
@@ -596,11 +589,7 @@ module Google
596
589
  def modified_at
597
590
  return nil if reference?
598
591
  ensure_full_data!
599
- begin
600
- ::Time.at(Integer(@gapi.last_modified_time) / 1000.0)
601
- rescue StandardError
602
- nil
603
- end
592
+ Convert.millis_to_time @gapi.last_modified_time
604
593
  end
605
594
 
606
595
  ##
@@ -987,11 +976,7 @@ module Google
987
976
  ensure_full_data!
988
977
  return nil unless @gapi.streaming_buffer
989
978
  oldest_entry_time = @gapi.streaming_buffer.oldest_entry_time
990
- begin
991
- ::Time.at(Integer(oldest_entry_time) / 1000.0)
992
- rescue StandardError
993
- nil
994
- end
979
+ Convert.millis_to_time oldest_entry_time
995
980
  end
996
981
 
997
982
  ##
@@ -1747,7 +1732,7 @@ module Google
1747
1732
 
1748
1733
  job_gapi = updater.to_gapi
1749
1734
 
1750
- return load_local(files, job_gapi) if local_file? files
1735
+ return load_local files, job_gapi if local_file? files
1751
1736
  load_storage files, job_gapi
1752
1737
  end
1753
1738
 
@@ -2490,7 +2475,7 @@ module Google
2490
2475
  return [] if array_or_str.nil?
2491
2476
  Array(array_or_str).map do |uri_or_code|
2492
2477
  resource = Google::Apis::BigqueryV2::UserDefinedFunctionResource.new
2493
- if uri_or_code.start_with?("gs://")
2478
+ if uri_or_code.start_with? "gs://"
2494
2479
  resource.resource_uri = uri_or_code
2495
2480
  else
2496
2481
  resource.inline_code = uri_or_code
@@ -231,7 +231,8 @@ module Google
231
231
  time_since_first_publish = ::Time.now - @batch_created_at
232
232
  if time_since_first_publish < @interval
233
233
  # still waiting for the interval to insert the batch...
234
- @cond.wait(@interval - time_since_first_publish)
234
+ timeout = @interval - time_since_first_publish
235
+ @cond.wait timeout
235
236
  else
236
237
  # interval met, insert the batch...
237
238
  push_batch_request!
@@ -247,7 +248,7 @@ module Google
247
248
  orig_rows = @batch.rows
248
249
  json_rows = @batch.json_rows
249
250
  insert_ids = @batch.insert_ids
250
- Concurrent::Future.new(executor: @thread_pool) do
251
+ Concurrent::Future.new executor: @thread_pool do
251
252
  begin
252
253
  raise ArgumentError, "No rows provided" if json_rows.empty?
253
254
  options = { skip_invalid: @skip_invalid,
@@ -134,7 +134,7 @@ module Google
134
134
  def all request_limit: nil
135
135
  request_limit = request_limit.to_i if request_limit
136
136
  unless block_given?
137
- return enum_for(:all, request_limit: request_limit)
137
+ return enum_for :all, request_limit: request_limit
138
138
  end
139
139
  results = self
140
140
  loop do
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.11.0".freeze
19
+ VERSION = "1.11.1".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.11.0
4
+ version: 1.11.1
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-02-01 00:00:00.000000000 Z
12
+ date: 2019-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -73,6 +73,20 @@ dependencies:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: mime-types
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
76
90
  - !ruby/object:Gem::Dependency
77
91
  name: minitest
78
92
  requirement: !ruby/object:Gem::Requirement
@@ -163,14 +177,14 @@ dependencies:
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: 0.61.0
180
+ version: 0.64.0
167
181
  type: :development
168
182
  prerelease: false
169
183
  version_requirements: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: 0.61.0
187
+ version: 0.64.0
174
188
  - !ruby/object:Gem::Dependency
175
189
  name: simplecov
176
190
  requirement: !ruby/object:Gem::Requirement
@@ -276,8 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
290
  - !ruby/object:Gem::Version
277
291
  version: '0'
278
292
  requirements: []
279
- rubyforge_project:
280
- rubygems_version: 2.7.6
293
+ rubygems_version: 3.0.3
281
294
  signing_key:
282
295
  specification_version: 4
283
296
  summary: API Client library for Google BigQuery