google-cloud-bigquery 1.32.1 → 1.35.1

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: 1189f91eb3d437aa9fa866f22bf19acaa4f5c1e1f6fec69e73ababe8d1297bdc
4
- data.tar.gz: 8d448952cc259e89076d6edf501c5b9ea3caf6b20b21fae9bcfe8056016549e0
3
+ metadata.gz: e3c59034942c2cde710a16645bac56870987a7357de18e76fa628abc60074faf
4
+ data.tar.gz: b146e3c8b3df4c664e4d6db5180e9fdf9d2e0ff1ee6c2e658d60605e7e055493
5
5
  SHA512:
6
- metadata.gz: 3f734ba5d4a6e7323ba88dd11c5ead491401e538b08c87fd91bc95ad069e61ab952cd8b3e8e6da0fa436f9ce9ff8338e81e274cfd97defe21a8981796049e6ba
7
- data.tar.gz: ef0a1fba42f761d313d71eaaca71ddfbae322d18f5a747cc24a596a0a804625568cac87434390dc8f5ff208001487e33c824c1015d654ee0967d5bebcefa34d6
6
+ metadata.gz: bbbbc86abb3b12976b9ec66ef8f3e634c8928c1992bb65ef34a7e6b8e68defa5ba992377bd5868f4686d8d9cd49b691c540218fc521cb4e89d5a880d9b58f2e3
7
+ data.tar.gz: debe4ae33e83ef00f1fca7542f6eefde5f3420b28bf3ff5b9f12fb68c3effa475bfdd4a6bcae723b2fb1535cc2e194406d943913bf560e3a7d358b6453747b55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Release History
2
2
 
3
+ ### 1.35.1 / 2021-09-14
4
+
5
+ #### Documentation
6
+
7
+ * Wrap character class regex in backticks
8
+
9
+ ### 1.35.0 / 2021-08-12
10
+
11
+ #### Features
12
+
13
+ * Add GEOGRAPHY schema helpers
14
+ * Add LoadJob#geography
15
+ * Add Schema::Field#geography
16
+ * Add Table::Updater#geography
17
+ * Add support for GEOGRAPHY type
18
+ * Add Schema#geography
19
+ * Add support for multistatement transaction statistics in jobs
20
+ * Add Job#transaction_id
21
+
22
+ ### 1.34.0 / 2021-07-20
23
+
24
+ #### Features
25
+
26
+ * Add DmlStatistics
27
+ * Add QueryJob#deleted_row_count
28
+ * Add QueryJob#inserted_row_count
29
+ * Add QueryJob#updated_row_count
30
+ * Add Data#deleted_row_count
31
+ * Add Data#inserted_row_count
32
+ * Add Data#updated_row_count
33
+
34
+ ### 1.33.0 / 2021-07-14
35
+
36
+ #### Features
37
+
38
+ * Add policy tag support (Column ACLs)
39
+ * Add policy_tags to LoadJob field helper methods
40
+ * Add policy_tags to Schema field helper methods
41
+ * Add policy_tags to Schema::Field field helper methods
42
+ * Add policy_tags to Table field helper methods
43
+ * Add Schema::Field#policy_tags
44
+ * Add Schema::Field#policy_tags=
45
+ * Add support for parameterized types
46
+ * Add max_length to LoadJob::Updater#bytes
47
+ * Add max_length to LoadJob::Updater#string
48
+ * Add max_length to Schema#bytes
49
+ * Add max_length to Schema#string
50
+ * Add max_length to Schema::Field#bytes
51
+ * Add max_length to Schema::Field#string
52
+ * Add max_length to Table::Updater#bytes
53
+ * Add max_length to Table::Updater#string
54
+ * Add precision and scale to LoadJob::Updater#bignumeric
55
+ * Add precision and scale to LoadJob::Updater#numeric
56
+ * Add precision and scale to Schema#bignumeric
57
+ * Add precision and scale to Schema#numeric
58
+ * Add precision and scale to Schema::Field#bignumeric
59
+ * Add precision and scale to Schema::Field#numeric
60
+ * Add precision and scale to Table::Updater#bignumeric
61
+ * Add precision and scale to Table::Updater#numeric
62
+ * Add Schema::Field#max_length
63
+ * Add Schema::Field#precision
64
+ * Add Schema::Field#scale
65
+
3
66
  ### 1.32.1 / 2021-07-08
4
67
 
5
68
  #### Documentation
@@ -38,6 +38,7 @@ module Google
38
38
  # | `STRING` | `String` | |
39
39
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
40
40
  # | `DATE` | `Date` | |
41
+ # | `GEOGRAPHY` | `String` | |
41
42
  # | `TIMESTAMP` | `Time` | |
42
43
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
43
44
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -102,6 +103,8 @@ module Google
102
103
  ::Time.parse("#{value[:v]} UTC").to_datetime
103
104
  elsif field.type == "DATE"
104
105
  Date.parse value[:v]
106
+ elsif field.type == "GEOGRAPHY"
107
+ String value[:v]
105
108
  else
106
109
  value[:v]
107
110
  end
@@ -363,6 +363,39 @@ module Google
363
363
  job_gapi&.statistics&.query&.num_dml_affected_rows
364
364
  end
365
365
 
366
+ ##
367
+ # The number of deleted rows. Present only for DML statements `DELETE`,
368
+ # `MERGE` and `TRUNCATE`. (See {#statement_type}.)
369
+ #
370
+ # @return [Integer, nil] The number of deleted rows, or `nil` if not
371
+ # applicable.
372
+ #
373
+ def deleted_row_count
374
+ job_gapi&.statistics&.query&.dml_stats&.deleted_row_count
375
+ end
376
+
377
+ ##
378
+ # The number of inserted rows. Present only for DML statements `INSERT`
379
+ # and `MERGE`. (See {#statement_type}.)
380
+ #
381
+ # @return [Integer, nil] The number of inserted rows, or `nil` if not
382
+ # applicable.
383
+ #
384
+ def inserted_row_count
385
+ job_gapi&.statistics&.query&.dml_stats&.inserted_row_count
386
+ end
387
+
388
+ ##
389
+ # The number of updated rows. Present only for DML statements `UPDATE`
390
+ # and `MERGE`. (See {#statement_type}.)
391
+ #
392
+ # @return [Integer, nil] The number of updated rows, or `nil` if not
393
+ # applicable.
394
+ #
395
+ def updated_row_count
396
+ job_gapi&.statistics&.query&.dml_stats&.updated_row_count
397
+ end
398
+
366
399
  ##
367
400
  # Whether there is a next page of data.
368
401
  #
@@ -69,8 +69,8 @@ module Google
69
69
  ##
70
70
  # A unique ID for this dataset, without the project name.
71
71
  #
72
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
73
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
72
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
73
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
74
74
  #
75
75
  # @!group Attributes
76
76
  #
@@ -501,7 +501,7 @@ module Google
501
501
  # you can pass the table's schema as a hash (see example.)
502
502
  #
503
503
  # @param [String] table_id The ID of the table. The ID must contain only
504
- # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
504
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`). The maximum
505
505
  # length is 1,024 characters.
506
506
  # @param [String] name A descriptive name for the table.
507
507
  # @param [String] description A user-friendly description of the table.
@@ -630,7 +630,7 @@ module Google
630
630
  # @see https://cloud.google.com/bigquery/docs/views Creating views
631
631
  #
632
632
  # @param [String] table_id The ID of the view table. The ID must contain
633
- # only letters (a-z, A-Z), numbers (0-9), or underscores (_). The
633
+ # only letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`). The
634
634
  # maximum length is 1,024 characters.
635
635
  # @param [String] query The query that BigQuery executes when the view
636
636
  # is referenced.
@@ -726,8 +726,8 @@ module Google
726
726
  #
727
727
  # @see https://cloud.google.com/bigquery/docs/materialized-views-intro Introduction to materialized views
728
728
  #
729
- # @param [String] table_id The ID of the materialized view table. The ID must contain only letters (a-z, A-Z),
730
- # numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
729
+ # @param [String] table_id The ID of the materialized view table. The ID must contain only letters (`[A-Za-z]`),
730
+ # numbers (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
731
731
  # @param [String] query The query that BigQuery executes when the materialized view is referenced.
732
732
  # @param [String] name A descriptive name for the table.
733
733
  # @param [String] description A user-friendly description of the table.
@@ -954,7 +954,7 @@ module Google
954
954
  # {Routine::Updater#description=}.
955
955
  #
956
956
  # @param [String] routine_id The ID of the routine. The ID must contain only
957
- # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length
957
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`). The maximum length
958
958
  # is 256 characters.
959
959
  # @yield [routine] A block for setting properties on the routine.
960
960
  # @yieldparam [Google::Cloud::Bigquery::Routine::Updater] routine An updater to set additional properties on the
@@ -1138,7 +1138,7 @@ module Google
1138
1138
  # use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql` to
1139
1139
  # true.
1140
1140
  #
1141
- # Ruby types are mapped to BigQuery types as follows:
1141
+ # BigQuery types are converted from Ruby types as follows:
1142
1142
  #
1143
1143
  # | BigQuery | Ruby | Notes |
1144
1144
  # |--------------|--------------------------------------|----------------------------------------------------|
@@ -1146,10 +1146,11 @@ module Google
1146
1146
  # | `INT64` | `Integer` | |
1147
1147
  # | `FLOAT64` | `Float` | |
1148
1148
  # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
1149
- # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
1149
+ # | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`, below.|
1150
1150
  # | `STRING` | `String` | |
1151
1151
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
1152
1152
  # | `DATE` | `Date` | |
1153
+ # | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`, below.|
1153
1154
  # | `TIMESTAMP` | `Time` | |
1154
1155
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
1155
1156
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -1157,7 +1158,8 @@ module Google
1157
1158
  # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
1158
1159
  #
1159
1160
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
1160
- # of each BigQuery data type, including allowed values.
1161
+ # of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
1162
+ # GIS data](https://cloud.google.com/bigquery/docs/gis-data).
1161
1163
  # @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
1162
1164
  # possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
1163
1165
  # specify the SQL type for these values.
@@ -1174,6 +1176,7 @@ module Google
1174
1176
  # * `:STRING`
1175
1177
  # * `:DATETIME`
1176
1178
  # * `:DATE`
1179
+ # * `:GEOGRAPHY`
1177
1180
  # * `:TIMESTAMP`
1178
1181
  # * `:TIME`
1179
1182
  # * `:BYTES`
@@ -1246,8 +1249,8 @@ module Google
1246
1249
  # (without incurring a charge). Optional. If unspecified, this will be
1247
1250
  # set to your project default.
1248
1251
  # @param [String] job_id A user-defined ID for the query job. The ID
1249
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
1250
- # (_), or dashes (-). The maximum length is 1,024 characters. If
1252
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
1253
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
1251
1254
  # `job_id` is provided, then `prefix` will not be used.
1252
1255
  #
1253
1256
  # See [Generating a job
@@ -1256,8 +1259,8 @@ module Google
1256
1259
  # prepended to a generated value to produce a unique job ID. For
1257
1260
  # example, the prefix `daily_import_job_` can be given to generate a
1258
1261
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
1259
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
1260
- # underscores (_), or dashes (-). The maximum length of the entire ID
1262
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
1263
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
1261
1264
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1262
1265
  # be used.
1263
1266
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -1481,7 +1484,7 @@ module Google
1481
1484
  # use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql` to
1482
1485
  # true.
1483
1486
  #
1484
- # Ruby types are mapped to BigQuery types as follows:
1487
+ # BigQuery types are converted from Ruby types as follows:
1485
1488
  #
1486
1489
  # | BigQuery | Ruby | Notes |
1487
1490
  # |--------------|--------------------------------------|----------------------------------------------------|
@@ -1489,10 +1492,11 @@ module Google
1489
1492
  # | `INT64` | `Integer` | |
1490
1493
  # | `FLOAT64` | `Float` | |
1491
1494
  # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
1492
- # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
1495
+ # | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`, below.|
1493
1496
  # | `STRING` | `String` | |
1494
1497
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
1495
1498
  # | `DATE` | `Date` | |
1499
+ # | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`, below.|
1496
1500
  # | `TIMESTAMP` | `Time` | |
1497
1501
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
1498
1502
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -1500,7 +1504,8 @@ module Google
1500
1504
  # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
1501
1505
  #
1502
1506
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
1503
- # of each BigQuery data type, including allowed values.
1507
+ # of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
1508
+ # GIS data](https://cloud.google.com/bigquery/docs/gis-data).
1504
1509
  # @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
1505
1510
  # possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
1506
1511
  # specify the SQL type for these values.
@@ -1517,6 +1522,7 @@ module Google
1517
1522
  # * `:STRING`
1518
1523
  # * `:DATETIME`
1519
1524
  # * `:DATE`
1525
+ # * `:GEOGRAPHY`
1520
1526
  # * `:TIMESTAMP`
1521
1527
  # * `:TIME`
1522
1528
  # * `:BYTES`
@@ -1877,8 +1883,8 @@ module Google
1877
1883
  # this option. Also note that for most use cases, the block yielded by
1878
1884
  # this method is a more convenient way to configure the schema.
1879
1885
  # @param [String] job_id A user-defined ID for the load job. The ID
1880
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
1881
- # (_), or dashes (-). The maximum length is 1,024 characters. If
1886
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
1887
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
1882
1888
  # `job_id` is provided, then `prefix` will not be used.
1883
1889
  #
1884
1890
  # See [Generating a job
@@ -1887,8 +1893,8 @@ module Google
1887
1893
  # prepended to a generated value to produce a unique job ID. For
1888
1894
  # example, the prefix `daily_import_job_` can be given to generate a
1889
1895
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
1890
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
1891
- # underscores (_), or dashes (-). The maximum length of the entire ID
1896
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
1897
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
1892
1898
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1893
1899
  # be used.
1894
1900
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -2421,6 +2427,7 @@ module Google
2421
2427
  # | `BIGNUMERIC` | `String` | Pass as `String` to avoid rounding to scale 9. |
2422
2428
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
2423
2429
  # | `DATE` | `Date` | |
2430
+ # | `GEOGRAPHY` | `String` | |
2424
2431
  # | `TIMESTAMP` | `Time` | |
2425
2432
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
2426
2433
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -74,8 +74,8 @@ module Google
74
74
  ##
75
75
  # The ID of the job.
76
76
  #
77
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
78
- # (0-9), underscores (_), or dashes (-). The maximum length is 1,024
77
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
78
+ # (`[0-9]`), underscores (`_`), or dashes (`-`). The maximum length is 1,024
79
79
  # characters.
80
80
  #
81
81
  def job_id
@@ -226,6 +226,15 @@ module Google
226
226
  Array(@gapi.statistics.reservation_usage).map { |g| ReservationUsage.from_gapi g }
227
227
  end
228
228
 
229
+ ##
230
+ # The ID of a multi-statement transaction.
231
+ #
232
+ # @return [String, nil] The transaction ID, or `nil` if not associated with a transaction.
233
+ #
234
+ def transaction_id
235
+ @gapi.statistics.transaction_info&.transaction_id
236
+ end
237
+
229
238
  ##
230
239
  # The statistics including stack frames for a child job of a script.
231
240
  #
@@ -744,13 +744,19 @@ module Google
744
744
  # See {Schema#string}.
745
745
  #
746
746
  # @param [String] name The field name. The name must contain only
747
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
747
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
748
748
  # start with a letter or underscore. The maximum length is 128
749
749
  # characters.
750
750
  # @param [String] description A description of the field.
751
751
  # @param [Symbol] mode The field's mode. The possible values are
752
752
  # `:nullable`, `:required`, and `:repeated`. The default value is
753
753
  # `:nullable`.
754
+ # @param [Array<String>, String] policy_tags The policy tag list or
755
+ # single policy tag for the field. Policy tag identifiers are of
756
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
757
+ # At most 1 policy tag is currently allowed.
758
+ # @param [Integer] max_length The maximum UTF-8 length of strings
759
+ # allowed in the field.
754
760
  #
755
761
  # @example
756
762
  # require "google/cloud/bigquery"
@@ -762,8 +768,8 @@ module Google
762
768
  # end
763
769
  #
764
770
  # @!group Schema
765
- def string name, description: nil, mode: :nullable
766
- schema.string name, description: description, mode: mode
771
+ def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
772
+ schema.string name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length
767
773
  end
768
774
 
769
775
  ##
@@ -772,13 +778,17 @@ module Google
772
778
  # See {Schema#integer}.
773
779
  #
774
780
  # @param [String] name The field name. The name must contain only
775
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
781
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
776
782
  # start with a letter or underscore. The maximum length is 128
777
783
  # characters.
778
784
  # @param [String] description A description of the field.
779
785
  # @param [Symbol] mode The field's mode. The possible values are
780
786
  # `:nullable`, `:required`, and `:repeated`. The default value is
781
787
  # `:nullable`.
788
+ # @param [Array<String>, String] policy_tags The policy tag list or
789
+ # single policy tag for the field. Policy tag identifiers are of
790
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
791
+ # At most 1 policy tag is currently allowed.
782
792
  #
783
793
  # @example
784
794
  # require "google/cloud/bigquery"
@@ -790,8 +800,8 @@ module Google
790
800
  # end
791
801
  #
792
802
  # @!group Schema
793
- def integer name, description: nil, mode: :nullable
794
- schema.integer name, description: description, mode: mode
803
+ def integer name, description: nil, mode: :nullable, policy_tags: nil
804
+ schema.integer name, description: description, mode: mode, policy_tags: policy_tags
795
805
  end
796
806
 
797
807
  ##
@@ -800,13 +810,17 @@ module Google
800
810
  # See {Schema#float}.
801
811
  #
802
812
  # @param [String] name The field name. The name must contain only
803
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
813
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
804
814
  # start with a letter or underscore. The maximum length is 128
805
815
  # characters.
806
816
  # @param [String] description A description of the field.
807
817
  # @param [Symbol] mode The field's mode. The possible values are
808
818
  # `:nullable`, `:required`, and `:repeated`. The default value is
809
819
  # `:nullable`.
820
+ # @param [Array<String>, String] policy_tags The policy tag list or
821
+ # single policy tag for the field. Policy tag identifiers are of
822
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
823
+ # At most 1 policy tag is currently allowed.
810
824
  #
811
825
  # @example
812
826
  # require "google/cloud/bigquery"
@@ -818,8 +832,8 @@ module Google
818
832
  # end
819
833
  #
820
834
  # @!group Schema
821
- def float name, description: nil, mode: :nullable
822
- schema.float name, description: description, mode: mode
835
+ def float name, description: nil, mode: :nullable, policy_tags: nil
836
+ schema.float name, description: description, mode: mode, policy_tags: policy_tags
823
837
  end
824
838
 
825
839
  ##
@@ -839,13 +853,27 @@ module Google
839
853
  # See {Schema#numeric}
840
854
  #
841
855
  # @param [String] name The field name. The name must contain only
842
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
856
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
843
857
  # start with a letter or underscore. The maximum length is 128
844
858
  # characters.
845
859
  # @param [String] description A description of the field.
846
860
  # @param [Symbol] mode The field's mode. The possible values are
847
861
  # `:nullable`, `:required`, and `:repeated`. The default value is
848
862
  # `:nullable`.
863
+ # @param [Array<String>, String] policy_tags The policy tag list or
864
+ # single policy tag for the field. Policy tag identifiers are of
865
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
866
+ # At most 1 policy tag is currently allowed.
867
+ # @param [Integer] precision The precision (maximum number of total
868
+ # digits) for the field. Acceptable values for precision must be:
869
+ # `1 ≤ (precision - scale) ≤ 29`. Values for scale must be:
870
+ # `0 ≤ scale ≤ 9`. If the scale value is set, the precision value
871
+ # must be set as well.
872
+ # @param [Integer] scale The scale (maximum number of digits in the
873
+ # fractional part) for the field. Acceptable values for precision
874
+ # must be: `1 ≤ (precision - scale) ≤ 29`. Values for scale must
875
+ # be: `0 ≤ scale ≤ 9`. If the scale value is set, the precision
876
+ # value must be set as well.
849
877
  #
850
878
  # @example
851
879
  # require "google/cloud/bigquery"
@@ -857,8 +885,13 @@ module Google
857
885
  # end
858
886
  #
859
887
  # @!group Schema
860
- def numeric name, description: nil, mode: :nullable
861
- schema.numeric name, description: description, mode: mode
888
+ def numeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
889
+ schema.numeric name,
890
+ description: description,
891
+ mode: mode,
892
+ policy_tags: policy_tags,
893
+ precision: precision,
894
+ scale: scale
862
895
  end
863
896
 
864
897
  ##
@@ -878,13 +911,27 @@ module Google
878
911
  # See {Schema#bignumeric}
879
912
  #
880
913
  # @param [String] name The field name. The name must contain only
881
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
914
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
882
915
  # start with a letter or underscore. The maximum length is 128
883
916
  # characters.
884
917
  # @param [String] description A description of the field.
885
918
  # @param [Symbol] mode The field's mode. The possible values are
886
919
  # `:nullable`, `:required`, and `:repeated`. The default value is
887
920
  # `:nullable`.
921
+ # @param [Array<String>, String] policy_tags The policy tag list or
922
+ # single policy tag for the field. Policy tag identifiers are of
923
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
924
+ # At most 1 policy tag is currently allowed.
925
+ # @param [Integer] precision The precision (maximum number of total
926
+ # digits) for the field. Acceptable values for precision must be:
927
+ # `1 ≤ (precision - scale) ≤ 38`. Values for scale must be:
928
+ # `0 ≤ scale ≤ 38`. If the scale value is set, the precision value
929
+ # must be set as well.
930
+ # @param [Integer] scale The scale (maximum number of digits in the
931
+ # fractional part) for the field. Acceptable values for precision
932
+ # must be: `1 ≤ (precision - scale) ≤ 38`. Values for scale must
933
+ # be: `0 ≤ scale ≤ 38`. If the scale value is set, the precision
934
+ # value must be set as well.
888
935
  #
889
936
  # @example
890
937
  # require "google/cloud/bigquery"
@@ -896,8 +943,13 @@ module Google
896
943
  # end
897
944
  #
898
945
  # @!group Schema
899
- def bignumeric name, description: nil, mode: :nullable
900
- schema.bignumeric name, description: description, mode: mode
946
+ def bignumeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
947
+ schema.bignumeric name,
948
+ description: description,
949
+ mode: mode,
950
+ policy_tags: policy_tags,
951
+ precision: precision,
952
+ scale: scale
901
953
  end
902
954
 
903
955
  ##
@@ -906,13 +958,17 @@ module Google
906
958
  # See {Schema#boolean}.
907
959
  #
908
960
  # @param [String] name The field name. The name must contain only
909
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
961
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
910
962
  # start with a letter or underscore. The maximum length is 128
911
963
  # characters.
912
964
  # @param [String] description A description of the field.
913
965
  # @param [Symbol] mode The field's mode. The possible values are
914
966
  # `:nullable`, `:required`, and `:repeated`. The default value is
915
967
  # `:nullable`.
968
+ # @param [Array<String>, String] policy_tags The policy tag list or
969
+ # single policy tag for the field. Policy tag identifiers are of
970
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
971
+ # At most 1 policy tag is currently allowed.
916
972
  #
917
973
  # @example
918
974
  # require "google/cloud/bigquery"
@@ -924,8 +980,8 @@ module Google
924
980
  # end
925
981
  #
926
982
  # @!group Schema
927
- def boolean name, description: nil, mode: :nullable
928
- schema.boolean name, description: description, mode: mode
983
+ def boolean name, description: nil, mode: :nullable, policy_tags: nil
984
+ schema.boolean name, description: description, mode: mode, policy_tags: policy_tags
929
985
  end
930
986
 
931
987
  ##
@@ -934,13 +990,19 @@ module Google
934
990
  # See {Schema#bytes}.
935
991
  #
936
992
  # @param [String] name The field name. The name must contain only
937
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
993
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
938
994
  # start with a letter or underscore. The maximum length is 128
939
995
  # characters.
940
996
  # @param [String] description A description of the field.
941
997
  # @param [Symbol] mode The field's mode. The possible values are
942
998
  # `:nullable`, `:required`, and `:repeated`. The default value is
943
999
  # `:nullable`.
1000
+ # @param [Array<String>, String] policy_tags The policy tag list or
1001
+ # single policy tag for the field. Policy tag identifiers are of
1002
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1003
+ # At most 1 policy tag is currently allowed.
1004
+ # @param [Integer] max_length The maximum the maximum number of
1005
+ # bytes in the field.
944
1006
  #
945
1007
  # @example
946
1008
  # require "google/cloud/bigquery"
@@ -952,8 +1014,8 @@ module Google
952
1014
  # end
953
1015
  #
954
1016
  # @!group Schema
955
- def bytes name, description: nil, mode: :nullable
956
- schema.bytes name, description: description, mode: mode
1017
+ def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
1018
+ schema.bytes name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length
957
1019
  end
958
1020
 
959
1021
  ##
@@ -962,13 +1024,17 @@ module Google
962
1024
  # See {Schema#timestamp}.
963
1025
  #
964
1026
  # @param [String] name The field name. The name must contain only
965
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
1027
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
966
1028
  # start with a letter or underscore. The maximum length is 128
967
1029
  # characters.
968
1030
  # @param [String] description A description of the field.
969
1031
  # @param [Symbol] mode The field's mode. The possible values are
970
1032
  # `:nullable`, `:required`, and `:repeated`. The default value is
971
1033
  # `:nullable`.
1034
+ # @param [Array<String>, String] policy_tags The policy tag list or
1035
+ # single policy tag for the field. Policy tag identifiers are of
1036
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1037
+ # At most 1 policy tag is currently allowed.
972
1038
  #
973
1039
  # @example
974
1040
  # require "google/cloud/bigquery"
@@ -980,8 +1046,8 @@ module Google
980
1046
  # end
981
1047
  #
982
1048
  # @!group Schema
983
- def timestamp name, description: nil, mode: :nullable
984
- schema.timestamp name, description: description, mode: mode
1049
+ def timestamp name, description: nil, mode: :nullable, policy_tags: nil
1050
+ schema.timestamp name, description: description, mode: mode, policy_tags: policy_tags
985
1051
  end
986
1052
 
987
1053
  ##
@@ -990,13 +1056,17 @@ module Google
990
1056
  # See {Schema#time}.
991
1057
  #
992
1058
  # @param [String] name The field name. The name must contain only
993
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
1059
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
994
1060
  # start with a letter or underscore. The maximum length is 128
995
1061
  # characters.
996
1062
  # @param [String] description A description of the field.
997
1063
  # @param [Symbol] mode The field's mode. The possible values are
998
1064
  # `:nullable`, `:required`, and `:repeated`. The default value is
999
1065
  # `:nullable`.
1066
+ # @param [Array<String>, String] policy_tags The policy tag list or
1067
+ # single policy tag for the field. Policy tag identifiers are of
1068
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1069
+ # At most 1 policy tag is currently allowed.
1000
1070
  #
1001
1071
  # @example
1002
1072
  # require "google/cloud/bigquery"
@@ -1008,8 +1078,8 @@ module Google
1008
1078
  # end
1009
1079
  #
1010
1080
  # @!group Schema
1011
- def time name, description: nil, mode: :nullable
1012
- schema.time name, description: description, mode: mode
1081
+ def time name, description: nil, mode: :nullable, policy_tags: nil
1082
+ schema.time name, description: description, mode: mode, policy_tags: policy_tags
1013
1083
  end
1014
1084
 
1015
1085
  ##
@@ -1018,13 +1088,17 @@ module Google
1018
1088
  # See {Schema#datetime}.
1019
1089
  #
1020
1090
  # @param [String] name The field name. The name must contain only
1021
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
1091
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
1022
1092
  # start with a letter or underscore. The maximum length is 128
1023
1093
  # characters.
1024
1094
  # @param [String] description A description of the field.
1025
1095
  # @param [Symbol] mode The field's mode. The possible values are
1026
1096
  # `:nullable`, `:required`, and `:repeated`. The default value is
1027
1097
  # `:nullable`.
1098
+ # @param [Array<String>, String] policy_tags The policy tag list or
1099
+ # single policy tag for the field. Policy tag identifiers are of
1100
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1101
+ # At most 1 policy tag is currently allowed.
1028
1102
  #
1029
1103
  # @example
1030
1104
  # require "google/cloud/bigquery"
@@ -1036,8 +1110,8 @@ module Google
1036
1110
  # end
1037
1111
  #
1038
1112
  # @!group Schema
1039
- def datetime name, description: nil, mode: :nullable
1040
- schema.datetime name, description: description, mode: mode
1113
+ def datetime name, description: nil, mode: :nullable, policy_tags: nil
1114
+ schema.datetime name, description: description, mode: mode, policy_tags: policy_tags
1041
1115
  end
1042
1116
 
1043
1117
  ##
@@ -1046,13 +1120,17 @@ module Google
1046
1120
  # See {Schema#date}.
1047
1121
  #
1048
1122
  # @param [String] name The field name. The name must contain only
1049
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
1123
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
1050
1124
  # start with a letter or underscore. The maximum length is 128
1051
1125
  # characters.
1052
1126
  # @param [String] description A description of the field.
1053
1127
  # @param [Symbol] mode The field's mode. The possible values are
1054
1128
  # `:nullable`, `:required`, and `:repeated`. The default value is
1055
1129
  # `:nullable`.
1130
+ # @param [Array<String>, String] policy_tags The policy tag list or
1131
+ # single policy tag for the field. Policy tag identifiers are of
1132
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1133
+ # At most 1 policy tag is currently allowed.
1056
1134
  #
1057
1135
  # @example
1058
1136
  # require "google/cloud/bigquery"
@@ -1064,8 +1142,44 @@ module Google
1064
1142
  # end
1065
1143
  #
1066
1144
  # @!group Schema
1067
- def date name, description: nil, mode: :nullable
1068
- schema.date name, description: description, mode: mode
1145
+ def date name, description: nil, mode: :nullable, policy_tags: nil
1146
+ schema.date name, description: description, mode: mode, policy_tags: policy_tags
1147
+ end
1148
+
1149
+ ##
1150
+ # Adds a geography field to the schema.
1151
+ #
1152
+ # See {Schema#geography}.
1153
+ #
1154
+ # @see https://cloud.google.com/bigquery/docs/gis-data Working with BigQuery GIS data
1155
+ #
1156
+ # @param [String] name The field name. The name must contain only
1157
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
1158
+ # start with a letter or underscore. The maximum length is 128
1159
+ # characters.
1160
+ # @param [String] description A description of the field.
1161
+ # @param [Symbol] mode The field's mode. The possible values are
1162
+ # `:nullable`, `:required`, and `:repeated`. The default value is
1163
+ # `:nullable`.
1164
+ # @param [Array<String>, String] policy_tags The policy tag list or
1165
+ # single policy tag for the field. Policy tag identifiers are of
1166
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
1167
+ # At most 1 policy tag is currently allowed.
1168
+ #
1169
+ # @example
1170
+ # require "google/cloud/bigquery"
1171
+ #
1172
+ # bigquery = Google::Cloud::Bigquery.new
1173
+ # dataset = bigquery.dataset "my_dataset"
1174
+ # job = dataset.load_job "my_table", "gs://abc/file" do |schema|
1175
+ # schema.record "cities_lived", mode: :repeated do |cities_lived|
1176
+ # cities_lived.geography "location", mode: :required
1177
+ # cities_lived.integer "number_of_years", mode: :required
1178
+ # end
1179
+ # end
1180
+ #
1181
+ def geography name, description: nil, mode: :nullable, policy_tags: nil
1182
+ schema.geography name, description: description, mode: mode, policy_tags: policy_tags
1069
1183
  end
1070
1184
 
1071
1185
  ##
@@ -1078,7 +1192,7 @@ module Google
1078
1192
  # See {Schema#record}.
1079
1193
  #
1080
1194
  # @param [String] name The field name. The name must contain only
1081
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
1195
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
1082
1196
  # start with a letter or underscore. The maximum length is 128
1083
1197
  # characters.
1084
1198
  # @param [String] description A description of the field.