google-cloud-bigquery 1.32.0 → 1.35.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 +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +63 -0
- data/lib/google/cloud/bigquery/convert.rb +3 -0
- data/lib/google/cloud/bigquery/data.rb +33 -0
- data/lib/google/cloud/bigquery/dataset.rb +13 -6
- data/lib/google/cloud/bigquery/job.rb +9 -0
- data/lib/google/cloud/bigquery/load_job.rb +136 -22
- data/lib/google/cloud/bigquery/project.rb +12 -6
- data/lib/google/cloud/bigquery/query_job.rb +44 -6
- data/lib/google/cloud/bigquery/schema.rb +149 -28
- data/lib/google/cloud/bigquery/schema/field.rb +307 -42
- data/lib/google/cloud/bigquery/service.rb +1 -1
- data/lib/google/cloud/bigquery/table.rb +134 -22
- data/lib/google/cloud/bigquery/table/async_inserter.rb +1 -0
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 403979ca0fcee3fa41911b46cd53f9f5c4f030f85610c29870fc770f41de7d03
|
|
4
|
+
data.tar.gz: 15060d2d7351dc8e922adf77483c48ee4be7acf98bffdcb824f699920db65d7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bdcdd87c1fb4dcafdb8a071fe21322fc45c3ac94a3a89617d2a576f15733e371833ee47027056081af955e7366a817aaab3eead234d1ed2098678e6ca5e225e
|
|
7
|
+
data.tar.gz: c46e7b144f15072b10fe16bff3ccffdc54f43801a59f6760666c3cc2c2d8b8230262163de8dadb0f705271d7b27700abe1703f39fd26cd9b97d3fdd442379e61
|
data/AUTHENTICATION.md
CHANGED
|
@@ -77,7 +77,8 @@ bigquery = Google::Cloud::Bigquery.new
|
|
|
77
77
|
|
|
78
78
|
### Configuration
|
|
79
79
|
|
|
80
|
-
The **Project ID** and **Credentials JSON** can be configured
|
|
80
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
|
81
|
+
instead of placing them in environment variables or providing them as arguments.
|
|
81
82
|
|
|
82
83
|
```ruby
|
|
83
84
|
require "google/cloud/bigquery"
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### 1.35.0 / 2021-08-12
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* Add GEOGRAPHY schema helpers
|
|
8
|
+
* Add LoadJob#geography
|
|
9
|
+
* Add Schema::Field#geography
|
|
10
|
+
* Add Table::Updater#geography
|
|
11
|
+
* Add support for GEOGRAPHY type
|
|
12
|
+
* Add Schema#geography
|
|
13
|
+
* Add support for multistatement transaction statistics in jobs
|
|
14
|
+
* Add Job#transaction_id
|
|
15
|
+
|
|
16
|
+
### 1.34.0 / 2021-07-20
|
|
17
|
+
|
|
18
|
+
#### Features
|
|
19
|
+
|
|
20
|
+
* Add DmlStatistics
|
|
21
|
+
* Add QueryJob#deleted_row_count
|
|
22
|
+
* Add QueryJob#inserted_row_count
|
|
23
|
+
* Add QueryJob#updated_row_count
|
|
24
|
+
* Add Data#deleted_row_count
|
|
25
|
+
* Add Data#inserted_row_count
|
|
26
|
+
* Add Data#updated_row_count
|
|
27
|
+
|
|
28
|
+
### 1.33.0 / 2021-07-14
|
|
29
|
+
|
|
30
|
+
#### Features
|
|
31
|
+
|
|
32
|
+
* Add policy tag support (Column ACLs)
|
|
33
|
+
* Add policy_tags to LoadJob field helper methods
|
|
34
|
+
* Add policy_tags to Schema field helper methods
|
|
35
|
+
* Add policy_tags to Schema::Field field helper methods
|
|
36
|
+
* Add policy_tags to Table field helper methods
|
|
37
|
+
* Add Schema::Field#policy_tags
|
|
38
|
+
* Add Schema::Field#policy_tags=
|
|
39
|
+
* Add support for parameterized types
|
|
40
|
+
* Add max_length to LoadJob::Updater#bytes
|
|
41
|
+
* Add max_length to LoadJob::Updater#string
|
|
42
|
+
* Add max_length to Schema#bytes
|
|
43
|
+
* Add max_length to Schema#string
|
|
44
|
+
* Add max_length to Schema::Field#bytes
|
|
45
|
+
* Add max_length to Schema::Field#string
|
|
46
|
+
* Add max_length to Table::Updater#bytes
|
|
47
|
+
* Add max_length to Table::Updater#string
|
|
48
|
+
* Add precision and scale to LoadJob::Updater#bignumeric
|
|
49
|
+
* Add precision and scale to LoadJob::Updater#numeric
|
|
50
|
+
* Add precision and scale to Schema#bignumeric
|
|
51
|
+
* Add precision and scale to Schema#numeric
|
|
52
|
+
* Add precision and scale to Schema::Field#bignumeric
|
|
53
|
+
* Add precision and scale to Schema::Field#numeric
|
|
54
|
+
* Add precision and scale to Table::Updater#bignumeric
|
|
55
|
+
* Add precision and scale to Table::Updater#numeric
|
|
56
|
+
* Add Schema::Field#max_length
|
|
57
|
+
* Add Schema::Field#precision
|
|
58
|
+
* Add Schema::Field#scale
|
|
59
|
+
|
|
60
|
+
### 1.32.1 / 2021-07-08
|
|
61
|
+
|
|
62
|
+
#### Documentation
|
|
63
|
+
|
|
64
|
+
* Update AUTHENTICATION.md in handwritten packages
|
|
65
|
+
|
|
3
66
|
### 1.32.0 / 2021-06-21
|
|
4
67
|
|
|
5
68
|
#### Features
|
|
@@ -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
|
#
|
|
@@ -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
|
-
#
|
|
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` |
|
|
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`
|
|
@@ -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
|
-
#
|
|
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` |
|
|
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`
|
|
@@ -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 | |
|
|
@@ -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
|
#
|
|
@@ -751,6 +751,12 @@ module Google
|
|
|
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
|
##
|
|
@@ -779,6 +785,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -807,6 +817,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -846,6 +860,20 @@ module Google
|
|
|
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,
|
|
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
|
##
|
|
@@ -885,6 +918,20 @@ module Google
|
|
|
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,
|
|
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
|
##
|
|
@@ -913,6 +965,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -941,6 +997,12 @@ module Google
|
|
|
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
|
##
|
|
@@ -969,6 +1031,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -997,6 +1063,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -1025,6 +1095,10 @@ module Google
|
|
|
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
|
##
|
|
@@ -1053,6 +1127,10 @@ module Google
|
|
|
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-z, A-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
|
##
|