google-cloud-bigquery 0.30.0 → 1.0.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: 8c5eccec9f2f10fd5b5637a91516d68bee4f8b7f2e7e8e58a6b213afe89e56fe
4
- data.tar.gz: 55d8b9b98cd3e52bb7c6111feaa9811487c61a4b2868126c54af7f9dec5fde1b
3
+ metadata.gz: 74839ee1c88e2e24abdd6d512f8a452e1d1a082625d24e01edc47181ffd13f04
4
+ data.tar.gz: 9f9953c3b0b6eacfa267fbba3965119e7dcb10452a5c5ea5a7af221a9a50621a
5
5
  SHA512:
6
- metadata.gz: 6377e7a4cef9081723669ae08913786a1cdb37d65b0ae922dfc0a930e664eec451f95802e3f95f96eefcf24a5bf2eff23b00102bdd1f449a076018b7fc4d61cc
7
- data.tar.gz: 9a4e917438c795ba7baa5692c5c6b70de0593b047e575f6113f112221d5c9925348e17ed6564d9361a872d6ca9918ac12df421a217e1d6e1096e98649829e447
6
+ metadata.gz: 1690839d5bf4ae37c36aa0e70f57ff57e7a724916732ecb486d55b78a7b1cc81d2c5efcf8ce9db4af13049aede00a5a005bcf5391e99ca59fbef353eb011b757
7
+ data.tar.gz: 190dd0298a146cfc1a7f58687c771a7603a374084af4614627aeb02539cbf4cd1dde2b82ad09b591dfb3f36653b1673fa771aea7fac2c57e940bdd030cbf7c9c
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  Apache License
2
2
  Version 2.0, January 2004
3
- http://www.apache.org/licenses/
3
+ https://www.apache.org/licenses/
4
4
 
5
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
@@ -192,7 +192,7 @@
192
192
  you may not use this file except in compliance with the License.
193
193
  You may obtain a copy of the License at
194
194
 
195
- http://www.apache.org/licenses/LICENSE-2.0
195
+ https://www.apache.org/licenses/LICENSE-2.0
196
196
 
197
197
  Unless required by applicable law or agreed to in writing, software
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2016 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,11 +27,12 @@ module Google
27
27
  # BigQuery?](https://cloud.google.com/bigquery/what-is-bigquery).
28
28
  #
29
29
  # The goal of google-cloud is to provide an API that is comfortable to
30
- # Rubyists. Authentication is handled by {Google::Cloud#bigquery}. You can
31
- # provide the project and credential information to connect to the BigQuery
32
- # service, or if you are running on Google Compute Engine this configuration
33
- # is taken care of for you. You can read more about the options for
34
- # connecting in the [Authentication
30
+ # Rubyists. Your authentication credentials are detected automatically in
31
+ # Google Cloud Platform environments such as Google Compute Engine, Google
32
+ # App Engine and Google Kubernetes Engine. In other environments you can
33
+ # configure authentication easily, either directly in your code or via
34
+ # environment variables. Read more about the options for connecting in the
35
+ # [Authentication
35
36
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
36
37
  #
37
38
  # To help you get started quickly, the first few examples below use a public
@@ -92,10 +93,6 @@ module Google
92
93
  # as discussed in the guide [Migrating from legacy
93
94
  # SQL](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql).
94
95
  #
95
- # In addition, BigQuery offers both synchronous and asynchronous methods, as
96
- # explained in [Querying
97
- # Data](https://cloud.google.com/bigquery/querying-data).
98
- #
99
96
  # ### Standard SQL
100
97
  #
101
98
  # Standard SQL is the preferred SQL dialect for querying data stored in
@@ -199,9 +196,9 @@ module Google
199
196
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types)
200
197
  # for an overview of each BigQuery data type, including allowed values.
201
198
  #
202
- # ### Synchronous queries
199
+ # ### Running Queries
203
200
  #
204
- # Let's start with the simpler synchronous approach. Notice that this time
201
+ # Let's start with the simplest way to run a query. Notice that this time
205
202
  # you are connecting using your own default project. It is necessary to have
206
203
  # write access to the project for running a query, since queries need to
207
204
  # create tables to hold results.
@@ -225,14 +222,13 @@ module Google
225
222
  # SQL)](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators)
226
223
  # for a full listing.
227
224
  #
228
- # ### Asynchronous queries
225
+ # ### Query Jobs
229
226
  #
230
227
  # It is usually best not to block for most BigQuery operations, including
231
228
  # querying as well as importing, exporting, and copying data. Therefore, the
232
229
  # BigQuery API provides facilities for managing longer-running jobs. With
233
- # the asynchronous approach to running a query, an instance of
234
- # {Google::Cloud::Bigquery::QueryJob} is returned, rather than an instance
235
- # of {Google::Cloud::Bigquery::Data}.
230
+ # this approach, an instance of {Google::Cloud::Bigquery::QueryJob} is
231
+ # returned, rather than an instance of {Google::Cloud::Bigquery::Data}.
236
232
  #
237
233
  # ```ruby
238
234
  # require "google/cloud/bigquery"
@@ -1,10 +1,10 @@
1
- # Copyright 2017 Google Inc. All rights reserved.
1
+ # Copyright 2017 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,22 +22,29 @@ module Google
22
22
  ##
23
23
  # # Data
24
24
  #
25
- # Represents {Table} Data as a list of name/value pairs (hashes.)
26
- # Also contains metadata such as `etag` and `total`, and provides access
27
- # to the schema of the table from which the data was read.
25
+ # Represents a page of results (rows) as an array of hashes. Because Data
26
+ # delegates to Array, methods such as `Array#count` represent the number
27
+ # of rows in the page. In addition, methods of this class include result
28
+ # set metadata such as `total` and provide access to the schema of the
29
+ # query or table. See {Project#query}, {Dataset#query} and {Table#data}.
28
30
  #
29
31
  # @example
30
32
  # require "google/cloud/bigquery"
31
33
  #
32
34
  # bigquery = Google::Cloud::Bigquery.new
33
- # dataset = bigquery.dataset "my_dataset"
34
- # table = dataset.table "my_table"
35
35
  #
36
- # data = table.data
37
- # puts "#{data.count} of #{data.total}"
38
- # if data.next?
39
- # next_data = data.next
36
+ # sql = "SELECT word FROM publicdata.samples.shakespeare"
37
+ # job = bigquery.query_job sql
38
+ #
39
+ # job.wait_until_done!
40
+ # data = job.data
41
+ #
42
+ # data.count # 100000
43
+ # data.total # 164656
44
+ # data.each do |row|
45
+ # puts row[:word]
40
46
  # end
47
+ # data = data.next if data.next?
41
48
  #
42
49
  class Data < DelegateClass(::Array)
43
50
  ##
@@ -97,14 +104,19 @@ module Google
97
104
  # require "google/cloud/bigquery"
98
105
  #
99
106
  # bigquery = Google::Cloud::Bigquery.new
100
- # dataset = bigquery.dataset "my_dataset"
101
- # table = dataset.table "my_table"
102
107
  #
103
- # data = table.data
104
- # puts "#{data.count} of #{data.total}"
105
- # if data.next?
106
- # next_data = data.next
108
+ # sql = "SELECT word FROM publicdata.samples.shakespeare"
109
+ # job = bigquery.query_job sql
110
+ #
111
+ # job.wait_until_done!
112
+ # data = job.data
113
+ #
114
+ # data.count # 100000
115
+ # data.total # 164656
116
+ # data.each do |row|
117
+ # puts row[:word]
107
118
  # end
119
+ # data = data.next if data.next?
108
120
  #
109
121
  def total
110
122
  Integer @gapi_json[:totalRows]
@@ -192,13 +204,19 @@ module Google
192
204
  # require "google/cloud/bigquery"
193
205
  #
194
206
  # bigquery = Google::Cloud::Bigquery.new
195
- # dataset = bigquery.dataset "my_dataset"
196
- # table = dataset.table "my_table"
197
207
  #
198
- # data = table.data
199
- # if data.next?
200
- # next_data = data.next
208
+ # sql = "SELECT word FROM publicdata.samples.shakespeare"
209
+ # job = bigquery.query_job sql
210
+ #
211
+ # job.wait_until_done!
212
+ # data = job.data
213
+ #
214
+ # data.count # 100000
215
+ # data.total # 164656
216
+ # data.each do |row|
217
+ # puts row[:word]
201
218
  # end
219
+ # data = data.next if data.next?
202
220
  #
203
221
  def next?
204
222
  !token.nil?
@@ -213,13 +231,19 @@ module Google
213
231
  # require "google/cloud/bigquery"
214
232
  #
215
233
  # bigquery = Google::Cloud::Bigquery.new
216
- # dataset = bigquery.dataset "my_dataset"
217
- # table = dataset.table "my_table"
218
234
  #
219
- # data = table.data
220
- # if data.next?
221
- # next_data = data.next
235
+ # sql = "SELECT word FROM publicdata.samples.shakespeare"
236
+ # job = bigquery.query_job sql
237
+ #
238
+ # job.wait_until_done!
239
+ # data = job.data
240
+ #
241
+ # data.count # 100000
242
+ # data.total # 164656
243
+ # data.each do |row|
244
+ # puts row[:word]
222
245
  # end
246
+ # data = data.next if data.next?
223
247
  #
224
248
  def next
225
249
  return nil unless next?
@@ -272,6 +296,7 @@ module Google
272
296
  # row[:word]
273
297
  # end
274
298
  #
299
+ #
275
300
  # @example Limit the number of API calls made:
276
301
  # require "google/cloud/bigquery"
277
302
  #
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -668,8 +668,8 @@ module Google
668
668
  end
669
669
 
670
670
  ##
671
- # Queries data using the [asynchronous
672
- # method](https://cloud.google.com/bigquery/querying-data).
671
+ # Queries data by creating a [query
672
+ # job](https://cloud.google.com/bigquery/docs/query-overview#query_jobs).
673
673
  #
674
674
  # Sets the current dataset as the default dataset in the query. Useful
675
675
  # for using unqualified table names.
@@ -908,10 +908,10 @@ module Google
908
908
  end
909
909
 
910
910
  ##
911
- # Queries data using a synchronous method that blocks for a response. In
912
- # this method, a {QueryJob} is created and its results are saved
913
- # to a temporary table, then read from the table. Timeouts and transient
914
- # errors are generally handled as needed to complete the query.
911
+ # Queries data and waits for the results. In this method, a {QueryJob}
912
+ # is created and its results are saved to a temporary table, then read
913
+ # from the table. Timeouts and transient errors are generally handled
914
+ # as needed to complete the query.
915
915
  #
916
916
  # Sets the current dataset as the default dataset in the query. Useful
917
917
  # for using unqualified table names.
@@ -1146,9 +1146,9 @@ module Google
1146
1146
  # Request](https://cloud.google.com/bigquery/loading-data-post-request#multipart).
1147
1147
  #
1148
1148
  # @param [String] table_id The destination table to load the data into.
1149
- # @param [File, Google::Cloud::Storage::File, String] file A file or the
1150
- # URI of a Google Cloud Storage file containing data to load into the
1151
- # table.
1149
+ # @param [File, Google::Cloud::Storage::File, String, URI] file A file
1150
+ # or the URI of a Google Cloud Storage file containing data to load
1151
+ # into the table.
1152
1152
  # @param [String] format The exported file format. The default value is
1153
1153
  # `csv`.
1154
1154
  #
@@ -1378,9 +1378,9 @@ module Google
1378
1378
  # Request](https://cloud.google.com/bigquery/loading-data-post-request#multipart).
1379
1379
  #
1380
1380
  # @param [String] table_id The destination table to load the data into.
1381
- # @param [File, Google::Cloud::Storage::File, String] file A file or the
1382
- # URI of a Google Cloud Storage file containing data to load into the
1383
- # table.
1381
+ # @param [File, Google::Cloud::Storage::File, String, URI] file A file
1382
+ # or the URI of a Google Cloud Storage file containing data to load
1383
+ # into the table.
1384
1384
  # @param [String] format The exported file format. The default value is
1385
1385
  # `csv`.
1386
1386
  #
@@ -1948,6 +1948,7 @@ module Google
1948
1948
  def load_storage table_id, url, options = {}
1949
1949
  # Convert to storage URL
1950
1950
  url = url.to_gs_url if url.respond_to? :to_gs_url
1951
+ url = url.to_s if url.is_a? URI
1951
1952
 
1952
1953
  gapi = service.load_table_gs_url dataset_id, table_id, url, options
1953
1954
  Job.from_gapi gapi, service
@@ -1964,7 +1965,9 @@ module Google
1964
1965
  def storage_url? file
1965
1966
  file.respond_to?(:to_gs_url) ||
1966
1967
  (file.respond_to?(:to_str) &&
1967
- file.to_str.downcase.start_with?("gs://"))
1968
+ file.to_str.downcase.start_with?("gs://")) ||
1969
+ (file.is_a?(URI) &&
1970
+ file.to_s.downcase.start_with?("gs://"))
1968
1971
  end
1969
1972
 
1970
1973
  def local_file? file
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2017 Google Inc. All rights reserved.
1
+ # Copyright 2017 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -95,8 +95,8 @@ module Google
95
95
  end
96
96
 
97
97
  ##
98
- # Queries data using the [asynchronous
99
- # method](https://cloud.google.com/bigquery/querying-data).
98
+ # Queries data by creating a [query
99
+ # job](https://cloud.google.com/bigquery/docs/query-overview#query_jobs).
100
100
  #
101
101
  # When using standard SQL and passing arguments using `params`, Ruby
102
102
  # types are mapped to BigQuery types as follows:
@@ -340,10 +340,10 @@ module Google
340
340
  end
341
341
 
342
342
  ##
343
- # Queries data using a synchronous method that blocks for a response. In
344
- # this method, a {QueryJob} is created and its results are saved
345
- # to a temporary table, then read from the table. Timeouts and transient
346
- # errors are generally handled as needed to complete the query.
343
+ # Queries data and waits for the results. In this method, a {QueryJob}
344
+ # is created and its results are saved to a temporary table, then read
345
+ # from the table. Timeouts and transient errors are generally handled
346
+ # as needed to complete the query.
347
347
  #
348
348
  # When using standard SQL and passing arguments using `params`, Ruby
349
349
  # types are mapped to BigQuery types as follows:
@@ -1,10 +1,10 @@
1
- # Copyright 2016 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -371,7 +371,7 @@ module Google
371
371
  type = type.to_s.upcase
372
372
  unless Field::TYPES.include? type
373
373
  fail ArgumentError,
374
- "Type '#{type}' not found in #{TYPES.inspect}"
374
+ "Type '#{type}' not found"
375
375
  end
376
376
  type
377
377
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2017 Google Inc. All rights reserved.
1
+ # Copyright 2017 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1319,9 +1319,9 @@ module Google
1319
1319
  # file directly. See [Loading Data with a POST Request](
1320
1320
  # https://cloud.google.com/bigquery/loading-data-post-request#multipart).
1321
1321
  #
1322
- # @param [File, Google::Cloud::Storage::File, String] file A file or the
1323
- # URI of a Google Cloud Storage file containing data to load into the
1324
- # table.
1322
+ # @param [File, Google::Cloud::Storage::File, String, URI] file A file
1323
+ # or the URI of a Google Cloud Storage file containing data to load
1324
+ # into the table.
1325
1325
  # @param [String] format The exported file format. The default value is
1326
1326
  # `csv`.
1327
1327
  #
@@ -1495,9 +1495,9 @@ module Google
1495
1495
  # file directly. See [Loading Data with a POST Request](
1496
1496
  # https://cloud.google.com/bigquery/loading-data-post-request#multipart).
1497
1497
  #
1498
- # @param [File, Google::Cloud::Storage::File, String] file A file or the
1499
- # URI of a Google Cloud Storage file containing data to load into the
1500
- # table.
1498
+ # @param [File, Google::Cloud::Storage::File, String, URI] file A file
1499
+ # or the URI of a Google Cloud Storage file containing data to load
1500
+ # into the table.
1501
1501
  # @param [String] format The exported file format. The default value is
1502
1502
  # `csv`.
1503
1503
  #
@@ -1995,6 +1995,7 @@ module Google
1995
1995
  def load_storage url, options = {}
1996
1996
  # Convert to storage URL
1997
1997
  url = url.to_gs_url if url.respond_to? :to_gs_url
1998
+ url = url.to_s if url.is_a? URI
1998
1999
 
1999
2000
  gapi = service.load_table_gs_url dataset_id, table_id, url, options
2000
2001
  Job.from_gapi gapi, service
@@ -2011,7 +2012,9 @@ module Google
2011
2012
  def storage_url? file
2012
2013
  file.respond_to?(:to_gs_url) ||
2013
2014
  (file.respond_to?(:to_str) &&
2014
- file.to_str.downcase.start_with?("gs://"))
2015
+ file.to_str.downcase.start_with?("gs://")) ||
2016
+ (file.is_a?(URI) &&
2017
+ file.to_s.downcase.start_with?("gs://"))
2015
2018
  end
2016
2019
 
2017
2020
  def local_file? file
@@ -1,10 +1,10 @@
1
- # Copyright 2017 Google Inc. All rights reserved.
1
+ # Copyright 2017 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2016 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -1,10 +1,10 @@
1
- # Copyright 2016 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "0.30.0"
19
+ VERSION = "1.0.0"
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: 0.30.0
4
+ version: 1.0.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: 2017-11-14 00:00:00.000000000 Z
12
+ date: 2018-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  version: '0'
251
251
  requirements: []
252
252
  rubyforge_project:
253
- rubygems_version: 2.7.2
253
+ rubygems_version: 2.7.4
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: API Client library for Google BigQuery