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
|
@@ -291,7 +291,7 @@ module Google
|
|
|
291
291
|
# use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql` to
|
|
292
292
|
# true.
|
|
293
293
|
#
|
|
294
|
-
#
|
|
294
|
+
# BigQuery types are converted from Ruby types as follows:
|
|
295
295
|
#
|
|
296
296
|
# | BigQuery | Ruby | Notes |
|
|
297
297
|
# |--------------|--------------------------------------|----------------------------------------------------|
|
|
@@ -299,10 +299,11 @@ module Google
|
|
|
299
299
|
# | `INT64` | `Integer` | |
|
|
300
300
|
# | `FLOAT64` | `Float` | |
|
|
301
301
|
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
|
302
|
-
# | `BIGNUMERIC` |
|
|
302
|
+
# | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`, below.|
|
|
303
303
|
# | `STRING` | `String` | |
|
|
304
304
|
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
|
305
305
|
# | `DATE` | `Date` | |
|
|
306
|
+
# | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`, below.|
|
|
306
307
|
# | `TIMESTAMP` | `Time` | |
|
|
307
308
|
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
|
308
309
|
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
|
@@ -310,7 +311,8 @@ module Google
|
|
|
310
311
|
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
|
311
312
|
#
|
|
312
313
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
|
313
|
-
# of each BigQuery data type, including allowed values.
|
|
314
|
+
# of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
|
|
315
|
+
# GIS data](https://cloud.google.com/bigquery/docs/gis-data).
|
|
314
316
|
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
|
315
317
|
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
|
316
318
|
# specify the SQL type for these values.
|
|
@@ -327,6 +329,7 @@ module Google
|
|
|
327
329
|
# * `:STRING`
|
|
328
330
|
# * `:DATETIME`
|
|
329
331
|
# * `:DATE`
|
|
332
|
+
# * `:GEOGRAPHY`
|
|
330
333
|
# * `:TIMESTAMP`
|
|
331
334
|
# * `:TIME`
|
|
332
335
|
# * `:BYTES`
|
|
@@ -638,7 +641,7 @@ module Google
|
|
|
638
641
|
# use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql` to
|
|
639
642
|
# true.
|
|
640
643
|
#
|
|
641
|
-
#
|
|
644
|
+
# BigQuery types are converted from Ruby types as follows:
|
|
642
645
|
#
|
|
643
646
|
# | BigQuery | Ruby | Notes |
|
|
644
647
|
# |--------------|--------------------------------------|----------------------------------------------------|
|
|
@@ -646,10 +649,11 @@ module Google
|
|
|
646
649
|
# | `INT64` | `Integer` | |
|
|
647
650
|
# | `FLOAT64` | `Float` | |
|
|
648
651
|
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
|
649
|
-
# | `BIGNUMERIC` |
|
|
652
|
+
# | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`, below.|
|
|
650
653
|
# | `STRING` | `String` | |
|
|
651
654
|
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
|
652
655
|
# | `DATE` | `Date` | |
|
|
656
|
+
# | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`, below.|
|
|
653
657
|
# | `TIMESTAMP` | `Time` | |
|
|
654
658
|
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
|
655
659
|
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
|
@@ -657,7 +661,8 @@ module Google
|
|
|
657
661
|
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
|
658
662
|
#
|
|
659
663
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
|
660
|
-
# of each BigQuery data type, including allowed values.
|
|
664
|
+
# of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
|
|
665
|
+
# GIS data](https://cloud.google.com/bigquery/docs/gis-data).
|
|
661
666
|
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
|
662
667
|
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
|
663
668
|
# specify the SQL type for these values.
|
|
@@ -674,6 +679,7 @@ module Google
|
|
|
674
679
|
# * `:STRING`
|
|
675
680
|
# * `:DATETIME`
|
|
676
681
|
# * `:DATE`
|
|
682
|
+
# * `:GEOGRAPHY`
|
|
677
683
|
# * `:TIMESTAMP`
|
|
678
684
|
# * `:TIME`
|
|
679
685
|
# * `:BYTES`
|
|
@@ -386,6 +386,39 @@ module Google
|
|
|
386
386
|
@gapi.statistics.query.num_dml_affected_rows
|
|
387
387
|
end
|
|
388
388
|
|
|
389
|
+
##
|
|
390
|
+
# The number of deleted rows. Present only for DML statements `DELETE`,
|
|
391
|
+
# `MERGE` and `TRUNCATE`. (See {#statement_type}.)
|
|
392
|
+
#
|
|
393
|
+
# @return [Integer, nil] The number of deleted rows, or `nil` if not
|
|
394
|
+
# applicable.
|
|
395
|
+
#
|
|
396
|
+
def deleted_row_count
|
|
397
|
+
@gapi.statistics.query&.dml_stats&.deleted_row_count
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
##
|
|
401
|
+
# The number of inserted rows. Present only for DML statements `INSERT`
|
|
402
|
+
# and `MERGE`. (See {#statement_type}.)
|
|
403
|
+
#
|
|
404
|
+
# @return [Integer, nil] The number of inserted rows, or `nil` if not
|
|
405
|
+
# applicable.
|
|
406
|
+
#
|
|
407
|
+
def inserted_row_count
|
|
408
|
+
@gapi.statistics.query&.dml_stats&.inserted_row_count
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
##
|
|
412
|
+
# The number of updated rows. Present only for DML statements `UPDATE`
|
|
413
|
+
# and `MERGE`. (See {#statement_type}.)
|
|
414
|
+
#
|
|
415
|
+
# @return [Integer, nil] The number of updated rows, or `nil` if not
|
|
416
|
+
# applicable.
|
|
417
|
+
#
|
|
418
|
+
def updated_row_count
|
|
419
|
+
@gapi.statistics.query&.dml_stats&.updated_row_count
|
|
420
|
+
end
|
|
421
|
+
|
|
389
422
|
##
|
|
390
423
|
# The table in which the query results are stored.
|
|
391
424
|
#
|
|
@@ -858,7 +891,7 @@ module Google
|
|
|
858
891
|
# use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql`
|
|
859
892
|
# to true.
|
|
860
893
|
#
|
|
861
|
-
#
|
|
894
|
+
# BigQuery types are converted from Ruby types as follows:
|
|
862
895
|
#
|
|
863
896
|
# | BigQuery | Ruby | Notes |
|
|
864
897
|
# |--------------|--------------------------------------|--------------------------------------------------|
|
|
@@ -866,10 +899,11 @@ module Google
|
|
|
866
899
|
# | `INT64` | `Integer` | |
|
|
867
900
|
# | `FLOAT64` | `Float` | |
|
|
868
901
|
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
|
869
|
-
# | `BIGNUMERIC` |
|
|
902
|
+
# | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`. |
|
|
870
903
|
# | `STRING` | `String` | |
|
|
871
904
|
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
|
872
905
|
# | `DATE` | `Date` | |
|
|
906
|
+
# | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`. |
|
|
873
907
|
# | `TIMESTAMP` | `Time` | |
|
|
874
908
|
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
|
875
909
|
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
|
@@ -877,7 +911,8 @@ module Google
|
|
|
877
911
|
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
|
878
912
|
#
|
|
879
913
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
|
880
|
-
# of each BigQuery data type, including allowed values.
|
|
914
|
+
# of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
|
|
915
|
+
# GIS data](https://cloud.google.com/bigquery/docs/gis-data).
|
|
881
916
|
#
|
|
882
917
|
# @!group Attributes
|
|
883
918
|
def params= params
|
|
@@ -893,7 +928,7 @@ module Google
|
|
|
893
928
|
# use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql`
|
|
894
929
|
# to true.
|
|
895
930
|
#
|
|
896
|
-
#
|
|
931
|
+
# BigQuery types are converted from Ruby types as follows:
|
|
897
932
|
#
|
|
898
933
|
# | BigQuery | Ruby | Notes |
|
|
899
934
|
# |--------------|--------------------------------------|--------------------------------------------------|
|
|
@@ -901,10 +936,11 @@ module Google
|
|
|
901
936
|
# | `INT64` | `Integer` | |
|
|
902
937
|
# | `FLOAT64` | `Float` | |
|
|
903
938
|
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
|
904
|
-
# | `BIGNUMERIC` |
|
|
939
|
+
# | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`. |
|
|
905
940
|
# | `STRING` | `String` | |
|
|
906
941
|
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
|
907
942
|
# | `DATE` | `Date` | |
|
|
943
|
+
# | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`. |
|
|
908
944
|
# | `TIMESTAMP` | `Time` | |
|
|
909
945
|
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
|
910
946
|
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
|
@@ -912,7 +948,8 @@ module Google
|
|
|
912
948
|
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
|
913
949
|
#
|
|
914
950
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
|
915
|
-
# of each BigQuery data type, including allowed values.
|
|
951
|
+
# of each BigQuery data type, including allowed values. For the `GEOGRAPHY` type, see [Working with BigQuery
|
|
952
|
+
# GIS data](https://cloud.google.com/bigquery/docs/gis-data).
|
|
916
953
|
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
|
917
954
|
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
|
918
955
|
# specify the SQL type for these values.
|
|
@@ -929,6 +966,7 @@ module Google
|
|
|
929
966
|
# * `:STRING`
|
|
930
967
|
# * `:DATETIME`
|
|
931
968
|
# * `:DATE`
|
|
969
|
+
# * `:GEOGRAPHY`
|
|
932
970
|
# * `:TIMESTAMP`
|
|
933
971
|
# * `:TIME`
|
|
934
972
|
# * `:BYTES`
|
|
@@ -294,9 +294,20 @@ module Google
|
|
|
294
294
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
295
295
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
296
296
|
# `:nullable`.
|
|
297
|
-
#
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
298
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
299
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
300
|
+
# At most 1 policy tag is currently allowed.
|
|
301
|
+
# @param [Integer] max_length The maximum UTF-8 length of strings
|
|
302
|
+
# allowed in the field.
|
|
303
|
+
#
|
|
304
|
+
def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
|
|
305
|
+
add_field name,
|
|
306
|
+
:string,
|
|
307
|
+
description: description,
|
|
308
|
+
mode: mode,
|
|
309
|
+
policy_tags: policy_tags,
|
|
310
|
+
max_length: max_length
|
|
300
311
|
end
|
|
301
312
|
|
|
302
313
|
##
|
|
@@ -310,9 +321,13 @@ module Google
|
|
|
310
321
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
311
322
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
312
323
|
# `:nullable`.
|
|
324
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
325
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
326
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
327
|
+
# At most 1 policy tag is currently allowed.
|
|
313
328
|
#
|
|
314
|
-
def integer name, description: nil, mode: :nullable
|
|
315
|
-
add_field name, :integer, description: description, mode: mode
|
|
329
|
+
def integer name, description: nil, mode: :nullable, policy_tags: nil
|
|
330
|
+
add_field name, :integer, description: description, mode: mode, policy_tags: policy_tags
|
|
316
331
|
end
|
|
317
332
|
|
|
318
333
|
##
|
|
@@ -326,9 +341,13 @@ module Google
|
|
|
326
341
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
327
342
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
328
343
|
# `:nullable`.
|
|
344
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
345
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
346
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
347
|
+
# At most 1 policy tag is currently allowed.
|
|
329
348
|
#
|
|
330
|
-
def float name, description: nil, mode: :nullable
|
|
331
|
-
add_field name, :float, description: description, mode: mode
|
|
349
|
+
def float name, description: nil, mode: :nullable, policy_tags: nil
|
|
350
|
+
add_field name, :float, description: description, mode: mode, policy_tags: policy_tags
|
|
332
351
|
end
|
|
333
352
|
|
|
334
353
|
##
|
|
@@ -353,9 +372,29 @@ module Google
|
|
|
353
372
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
354
373
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
355
374
|
# `:nullable`.
|
|
356
|
-
#
|
|
357
|
-
|
|
358
|
-
|
|
375
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
376
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
377
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
378
|
+
# At most 1 policy tag is currently allowed.
|
|
379
|
+
# @param [Integer] precision The precision (maximum number of total
|
|
380
|
+
# digits) for the field. Acceptable values for precision must be:
|
|
381
|
+
# `1 ≤ (precision - scale) ≤ 29`. Values for scale must be:
|
|
382
|
+
# `0 ≤ scale ≤ 9`. If the scale value is set, the precision value
|
|
383
|
+
# must be set as well.
|
|
384
|
+
# @param [Integer] scale The scale (maximum number of digits in the
|
|
385
|
+
# fractional part) for the field. Acceptable values for precision
|
|
386
|
+
# must be: `1 ≤ (precision - scale) ≤ 29`. Values for scale must
|
|
387
|
+
# be: `0 ≤ scale ≤ 9`. If the scale value is set, the precision
|
|
388
|
+
# value must be set as well.
|
|
389
|
+
#
|
|
390
|
+
def numeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
|
|
391
|
+
add_field name,
|
|
392
|
+
:numeric,
|
|
393
|
+
description: description,
|
|
394
|
+
mode: mode,
|
|
395
|
+
policy_tags: policy_tags,
|
|
396
|
+
precision: precision,
|
|
397
|
+
scale: scale
|
|
359
398
|
end
|
|
360
399
|
|
|
361
400
|
##
|
|
@@ -380,9 +419,29 @@ module Google
|
|
|
380
419
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
381
420
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
382
421
|
# `:nullable`.
|
|
383
|
-
#
|
|
384
|
-
|
|
385
|
-
|
|
422
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
423
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
424
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
425
|
+
# At most 1 policy tag is currently allowed.
|
|
426
|
+
# @param [Integer] precision The precision (maximum number of total
|
|
427
|
+
# digits) for the field. Acceptable values for precision must be:
|
|
428
|
+
# `1 ≤ (precision - scale) ≤ 38`. Values for scale must be:
|
|
429
|
+
# `0 ≤ scale ≤ 38`. If the scale value is set, the precision value
|
|
430
|
+
# must be set as well.
|
|
431
|
+
# @param [Integer] scale The scale (maximum number of digits in the
|
|
432
|
+
# fractional part) for the field. Acceptable values for precision
|
|
433
|
+
# must be: `1 ≤ (precision - scale) ≤ 38`. Values for scale must
|
|
434
|
+
# be: `0 ≤ scale ≤ 38`. If the scale value is set, the precision
|
|
435
|
+
# value must be set as well.
|
|
436
|
+
#
|
|
437
|
+
def bignumeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
|
|
438
|
+
add_field name,
|
|
439
|
+
:bignumeric,
|
|
440
|
+
description: description,
|
|
441
|
+
mode: mode,
|
|
442
|
+
policy_tags: policy_tags,
|
|
443
|
+
precision: precision,
|
|
444
|
+
scale: scale
|
|
386
445
|
end
|
|
387
446
|
|
|
388
447
|
##
|
|
@@ -396,9 +455,13 @@ module Google
|
|
|
396
455
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
397
456
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
398
457
|
# `:nullable`.
|
|
458
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
459
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
460
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
461
|
+
# At most 1 policy tag is currently allowed.
|
|
399
462
|
#
|
|
400
|
-
def boolean name, description: nil, mode: :nullable
|
|
401
|
-
add_field name, :boolean, description: description, mode: mode
|
|
463
|
+
def boolean name, description: nil, mode: :nullable, policy_tags: nil
|
|
464
|
+
add_field name, :boolean, description: description, mode: mode, policy_tags: policy_tags
|
|
402
465
|
end
|
|
403
466
|
|
|
404
467
|
##
|
|
@@ -412,9 +475,15 @@ module Google
|
|
|
412
475
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
413
476
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
414
477
|
# `:nullable`.
|
|
415
|
-
#
|
|
416
|
-
|
|
417
|
-
|
|
478
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
479
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
480
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
481
|
+
# At most 1 policy tag is currently allowed.
|
|
482
|
+
# @param [Integer] max_length The maximum the maximum number of
|
|
483
|
+
# bytes in the field.
|
|
484
|
+
#
|
|
485
|
+
def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
|
|
486
|
+
add_field name, :bytes, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length
|
|
418
487
|
end
|
|
419
488
|
|
|
420
489
|
##
|
|
@@ -428,8 +497,13 @@ module Google
|
|
|
428
497
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
429
498
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
430
499
|
# `:nullable`.
|
|
431
|
-
|
|
432
|
-
|
|
500
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
501
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
502
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
503
|
+
# At most 1 policy tag is currently allowed.
|
|
504
|
+
#
|
|
505
|
+
def timestamp name, description: nil, mode: :nullable, policy_tags: nil
|
|
506
|
+
add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags
|
|
433
507
|
end
|
|
434
508
|
|
|
435
509
|
##
|
|
@@ -443,9 +517,13 @@ module Google
|
|
|
443
517
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
444
518
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
445
519
|
# `:nullable`.
|
|
520
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
521
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
522
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
523
|
+
# At most 1 policy tag is currently allowed.
|
|
446
524
|
#
|
|
447
|
-
def time name, description: nil, mode: :nullable
|
|
448
|
-
add_field name, :time, description: description, mode: mode
|
|
525
|
+
def time name, description: nil, mode: :nullable, policy_tags: nil
|
|
526
|
+
add_field name, :time, description: description, mode: mode, policy_tags: policy_tags
|
|
449
527
|
end
|
|
450
528
|
|
|
451
529
|
##
|
|
@@ -459,9 +537,13 @@ module Google
|
|
|
459
537
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
460
538
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
461
539
|
# `:nullable`.
|
|
540
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
541
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
542
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
543
|
+
# At most 1 policy tag is currently allowed.
|
|
462
544
|
#
|
|
463
|
-
def datetime name, description: nil, mode: :nullable
|
|
464
|
-
add_field name, :datetime, description: description, mode: mode
|
|
545
|
+
def datetime name, description: nil, mode: :nullable, policy_tags: nil
|
|
546
|
+
add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags
|
|
465
547
|
end
|
|
466
548
|
|
|
467
549
|
##
|
|
@@ -475,9 +557,35 @@ module Google
|
|
|
475
557
|
# @param [Symbol] mode The field's mode. The possible values are
|
|
476
558
|
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
477
559
|
# `:nullable`.
|
|
560
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
561
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
562
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
563
|
+
# At most 1 policy tag is currently allowed.
|
|
478
564
|
#
|
|
479
|
-
def date name, description: nil, mode: :nullable
|
|
480
|
-
add_field name, :date, description: description, mode: mode
|
|
565
|
+
def date name, description: nil, mode: :nullable, policy_tags: nil
|
|
566
|
+
add_field name, :date, description: description, mode: mode, policy_tags: policy_tags
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
##
|
|
570
|
+
# Adds a geography field to the schema.
|
|
571
|
+
#
|
|
572
|
+
# @see https://cloud.google.com/bigquery/docs/gis-data Working with BigQuery GIS data
|
|
573
|
+
#
|
|
574
|
+
# @param [String] name The field name. The name must contain only
|
|
575
|
+
# letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
|
|
576
|
+
# start with a letter or underscore. The maximum length is 128
|
|
577
|
+
# characters.
|
|
578
|
+
# @param [String] description A description of the field.
|
|
579
|
+
# @param [Symbol] mode The field's mode. The possible values are
|
|
580
|
+
# `:nullable`, `:required`, and `:repeated`. The default value is
|
|
581
|
+
# `:nullable`.
|
|
582
|
+
# @param [Array<String>, String] policy_tags The policy tag list or
|
|
583
|
+
# single policy tag for the field. Policy tag identifiers are of
|
|
584
|
+
# the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
|
|
585
|
+
# At most 1 policy tag is currently allowed.
|
|
586
|
+
#
|
|
587
|
+
def geography name, description: nil, mode: :nullable, policy_tags: nil
|
|
588
|
+
add_field name, :geography, description: description, mode: mode, policy_tags: policy_tags
|
|
481
589
|
end
|
|
482
590
|
|
|
483
591
|
##
|
|
@@ -560,7 +668,14 @@ module Google
|
|
|
560
668
|
raise ArgumentError, "Cannot modify a frozen schema"
|
|
561
669
|
end
|
|
562
670
|
|
|
563
|
-
def add_field name,
|
|
671
|
+
def add_field name,
|
|
672
|
+
type,
|
|
673
|
+
description: nil,
|
|
674
|
+
mode: :nullable,
|
|
675
|
+
policy_tags: nil,
|
|
676
|
+
max_length: nil,
|
|
677
|
+
precision: nil,
|
|
678
|
+
scale: nil
|
|
564
679
|
frozen_check!
|
|
565
680
|
|
|
566
681
|
new_gapi = Google::Apis::BigqueryV2::TableFieldSchema.new(
|
|
@@ -570,7 +685,13 @@ module Google
|
|
|
570
685
|
mode: verify_mode(mode),
|
|
571
686
|
fields: []
|
|
572
687
|
)
|
|
573
|
-
|
|
688
|
+
if policy_tags
|
|
689
|
+
policy_tags = Array(policy_tags)
|
|
690
|
+
new_gapi.policy_tags = Google::Apis::BigqueryV2::TableFieldSchema::PolicyTags.new names: policy_tags
|
|
691
|
+
end
|
|
692
|
+
new_gapi.max_length = max_length if max_length
|
|
693
|
+
new_gapi.precision = precision if precision
|
|
694
|
+
new_gapi.scale = scale if scale
|
|
574
695
|
# Remove any existing field of this name
|
|
575
696
|
@gapi.fields ||= []
|
|
576
697
|
@gapi.fields.reject! { |f| f.name == new_gapi.name }
|