google-cloud-bigquery 1.20.0 → 1.23.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: 3d887921d9819a9fae907aa50bb5f7ca805514b7911edeee335d7caa82bcca8a
4
- data.tar.gz: 45abf44f843328b5e9d0f7dad0780735dfb12b5766ded4b12dc35c0a5f949555
3
+ metadata.gz: 89f8e3d756fc514c769c82a9a7db9f342626761d65607b5b837c29a691e27c28
4
+ data.tar.gz: 93f69944889b1a3fd1ddf4a14e42b72c0d4842d905b6b055343928d0fec1a173
5
5
  SHA512:
6
- metadata.gz: 754714cfca94ca584b8900bf5dbe483693594d873f0344051fa71b41dfcacec8a642720d34939db881ba9e9f2cf7ca6baeb4a3a98c67430e046062bcc91d5b06
7
- data.tar.gz: 24b37f4222cd43dee18edef1150db12cdc0d25e686b70ee1429f474b6670a30e5cacb26b809fc484be6cb55e9f9a63ef693d1acb0c44902a20e1cb633b1f2274
6
+ metadata.gz: c72ef2e170c0b2b0c897c0bab8c5e2e1e7694af1e0b1b3f19ce0e40acce6d07993bb39ecb5b90509bdcf8f8f1c66596ef4ea7801532bb25799cdd7b6edfa3bd0
7
+ data.tar.gz: b22e6d9c70f1428d970c8f9fed8076194f4cf58872f56449a214ff46b93561e06d71ebcf8ecd1af18f1899c50c1130454b200870ea40919acda00e6e0ffc5dcb
@@ -1,5 +1,44 @@
1
1
  # Release History
2
2
 
3
+ ### 1.23.0 / 2020-09-17
4
+
5
+ #### Features
6
+
7
+ * quota_project can be set via library configuration ([#7627](https://www.github.com/googleapis/google-cloud-ruby/issues/7627))
8
+
9
+ ### 1.22.0 / 2020-09-10
10
+
11
+ #### Features
12
+
13
+ * Add support for ML model export
14
+ * Add model support to Project#extract and #extract_job
15
+ * Add ExtractJob#model?
16
+ * Add ExtractJob#ml_tf_saved_model?
17
+ * Add ExtractJob#ml_xgboost_booster?
18
+ * Add Model#extract and #extract_job
19
+
20
+ ### 1.21.2 / 2020-07-21
21
+
22
+ #### Documentation
23
+
24
+ * Update Data#each samples
25
+
26
+ ### 1.21.1 / 2020-05-28
27
+
28
+ #### Documentation
29
+
30
+ * Fix a few broken links
31
+
32
+ ### 1.21.0 / 2020-03-31
33
+
34
+ #### Features
35
+
36
+ * Add Job#parent_job_id and Job#script_statistics
37
+ * Add parent_job to Project#jobs
38
+ * Add Job#num_child_jobs
39
+ * Add Job#parent_job_id
40
+ * Add Job#script_statistics
41
+
3
42
  ### 1.20.0 / 2020-03-11
4
43
 
5
44
  #### Features
@@ -24,14 +24,8 @@ improved, *please* create a new issue on GitHub so we can talk about it.
24
24
 
25
25
  - [New issue][gh-ruby]
26
26
 
27
- Or, you can ask questions on the [Google Cloud Platform Slack][slack-ruby]. You
28
- can use the "ruby" channel for general Ruby questions, or use the
29
- "google-cloud-ruby" channel if you have questions about this gem in particular.
30
-
31
27
  [so-ruby]: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby+bigquery
32
28
 
33
- [gh-search-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues?q=label%3A%22api%3A+bigquery%22
34
-
35
- [gh-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues/new
29
+ [gh-search-ruby]: https://github.com/googleapis/google-cloud-ruby/issues?q=label%3A%22api%3A+bigquery%22
36
30
 
37
- [slack-ruby]: https://gcp-slack.appspot.com/
31
+ [gh-ruby]: https://github.com/googleapis/google-cloud-ruby/issues/new
@@ -53,9 +53,15 @@ module Google
53
53
  # bigquery = gcloud.bigquery
54
54
  # dataset = bigquery.dataset "my_dataset"
55
55
  # table = dataset.table "my_table"
56
- # table.data.each do |row|
57
- # puts row
56
+ #
57
+ # data = table.data
58
+ #
59
+ # # Iterate over the first page of results
60
+ # data.each do |row|
61
+ # puts row[:name]
58
62
  # end
63
+ # # Retrieve the next page of results
64
+ # data = data.next if data.next?
59
65
  #
60
66
  # @example The default scope can be overridden with the `scope` option:
61
67
  # require "google/cloud"
@@ -127,6 +133,7 @@ Google::Cloud.configure.add_config! :bigquery do |config|
127
133
  config.add_field! :credentials, default_creds, match: [String, Hash, Google::Auth::Credentials], allow_nil: true
128
134
  config.add_alias! :keyfile, :credentials
129
135
  config.add_field! :scope, nil, match: [String, Array]
136
+ config.add_field! :quota_project, nil, match: String
130
137
  config.add_field! :retries, nil, match: Integer
131
138
  config.add_field! :timeout, nil, match: Integer
132
139
  config.add_field! :endpoint, nil, match: String
@@ -84,7 +84,7 @@ module Google
84
84
  Bigquery::Project.new(
85
85
  Bigquery::Service.new(
86
86
  project_id, credentials,
87
- retries: retries, timeout: timeout, host: endpoint
87
+ retries: retries, timeout: timeout, host: endpoint, quota_project: configure.quota_project
88
88
  )
89
89
  )
90
90
  end
@@ -318,7 +318,9 @@ module Google
318
318
  "parquet" => "PARQUET",
319
319
  "datastore" => "DATASTORE_BACKUP",
320
320
  "backup" => "DATASTORE_BACKUP",
321
- "datastore_backup" => "DATASTORE_BACKUP"
321
+ "datastore_backup" => "DATASTORE_BACKUP",
322
+ "ml_tf_saved_model" => "ML_TF_SAVED_MODEL",
323
+ "ml_xgboost_booster" => "ML_XGBOOST_BOOSTER"
322
324
  }[format.to_s.downcase]
323
325
  return val unless val.nil?
324
326
  format
@@ -272,12 +272,21 @@ module Google
272
272
  # Sets the labels to use for the job.
273
273
  #
274
274
  # @param [Hash] value A hash of user-provided labels associated with
275
- # the job. You can use these to organize and group your jobs. Label
276
- # keys and values can be no longer than 63 characters, can only
277
- # contain lowercase letters, numeric characters, underscores and
278
- # dashes. International characters are allowed. Label values are
279
- # optional. Label keys must start with a letter and each label in
280
- # the list must have a different key.
275
+ # the job. You can use these to organize and group your jobs.
276
+ #
277
+ # The labels applied to a resource must meet the following requirements:
278
+ #
279
+ # * Each resource can have multiple labels, up to a maximum of 64.
280
+ # * Each label must be a key-value pair.
281
+ # * Keys have a minimum length of 1 character and a maximum length of
282
+ # 63 characters, and cannot be empty. Values can be empty, and have
283
+ # a maximum length of 63 characters.
284
+ # * Keys and values can contain only lowercase letters, numeric characters,
285
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
286
+ # international characters are allowed.
287
+ # * The key portion of a label must be unique. However, you can use the
288
+ # same key with multiple resources.
289
+ # * Keys must start with a lowercase letter or international character.
281
290
  #
282
291
  # @!group Attributes
283
292
  def labels= value
@@ -41,9 +41,12 @@ module Google
41
41
  #
42
42
  # data.count # 100000
43
43
  # data.total # 164656
44
+ #
45
+ # # Iterate over the first page of results
44
46
  # data.each do |row|
45
47
  # puts row[:word]
46
48
  # end
49
+ # # Retrieve the next page of results
47
50
  # data = data.next if data.next?
48
51
  #
49
52
  class Data < DelegateClass(::Array)
@@ -117,9 +120,12 @@ module Google
117
120
  #
118
121
  # data.count # 100000
119
122
  # data.total # 164656
123
+ #
124
+ # # Iterate over the first page of results
120
125
  # data.each do |row|
121
126
  # puts row[:word]
122
127
  # end
128
+ # # Retrieve the next page of results
123
129
  # data = data.next if data.next?
124
130
  #
125
131
  def total
@@ -375,9 +381,12 @@ module Google
375
381
  #
376
382
  # data.count # 100000
377
383
  # data.total # 164656
384
+ #
385
+ # # Iterate over the first page of results
378
386
  # data.each do |row|
379
387
  # puts row[:word]
380
388
  # end
389
+ # # Retrieve the next page of results
381
390
  # data = data.next if data.next?
382
391
  #
383
392
  def next?
@@ -402,9 +411,12 @@ module Google
402
411
  #
403
412
  # data.count # 100000
404
413
  # data.total # 164656
414
+ #
415
+ # # Iterate over the first page of results
405
416
  # data.each do |row|
406
417
  # puts row[:word]
407
418
  # end
419
+ # # Retrieve the next page of results
408
420
  # data = data.next if data.next?
409
421
  #
410
422
  def next
@@ -313,12 +313,19 @@ module Google
313
313
  # @param [Hash<String, String>] labels A hash containing key/value
314
314
  # pairs.
315
315
  #
316
- # * Label keys and values can be no longer than 63 characters.
317
- # * Label keys and values can contain only lowercase letters, numbers,
318
- # underscores, hyphens, and international characters.
319
- # * Label keys and values cannot exceed 128 bytes in size.
320
- # * Label keys must begin with a letter.
321
- # * Label keys must be unique within a dataset.
316
+ # The labels applied to a resource must meet the following requirements:
317
+ #
318
+ # * Each resource can have multiple labels, up to a maximum of 64.
319
+ # * Each label must be a key-value pair.
320
+ # * Keys have a minimum length of 1 character and a maximum length of
321
+ # 63 characters, and cannot be empty. Values can be empty, and have
322
+ # a maximum length of 63 characters.
323
+ # * Keys and values can contain only lowercase letters, numeric characters,
324
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
325
+ # international characters are allowed.
326
+ # * The key portion of a label must be unique. However, you can use the
327
+ # same key with multiple resources.
328
+ # * Keys must start with a lowercase letter or international character.
322
329
  #
323
330
  # @example
324
331
  # require "google/cloud/bigquery"
@@ -636,12 +643,20 @@ module Google
636
643
  # SQL](https://cloud.google.com/bigquery/docs/reference/legacy-sql)
637
644
  # dialect. Optional. The default value is false.
638
645
  # @param [Array<String>, String] udfs User-defined function resources
639
- # used in the query. May be either a code resource to load from a
640
- # Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
646
+ # used in a legacy SQL query. May be either a code resource to load from
647
+ # a Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
641
648
  # that contains code for a user-defined function (UDF). Providing an
642
649
  # inline code resource is equivalent to providing a URI for a file
643
- # containing the same code. See [User-Defined
644
- # Functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions).
650
+ # containing the same code.
651
+ #
652
+ # This parameter is used for defining User Defined Function (UDF)
653
+ # resources only when using legacy SQL. Users of standard SQL should
654
+ # leverage either DDL (e.g. `CREATE [TEMPORARY] FUNCTION ...`) or the
655
+ # Routines API to define UDF resources.
656
+ #
657
+ # For additional information on migrating, see: [Migrating to
658
+ # standard SQL - Differences in user-defined JavaScript
659
+ # functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions)
645
660
  #
646
661
  # @return [Google::Cloud::Bigquery::Table] A new table object.
647
662
  #
@@ -1163,20 +1178,36 @@ module Google
1163
1178
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1164
1179
  # be used.
1165
1180
  # @param [Hash] labels A hash of user-provided labels associated with
1166
- # the job. You can use these to organize and group your jobs. Label
1167
- # keys and values can be no longer than 63 characters, can only
1168
- # contain lowercase letters, numeric characters, underscores and
1169
- # dashes. International characters are allowed. Label values are
1170
- # optional. Label keys must start with a letter and each label in the
1171
- # list must have a different key. See [Requirements for
1172
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1181
+ # the job. You can use these to organize and group your jobs.
1182
+ #
1183
+ # The labels applied to a resource must meet the following requirements:
1184
+ #
1185
+ # * Each resource can have multiple labels, up to a maximum of 64.
1186
+ # * Each label must be a key-value pair.
1187
+ # * Keys have a minimum length of 1 character and a maximum length of
1188
+ # 63 characters, and cannot be empty. Values can be empty, and have
1189
+ # a maximum length of 63 characters.
1190
+ # * Keys and values can contain only lowercase letters, numeric characters,
1191
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1192
+ # international characters are allowed.
1193
+ # * The key portion of a label must be unique. However, you can use the
1194
+ # same key with multiple resources.
1195
+ # * Keys must start with a lowercase letter or international character.
1173
1196
  # @param [Array<String>, String] udfs User-defined function resources
1174
- # used in the query. May be either a code resource to load from a
1175
- # Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
1197
+ # used in a legacy SQL query. May be either a code resource to load from
1198
+ # a Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
1176
1199
  # that contains code for a user-defined function (UDF). Providing an
1177
1200
  # inline code resource is equivalent to providing a URI for a file
1178
- # containing the same code. See [User-Defined
1179
- # Functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions).
1201
+ # containing the same code.
1202
+ #
1203
+ # This parameter is used for defining User Defined Function (UDF)
1204
+ # resources only when using legacy SQL. Users of standard SQL should
1205
+ # leverage either DDL (e.g. `CREATE [TEMPORARY] FUNCTION ...`) or the
1206
+ # Routines API to define UDF resources.
1207
+ #
1208
+ # For additional information on migrating, see: [Migrating to
1209
+ # standard SQL - Differences in user-defined JavaScript
1210
+ # functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions)
1180
1211
  # @param [Integer] maximum_billing_tier Deprecated: Change the billing
1181
1212
  # tier to allow high-compute queries.
1182
1213
  # @yield [job] a job configuration object
@@ -1458,9 +1489,12 @@ module Google
1458
1489
  #
1459
1490
  # data = dataset.query "SELECT name FROM my_table"
1460
1491
  #
1492
+ # # Iterate over the first page of results
1461
1493
  # data.each do |row|
1462
1494
  # puts row[:name]
1463
1495
  # end
1496
+ # # Retrieve the next page of results
1497
+ # data = data.next if data.next?
1464
1498
  #
1465
1499
  # @example Query using legacy SQL:
1466
1500
  # require "google/cloud/bigquery"
@@ -1471,9 +1505,12 @@ module Google
1471
1505
  # data = dataset.query "SELECT name FROM my_table",
1472
1506
  # legacy_sql: true
1473
1507
  #
1508
+ # # Iterate over the first page of results
1474
1509
  # data.each do |row|
1475
1510
  # puts row[:name]
1476
1511
  # end
1512
+ # # Retrieve the next page of results
1513
+ # data = data.next if data.next?
1477
1514
  #
1478
1515
  # @example Query using positional query parameters:
1479
1516
  # require "google/cloud/bigquery"
@@ -1484,9 +1521,12 @@ module Google
1484
1521
  # data = dataset.query "SELECT name FROM my_table WHERE id = ?",
1485
1522
  # params: [1]
1486
1523
  #
1524
+ # # Iterate over the first page of results
1487
1525
  # data.each do |row|
1488
1526
  # puts row[:name]
1489
1527
  # end
1528
+ # # Retrieve the next page of results
1529
+ # data = data.next if data.next?
1490
1530
  #
1491
1531
  # @example Query using named query parameters:
1492
1532
  # require "google/cloud/bigquery"
@@ -1497,9 +1537,12 @@ module Google
1497
1537
  # data = dataset.query "SELECT name FROM my_table WHERE id = @id",
1498
1538
  # params: { id: 1 }
1499
1539
  #
1540
+ # # Iterate over the first page of results
1500
1541
  # data.each do |row|
1501
1542
  # puts row[:name]
1502
1543
  # end
1544
+ # # Retrieve the next page of results
1545
+ # data = data.next if data.next?
1503
1546
  #
1504
1547
  # @example Query using named query parameters with types:
1505
1548
  # require "google/cloud/bigquery"
@@ -1512,9 +1555,12 @@ module Google
1512
1555
  # params: { ids: [] },
1513
1556
  # types: { ids: [:INT64] }
1514
1557
  #
1558
+ # # Iterate over the first page of results
1515
1559
  # data.each do |row|
1516
1560
  # puts row[:name]
1517
1561
  # end
1562
+ # # Retrieve the next page of results
1563
+ # data = data.next if data.next?
1518
1564
  #
1519
1565
  # @example Execute a DDL statement:
1520
1566
  # require "google/cloud/bigquery"
@@ -1553,9 +1599,12 @@ module Google
1553
1599
  # query.table = dataset.table "my_table", skip_lookup: true
1554
1600
  # end
1555
1601
  #
1602
+ # # Iterate over the first page of results
1556
1603
  # data.each do |row|
1557
1604
  # puts row[:name]
1558
1605
  # end
1606
+ # # Retrieve the next page of results
1607
+ # data = data.next if data.next?
1559
1608
  #
1560
1609
  # @!group Data
1561
1610
  #
@@ -1758,13 +1807,21 @@ module Google
1758
1807
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1759
1808
  # be used.
1760
1809
  # @param [Hash] labels A hash of user-provided labels associated with
1761
- # the job. You can use these to organize and group your jobs. Label
1762
- # keys and values can be no longer than 63 characters, can only
1763
- # contain lowercase letters, numeric characters, underscores and
1764
- # dashes. International characters are allowed. Label values are
1765
- # optional. Label keys must start with a letter and each label in the
1766
- # list must have a different key. See [Requirements for
1767
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1810
+ # the job. You can use these to organize and group your jobs.
1811
+ #
1812
+ # The labels applied to a resource must meet the following requirements:
1813
+ #
1814
+ # * Each resource can have multiple labels, up to a maximum of 64.
1815
+ # * Each label must be a key-value pair.
1816
+ # * Keys have a minimum length of 1 character and a maximum length of
1817
+ # 63 characters, and cannot be empty. Values can be empty, and have
1818
+ # a maximum length of 63 characters.
1819
+ # * Keys and values can contain only lowercase letters, numeric characters,
1820
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1821
+ # international characters are allowed.
1822
+ # * The key portion of a label must be unique. However, you can use the
1823
+ # same key with multiple resources.
1824
+ # * Keys must start with a lowercase letter or international character.
1768
1825
  # @yield [updater] A block for setting the schema and other
1769
1826
  # options for the destination table. The schema can be omitted if the
1770
1827
  # destination table already exists, or if you're loading data from a
@@ -45,9 +45,12 @@ module Google
45
45
  # data = bigquery.query "SELECT * FROM my_ext_table",
46
46
  # external: { my_ext_table: csv_table }
47
47
  #
48
+ # # Iterate over the first page of results
48
49
  # data.each do |row|
49
50
  # puts row[:name]
50
51
  # end
52
+ # # Retrieve the next page of results
53
+ # data = data.next if data.next?
51
54
  #
52
55
  module External
53
56
  ##
@@ -138,9 +141,12 @@ module Google
138
141
  # data = bigquery.query "SELECT * FROM my_ext_table",
139
142
  # external: { my_ext_table: avro_table }
140
143
  #
144
+ # # Iterate over the first page of results
141
145
  # data.each do |row|
142
146
  # puts row[:name]
143
147
  # end
148
+ # # Retrieve the next page of results
149
+ # data = data.next if data.next?
144
150
  #
145
151
  class DataSource
146
152
  ##
@@ -575,9 +581,12 @@ module Google
575
581
  # data = bigquery.query "SELECT * FROM my_ext_table",
576
582
  # external: { my_ext_table: csv_table }
577
583
  #
584
+ # # Iterate over the first page of results
578
585
  # data.each do |row|
579
586
  # puts row[:name]
580
587
  # end
588
+ # # Retrieve the next page of results
589
+ # data = data.next if data.next?
581
590
  #
582
591
  class CsvSource < External::DataSource
583
592
  ##
@@ -1037,9 +1046,12 @@ module Google
1037
1046
  # data = bigquery.query "SELECT * FROM my_ext_table",
1038
1047
  # external: { my_ext_table: json_table }
1039
1048
  #
1049
+ # # Iterate over the first page of results
1040
1050
  # data.each do |row|
1041
1051
  # puts row[:name]
1042
1052
  # end
1053
+ # # Retrieve the next page of results
1054
+ # data = data.next if data.next?
1043
1055
  #
1044
1056
  class JsonSource < External::DataSource
1045
1057
  ##
@@ -1173,9 +1185,12 @@ module Google
1173
1185
  # data = bigquery.query "SELECT * FROM my_ext_table",
1174
1186
  # external: { my_ext_table: sheets_table }
1175
1187
  #
1188
+ # # Iterate over the first page of results
1176
1189
  # data.each do |row|
1177
1190
  # puts row[:name]
1178
1191
  # end
1192
+ # # Retrieve the next page of results
1193
+ # data = data.next if data.next?
1179
1194
  #
1180
1195
  class SheetsSource < External::DataSource
1181
1196
  ##
@@ -1318,9 +1333,12 @@ module Google
1318
1333
  # data = bigquery.query "SELECT * FROM my_ext_table",
1319
1334
  # external: { my_ext_table: bigtable_table }
1320
1335
  #
1336
+ # # Iterate over the first page of results
1321
1337
  # data.each do |row|
1322
1338
  # puts row[:name]
1323
1339
  # end
1340
+ # # Retrieve the next page of results
1341
+ # data = data.next if data.next?
1324
1342
  #
1325
1343
  class BigtableSource < External::DataSource
1326
1344
  ##
@@ -1516,9 +1534,12 @@ module Google
1516
1534
  # data = bigquery.query "SELECT * FROM my_ext_table",
1517
1535
  # external: { my_ext_table: bigtable_table }
1518
1536
  #
1537
+ # # Iterate over the first page of results
1519
1538
  # data.each do |row|
1520
1539
  # puts row[:name]
1521
1540
  # end
1541
+ # # Retrieve the next page of results
1542
+ # data = data.next if data.next?
1522
1543
  #
1523
1544
  class ColumnFamily
1524
1545
  ##
@@ -2053,9 +2074,12 @@ module Google
2053
2074
  # data = bigquery.query "SELECT * FROM my_ext_table",
2054
2075
  # external: { my_ext_table: bigtable_table }
2055
2076
  #
2077
+ # # Iterate over the first page of results
2056
2078
  # data.each do |row|
2057
2079
  # puts row[:name]
2058
2080
  # end
2081
+ # # Retrieve the next page of results
2082
+ # data = data.next if data.next?
2059
2083
  #
2060
2084
  class Column
2061
2085
  ##