google-cloud-bigquery 1.21.0 → 1.24.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.
@@ -528,8 +528,9 @@ module Google
528
528
  # The period for which the destination table will be partitioned, if
529
529
  # any. See [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
530
530
  #
531
- # @return [String, nil] The partition type. Currently the only supported
532
- # value is "DAY", or `nil` if not present.
531
+ # @return [String, nil] The partition type. The supported types are `DAY`,
532
+ # `HOUR`, `MONTH`, and `YEAR`, which will generate one partition per day,
533
+ # hour, month, and year, respectively; or `nil` if not present.
533
534
  #
534
535
  # @!group Attributes
535
536
  #
@@ -675,9 +676,12 @@ module Google
675
676
  #
676
677
  # job.wait_until_done!
677
678
  # data = job.data
679
+ #
680
+ # # Iterate over the first page of results
678
681
  # data.each do |row|
679
682
  # puts row[:word]
680
683
  # end
684
+ # # Retrieve the next page of results
681
685
  # data = data.next if data.next?
682
686
  #
683
687
  def data token: nil, max: nil, start: nil
@@ -1028,12 +1032,21 @@ module Google
1028
1032
  # Sets the labels to use for the job.
1029
1033
  #
1030
1034
  # @param [Hash] value A hash of user-provided labels associated with
1031
- # the job. You can use these to organize and group your jobs. Label
1032
- # keys and values can be no longer than 63 characters, can only
1033
- # contain lowercase letters, numeric characters, underscores and
1034
- # dashes. International characters are allowed. Label values are
1035
- # optional. Label keys must start with a letter and each label in
1036
- # the list must have a different key.
1035
+ # the job. You can use these to organize and group your jobs.
1036
+ #
1037
+ # The labels applied to a resource must meet the following requirements:
1038
+ #
1039
+ # * Each resource can have multiple labels, up to a maximum of 64.
1040
+ # * Each label must be a key-value pair.
1041
+ # * Keys have a minimum length of 1 character and a maximum length of
1042
+ # 63 characters, and cannot be empty. Values can be empty, and have
1043
+ # a maximum length of 63 characters.
1044
+ # * Keys and values can contain only lowercase letters, numeric characters,
1045
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1046
+ # international characters are allowed.
1047
+ # * The key portion of a label must be unique. However, you can use the
1048
+ # same key with multiple resources.
1049
+ # * Keys must start with a lowercase letter or international character.
1037
1050
  #
1038
1051
  # @!group Attributes
1039
1052
  #
@@ -1290,13 +1303,16 @@ module Google
1290
1303
  ##
1291
1304
  # Sets the partitioning for the destination table. See [Partitioned
1292
1305
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
1306
+ # The supported types are `DAY`, `HOUR`, `MONTH`, and `YEAR`, which will
1307
+ # generate one partition per day, hour, month, and year, respectively.
1293
1308
  #
1294
1309
  # You can only set the partitioning field while creating a table.
1295
1310
  # BigQuery does not allow you to change partitioning on an existing
1296
1311
  # table.
1297
1312
  #
1298
- # @param [String] type The partition type. Currently the only
1299
- # supported value is "DAY".
1313
+ # @param [String] type The partition type. The supported types are `DAY`,
1314
+ # `HOUR`, `MONTH`, and `YEAR`, which will generate one partition per day,
1315
+ # hour, month, and year, respectively.
1300
1316
  #
1301
1317
  # @example
1302
1318
  # require "google/cloud/bigquery"
@@ -43,12 +43,13 @@ module Google
43
43
 
44
44
  ##
45
45
  # Creates a new Service instance.
46
- def initialize project, credentials, retries: nil, timeout: nil, host: nil
46
+ def initialize project, credentials, retries: nil, timeout: nil, host: nil, quota_project: nil
47
47
  @project = project
48
48
  @credentials = credentials
49
49
  @retries = retries
50
50
  @timeout = timeout
51
51
  @host = host
52
+ @quota_project = quota_project
52
53
  end
53
54
 
54
55
  def service
@@ -64,6 +65,9 @@ module Google
64
65
  service.request_options.header ||= {}
65
66
  service.request_options.header["x-goog-api-client"] = \
66
67
  "gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Bigquery::VERSION}"
68
+ service.request_options.query ||= {}
69
+ service.request_options.query["prettyPrint"] = false
70
+ service.request_options.quota_project = @quota_project if @quota_project
67
71
  service.authorization = @credentials.client
68
72
  service.root_url = host if host
69
73
  service
@@ -138,6 +142,8 @@ module Google
138
142
  end
139
143
  end
140
144
 
145
+ ##
146
+ # Gets the specified table resource by full table reference.
141
147
  def get_project_table project_id, dataset_id, table_id
142
148
  # The get operation is considered idempotent
143
149
  execute backoff: true do
@@ -151,10 +157,7 @@ module Google
151
157
  # it only returns the table resource,
152
158
  # which describes the structure of this table.
153
159
  def get_table dataset_id, table_id
154
- # The get operation is considered idempotent
155
- execute backoff: true do
156
- get_project_table @project, dataset_id, table_id
157
- end
160
+ get_project_table @project, dataset_id, table_id
158
161
  end
159
162
 
160
163
  ##
@@ -250,18 +253,21 @@ module Google
250
253
  end
251
254
  end
252
255
 
253
- # Gets the specified model resource by model ID.
254
- # This method does not return the data in the model,
255
- # it only returns the model resource,
256
- # which describes the structure of this model.
257
- def get_model dataset_id, model_id
256
+ # Gets the specified model resource by full model reference.
257
+ def get_project_model project_id, dataset_id, model_id
258
258
  # The get operation is considered idempotent
259
259
  execute backoff: true do
260
- json_txt = service.get_model @project, dataset_id, model_id, options: { skip_deserialization: true }
260
+ json_txt = service.get_model project_id, dataset_id, model_id, options: { skip_deserialization: true }
261
261
  JSON.parse json_txt, symbolize_names: true
262
262
  end
263
263
  end
264
264
 
265
+ # Gets the specified model resource by model ID. This method does not return the data in the model, it only
266
+ # returns the model resource, which describes the structure of this model.
267
+ def get_model dataset_id, model_id
268
+ get_project_model @project, dataset_id, model_id
269
+ end
270
+
265
271
  ##
266
272
  # Updates information in an existing model, replacing fields that
267
273
  # are provided in the submitted model resource.
@@ -250,9 +250,10 @@ module Google
250
250
  # The period for which the table is time partitioned, if any. See
251
251
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
252
252
  #
253
- # @return [String, nil] The time partition type. Currently the only supported
254
- # value is "DAY", or `nil` if the object is a reference (see
255
- # {#reference?}).
253
+ # @return [String, nil] The time partition type. The supported types are `DAY`,
254
+ # `HOUR`, `MONTH`, and `YEAR`, which will generate one partition per day,
255
+ # hour, month, and year, respectively; or `nil` if not set or the object is a
256
+ # reference (see {#reference?}).
256
257
  #
257
258
  # @!group Attributes
258
259
  #
@@ -265,13 +266,16 @@ module Google
265
266
  ##
266
267
  # Sets the time partitioning type for the table. See [Partitioned
267
268
  # Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
269
+ # The supported types are `DAY`, `HOUR`, `MONTH`, and `YEAR`, which will
270
+ # generate one partition per day, hour, month, and year, respectively.
268
271
  #
269
272
  # You can only set time partitioning when creating a table as in
270
273
  # the example below. BigQuery does not allow you to change time partitioning
271
274
  # on an existing table.
272
275
  #
273
- # @param [String] type The time partition type. Currently the only
274
- # supported value is "DAY".
276
+ # @param [String] type The time partition type. The supported types are `DAY`,
277
+ # `HOUR`, `MONTH`, and `YEAR`, which will generate one partition per day,
278
+ # hour, month, and year, respectively.
275
279
  #
276
280
  # @example
277
281
  # require "google/cloud/bigquery"
@@ -820,12 +824,19 @@ module Google
820
824
  # @param [Hash<String, String>] labels A hash containing key/value
821
825
  # pairs.
822
826
  #
823
- # * Label keys and values can be no longer than 63 characters.
824
- # * Label keys and values can contain only lowercase letters, numbers,
825
- # underscores, hyphens, and international characters.
826
- # * Label keys and values cannot exceed 128 bytes in size.
827
- # * Label keys must begin with a letter.
828
- # * Label keys must be unique within a table.
827
+ # The labels applied to a resource must meet the following requirements:
828
+ #
829
+ # * Each resource can have multiple labels, up to a maximum of 64.
830
+ # * Each label must be a key-value pair.
831
+ # * Keys have a minimum length of 1 character and a maximum length of
832
+ # 63 characters, and cannot be empty. Values can be empty, and have
833
+ # a maximum length of 63 characters.
834
+ # * Keys and values can contain only lowercase letters, numeric characters,
835
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
836
+ # international characters are allowed.
837
+ # * The key portion of a label must be unique. However, you can use the
838
+ # same key with multiple resources.
839
+ # * Keys must start with a lowercase letter or international character.
829
840
  #
830
841
  # @example
831
842
  # require "google/cloud/bigquery"
@@ -1181,12 +1192,20 @@ module Google
1181
1192
  # SQL](https://cloud.google.com/bigquery/docs/reference/legacy-sql)
1182
1193
  # dialect. Optional. The default value is false.
1183
1194
  # @param [Array<String>, String] udfs User-defined function resources
1184
- # used in the query. May be either a code resource to load from a
1185
- # Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
1195
+ # used in a legacy SQL query. May be either a code resource to load from
1196
+ # a Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
1186
1197
  # that contains code for a user-defined function (UDF). Providing an
1187
1198
  # inline code resource is equivalent to providing a URI for a file
1188
- # containing the same code. See [User-Defined
1189
- # Functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions).
1199
+ # containing the same code.
1200
+ #
1201
+ # This parameter is used for defining User Defined Function (UDF)
1202
+ # resources only when using legacy SQL. Users of standard SQL should
1203
+ # leverage either DDL (e.g. `CREATE [TEMPORARY] FUNCTION ...`) or the
1204
+ # Routines API to define UDF resources.
1205
+ #
1206
+ # For additional information on migrating, see: [Migrating to
1207
+ # standard SQL - Differences in user-defined JavaScript
1208
+ # functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions)
1190
1209
  #
1191
1210
  # @example
1192
1211
  # require "google/cloud/bigquery"
@@ -1278,12 +1297,13 @@ module Google
1278
1297
  # table = dataset.table "my_table"
1279
1298
  #
1280
1299
  # data = table.data
1300
+ #
1301
+ # # Iterate over the first page of results
1281
1302
  # data.each do |row|
1282
- # puts row[:first_name]
1283
- # end
1284
- # if data.next?
1285
- # more_data = data.next if data.next?
1303
+ # puts row[:name]
1286
1304
  # end
1305
+ # # Retrieve the next page of results
1306
+ # data = data.next if data.next?
1287
1307
  #
1288
1308
  # @example Retrieve all rows of data: (See {Data#all})
1289
1309
  # require "google/cloud/bigquery"
@@ -1293,8 +1313,9 @@ module Google
1293
1313
  # table = dataset.table "my_table"
1294
1314
  #
1295
1315
  # data = table.data
1316
+ #
1296
1317
  # data.all do |row|
1297
- # puts row[:first_name]
1318
+ # puts row[:name]
1298
1319
  # end
1299
1320
  #
1300
1321
  # @!group Data
@@ -1360,13 +1381,21 @@ module Google
1360
1381
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1361
1382
  # be used.
1362
1383
  # @param [Hash] labels A hash of user-provided labels associated with
1363
- # the job. You can use these to organize and group your jobs. Label
1364
- # keys and values can be no longer than 63 characters, can only
1365
- # contain lowercase letters, numeric characters, underscores and
1366
- # dashes. International characters are allowed. Label values are
1367
- # optional. Label keys must start with a letter and each label in the
1368
- # list must have a different key. See [Requirements for
1369
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1384
+ # the job. You can use these to organize and group your jobs.
1385
+ #
1386
+ # The labels applied to a resource must meet the following requirements:
1387
+ #
1388
+ # * Each resource can have multiple labels, up to a maximum of 64.
1389
+ # * Each label must be a key-value pair.
1390
+ # * Keys have a minimum length of 1 character and a maximum length of
1391
+ # 63 characters, and cannot be empty. Values can be empty, and have
1392
+ # a maximum length of 63 characters.
1393
+ # * Keys and values can contain only lowercase letters, numeric characters,
1394
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1395
+ # international characters are allowed.
1396
+ # * The key portion of a label must be unique. However, you can use the
1397
+ # same key with multiple resources.
1398
+ # * Keys must start with a lowercase letter or international character.
1370
1399
  # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1371
1400
  # is undefined however for non-query jobs and may result in an error.
1372
1401
  # Deprecated.
@@ -1501,11 +1530,11 @@ module Google
1501
1530
  # The geographic location for the job ("US", "EU", etc.) can be set via
1502
1531
  # {ExtractJob::Updater#location=} in a block passed to this method. If
1503
1532
  # the table is a full resource representation (see {#resource_full?}),
1504
- # the location of the job will be automatically set to the location of
1533
+ # the location of the job will automatically be set to the location of
1505
1534
  # the table.
1506
1535
  #
1507
- # @see https://cloud.google.com/bigquery/exporting-data-from-bigquery
1508
- # Exporting Data From BigQuery
1536
+ # @see https://cloud.google.com/bigquery/docs/exporting-data
1537
+ # Exporting table data
1509
1538
  #
1510
1539
  # @param [Google::Cloud::Storage::File, String, Array<String>]
1511
1540
  # extract_url The Google Storage file or file URI pattern(s) to which
@@ -1541,13 +1570,21 @@ module Google
1541
1570
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1542
1571
  # be used.
1543
1572
  # @param [Hash] labels A hash of user-provided labels associated with
1544
- # the job. You can use these to organize and group your jobs. Label
1545
- # keys and values can be no longer than 63 characters, can only
1546
- # contain lowercase letters, numeric characters, underscores and
1547
- # dashes. International characters are allowed. Label values are
1548
- # optional. Label keys must start with a letter and each label in the
1549
- # list must have a different key. See [Requirements for
1550
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1573
+ # the job. You can use these to organize and group your jobs.
1574
+ #
1575
+ # The labels applied to a resource must meet the following requirements:
1576
+ #
1577
+ # * Each resource can have multiple labels, up to a maximum of 64.
1578
+ # * Each label must be a key-value pair.
1579
+ # * Keys have a minimum length of 1 character and a maximum length of
1580
+ # 63 characters, and cannot be empty. Values can be empty, and have
1581
+ # a maximum length of 63 characters.
1582
+ # * Keys and values can contain only lowercase letters, numeric characters,
1583
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1584
+ # international characters are allowed.
1585
+ # * The key portion of a label must be unique. However, you can use the
1586
+ # same key with multiple resources.
1587
+ # * Keys must start with a lowercase letter or international character.
1551
1588
  # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1552
1589
  # is undefined however for non-query jobs and may result in an error.
1553
1590
  # Deprecated.
@@ -1599,8 +1636,8 @@ module Google
1599
1636
  # the location of the job will be automatically set to the location of
1600
1637
  # the table.
1601
1638
  #
1602
- # @see https://cloud.google.com/bigquery/exporting-data-from-bigquery
1603
- # Exporting Data From BigQuery
1639
+ # @see https://cloud.google.com/bigquery/docs/exporting-data
1640
+ # Exporting table data
1604
1641
  #
1605
1642
  # @param [Google::Cloud::Storage::File, String, Array<String>]
1606
1643
  # extract_url The Google Storage file or file URI pattern(s) to which
@@ -1781,13 +1818,21 @@ module Google
1781
1818
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1782
1819
  # be used.
1783
1820
  # @param [Hash] labels A hash of user-provided labels associated with
1784
- # the job. You can use these to organize and group your jobs. Label
1785
- # keys and values can be no longer than 63 characters, can only
1786
- # contain lowercase letters, numeric characters, underscores and
1787
- # dashes. International characters are allowed. Label values are
1788
- # optional. Label keys must start with a letter and each label in the
1789
- # list must have a different key. See [Requirements for
1790
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1821
+ # the job. You can use these to organize and group your jobs.
1822
+ #
1823
+ # The labels applied to a resource must meet the following requirements:
1824
+ #
1825
+ # * Each resource can have multiple labels, up to a maximum of 64.
1826
+ # * Each label must be a key-value pair.
1827
+ # * Keys have a minimum length of 1 character and a maximum length of
1828
+ # 63 characters, and cannot be empty. Values can be empty, and have
1829
+ # a maximum length of 63 characters.
1830
+ # * Keys and values can contain only lowercase letters, numeric characters,
1831
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1832
+ # international characters are allowed.
1833
+ # * The key portion of a label must be unique. However, you can use the
1834
+ # same key with multiple resources.
1835
+ # * Keys must start with a lowercase letter or international character.
1791
1836
  # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1792
1837
  # is undefined however for non-query jobs and may result in an error.
1793
1838
  # Deprecated.
@@ -34,9 +34,12 @@ module Google
34
34
  # "WHERE time_of_date = @time",
35
35
  # params: { time: fourpm }
36
36
  #
37
+ # # Iterate over the first page of results
37
38
  # data.each do |row|
38
39
  # puts row[:name]
39
40
  # end
41
+ # # Retrieve the next page of results
42
+ # data = data.next if data.next?
40
43
  #
41
44
  # @example Create Time with fractional seconds:
42
45
  # require "google/cloud/bigquery"
@@ -49,9 +52,12 @@ module Google
49
52
  # "WHERE time_of_date >= @time",
50
53
  # params: { time: precise_time }
51
54
  #
55
+ # # Iterate over the first page of results
52
56
  # data.each do |row|
53
57
  # puts row[:name]
54
58
  # end
59
+ # # Retrieve the next page of results
60
+ # data = data.next if data.next?
55
61
  #
56
62
  Time = Struct.new :value
57
63
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.21.0".freeze
19
+ VERSION = "1.24.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.21.0
4
+ version: 1.24.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: 2020-03-31 00:00:00.000000000 Z
12
+ date: 2020-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.33'
34
+ version: '0.47'
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.33'
41
+ version: '0.47'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: google-cloud-core
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '5.10'
118
+ version: '5.14'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '5.10'
125
+ version: '5.14'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: minitest-autotest
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  - !ruby/object:Gem::Version
291
291
  version: '0'
292
292
  requirements: []
293
- rubygems_version: 3.0.6
293
+ rubygems_version: 3.1.4
294
294
  signing_key:
295
295
  specification_version: 4
296
296
  summary: API Client library for Google BigQuery