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.
@@ -287,48 +287,67 @@ module Google
287
287
  # Adds a string field to the schema.
288
288
  #
289
289
  # @param [String] name The field name. The name must contain only
290
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
290
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
291
291
  # start with a letter or underscore. The maximum length is 128
292
292
  # characters.
293
293
  # @param [String] description A description of the field.
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
- def string name, description: nil, mode: :nullable
299
- add_field name, :string, description: description, mode: mode
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
  ##
303
314
  # Adds an integer field to the schema.
304
315
  #
305
316
  # @param [String] name The field name. The name must contain only
306
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
317
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
307
318
  # start with a letter or underscore. The maximum length is 128
308
319
  # characters.
309
320
  # @param [String] description A description of the field.
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
  ##
319
334
  # Adds a floating-point number field to the schema.
320
335
  #
321
336
  # @param [String] name The field name. The name must contain only
322
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
337
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
323
338
  # start with a letter or underscore. The maximum length is 128
324
339
  # characters.
325
340
  # @param [String] description A description of the field.
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
  ##
@@ -346,16 +365,36 @@ module Google
346
365
  # for financial calculations.
347
366
  #
348
367
  # @param [String] name The field name. The name must contain only
349
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
368
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
350
369
  # start with a letter or underscore. The maximum length is 128
351
370
  # characters.
352
371
  # @param [String] description A description of the field.
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
- def numeric name, description: nil, mode: :nullable
358
- add_field name, :numeric, description: description, mode: mode
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
  ##
@@ -373,111 +412,180 @@ module Google
373
412
  # for financial calculations.
374
413
  #
375
414
  # @param [String] name The field name. The name must contain only
376
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
415
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
377
416
  # start with a letter or underscore. The maximum length is 128
378
417
  # characters.
379
418
  # @param [String] description A description of the field.
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
- def bignumeric name, description: nil, mode: :nullable
385
- add_field name, :bignumeric, description: description, mode: mode
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
  ##
389
448
  # Adds a boolean field to the schema.
390
449
  #
391
450
  # @param [String] name The field name. The name must contain only
392
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
451
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
393
452
  # start with a letter or underscore. The maximum length is 128
394
453
  # characters.
395
454
  # @param [String] description A description of the field.
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
  ##
405
468
  # Adds a bytes field to the schema.
406
469
  #
407
470
  # @param [String] name The field name. The name must contain only
408
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
471
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
409
472
  # start with a letter or underscore. The maximum length is 128
410
473
  # characters.
411
474
  # @param [String] description A description of the field.
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
- def bytes name, description: nil, mode: :nullable
417
- add_field name, :bytes, description: description, mode: mode
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
  ##
421
490
  # Adds a timestamp field to the schema.
422
491
  #
423
492
  # @param [String] name The field name. The name must contain only
424
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
493
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
425
494
  # start with a letter or underscore. The maximum length is 128
426
495
  # characters.
427
496
  # @param [String] description A description of the field.
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
- def timestamp name, description: nil, mode: :nullable
432
- add_field name, :timestamp, description: description, mode: mode
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
  ##
436
510
  # Adds a time field to the schema.
437
511
  #
438
512
  # @param [String] name The field name. The name must contain only
439
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
513
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
440
514
  # start with a letter or underscore. The maximum length is 128
441
515
  # characters.
442
516
  # @param [String] description A description of the field.
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
  ##
452
530
  # Adds a datetime field to the schema.
453
531
  #
454
532
  # @param [String] name The field name. The name must contain only
455
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
533
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
456
534
  # start with a letter or underscore. The maximum length is 128
457
535
  # characters.
458
536
  # @param [String] description A description of the field.
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
  ##
468
550
  # Adds a date field to the schema.
469
551
  #
470
552
  # @param [String] name The field name. The name must contain only
471
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
553
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
554
+ # start with a letter or underscore. The maximum length is 128
555
+ # characters.
556
+ # @param [String] description A description of the field.
557
+ # @param [Symbol] mode The field's mode. The possible values are
558
+ # `:nullable`, `:required`, and `:repeated`. The default value is
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.
564
+ #
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-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
472
576
  # start with a letter or underscore. The maximum length is 128
473
577
  # characters.
474
578
  # @param [String] description A description of the field.
475
579
  # @param [Symbol] mode The field's mode. The possible values are
476
580
  # `:nullable`, `:required`, and `:repeated`. The default value is
477
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.
478
586
  #
479
- def date name, description: nil, mode: :nullable
480
- add_field name, :date, description: description, mode: mode
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
  ##
@@ -488,7 +596,7 @@ module Google
488
596
  # ](https://cloud.google.com/bigquery/docs/loading-data#loading_denormalized_nested_and_repeated_data).
489
597
  #
490
598
  # @param [String] name The field name. The name must contain only
491
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
599
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
492
600
  # start with a letter or underscore. The maximum length is 128
493
601
  # characters.
494
602
  # @param [String] description A description of the field.
@@ -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, type, description: nil, mode: :nullable
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 }
@@ -601,7 +601,7 @@ module Google
601
601
 
602
602
  protected
603
603
 
604
- def retry? result, current_retries #:nodoc:
604
+ def retry? result, current_retries
605
605
  if current_retries < @retries && retry_error_reason?(result)
606
606
  return true
607
607
  end
@@ -110,6 +110,7 @@ module Google
110
110
  # | `BIGNUMERIC` | `String` | Pass as `String` to avoid rounding to scale 9. |
111
111
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
112
112
  # | `DATE` | `Date` | |
113
+ # | `GEOGRAPHY` | `String` | |
113
114
  # | `TIMESTAMP` | `Time` | |
114
115
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
115
116
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -119,8 +119,8 @@ module Google
119
119
  ##
120
120
  # A unique ID for this table.
121
121
  #
122
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
123
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
122
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
123
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
124
124
  #
125
125
  # @!group Attributes
126
126
  #
@@ -132,8 +132,8 @@ module Google
132
132
  ##
133
133
  # The ID of the `Dataset` containing this table.
134
134
  #
135
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
136
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
135
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
136
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
137
137
  #
138
138
  # @!group Attributes
139
139
  #
@@ -1633,8 +1633,8 @@ module Google
1633
1633
  # * `empty` - An error will be returned if the destination table
1634
1634
  # already contains data.
1635
1635
  # @param [String] job_id A user-defined ID for the copy job. The ID
1636
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
1637
- # (_), or dashes (-). The maximum length is 1,024 characters. If
1636
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
1637
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
1638
1638
  # `job_id` is provided, then `prefix` will not be used.
1639
1639
  #
1640
1640
  # See [Generating a job
@@ -1643,8 +1643,8 @@ module Google
1643
1643
  # prepended to a generated value to produce a unique job ID. For
1644
1644
  # example, the prefix `daily_import_job_` can be given to generate a
1645
1645
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
1646
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
1647
- # underscores (_), or dashes (-). The maximum length of the entire ID
1646
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
1647
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
1648
1648
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1649
1649
  # be used.
1650
1650
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -1822,8 +1822,8 @@ module Google
1822
1822
  # @param [Boolean] header Whether to print out a header row in the
1823
1823
  # results. Default is `true`.
1824
1824
  # @param [String] job_id A user-defined ID for the extract job. The ID
1825
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
1826
- # (_), or dashes (-). The maximum length is 1,024 characters. If
1825
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
1826
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
1827
1827
  # `job_id` is provided, then `prefix` will not be used.
1828
1828
  #
1829
1829
  # See [Generating a job
@@ -1832,8 +1832,8 @@ module Google
1832
1832
  # prepended to a generated value to produce a unique job ID. For
1833
1833
  # example, the prefix `daily_import_job_` can be given to generate a
1834
1834
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
1835
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
1836
- # underscores (_), or dashes (-). The maximum length of the entire ID
1835
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
1836
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
1837
1837
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1838
1838
  # be used.
1839
1839
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -2070,8 +2070,8 @@ module Google
2070
2070
  # value is `0`. This property is useful if you have header rows in the
2071
2071
  # file that should be skipped.
2072
2072
  # @param [String] job_id A user-defined ID for the load job. The ID
2073
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
2074
- # (_), or dashes (-). The maximum length is 1,024 characters. If
2073
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
2074
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
2075
2075
  # `job_id` is provided, then `prefix` will not be used.
2076
2076
  #
2077
2077
  # See [Generating a job
@@ -2080,8 +2080,8 @@ module Google
2080
2080
  # prepended to a generated value to produce a unique job ID. For
2081
2081
  # example, the prefix `daily_import_job_` can be given to generate a
2082
2082
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
2083
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
2084
- # underscores (_), or dashes (-). The maximum length of the entire ID
2083
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
2084
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
2085
2085
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
2086
2086
  # be used.
2087
2087
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -2369,12 +2369,15 @@ module Google
2369
2369
  # | `BIGNUMERIC` | `String` | Pass as `String` to avoid rounding to scale 9. |
2370
2370
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
2371
2371
  # | `DATE` | `Date` | |
2372
+ # | `GEOGRAPHY` | `String` | Well-known text (WKT) or GeoJSON. |
2372
2373
  # | `TIMESTAMP` | `Time` | |
2373
2374
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
2374
2375
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
2375
2376
  # | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
2376
2377
  # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
2377
2378
  #
2379
+ # For `GEOGRAPHY` data, see [Working with BigQuery GIS data](https://cloud.google.com/bigquery/docs/gis-data).
2380
+ #
2378
2381
  # Because BigQuery's streaming API is designed for high insertion rates,
2379
2382
  # modifications to the underlying table metadata are eventually
2380
2383
  # consistent when interacting with the streaming system. In most cases
@@ -3231,13 +3234,19 @@ module Google
3231
3234
  # See {Schema#string}.
3232
3235
  #
3233
3236
  # @param [String] name The field name. The name must contain only
3234
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3237
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3235
3238
  # start with a letter or underscore. The maximum length is 128
3236
3239
  # characters.
3237
3240
  # @param [String] description A description of the field.
3238
3241
  # @param [Symbol] mode The field's mode. The possible values are
3239
3242
  # `:nullable`, `:required`, and `:repeated`. The default value is
3240
3243
  # `:nullable`.
3244
+ # @param [Array<String>, String] policy_tags The policy tag list or
3245
+ # single policy tag for the field. Policy tag identifiers are of
3246
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3247
+ # At most 1 policy tag is currently allowed.
3248
+ # @param [Integer] max_length The maximum UTF-8 length of strings
3249
+ # allowed in the field.
3241
3250
  #
3242
3251
  # @example
3243
3252
  # require "google/cloud/bigquery"
@@ -3249,8 +3258,8 @@ module Google
3249
3258
  # end
3250
3259
  #
3251
3260
  # @!group Schema
3252
- def string name, description: nil, mode: :nullable
3253
- schema.string name, description: description, mode: mode
3261
+ def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
3262
+ schema.string name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length
3254
3263
  end
3255
3264
 
3256
3265
  ##
@@ -3259,13 +3268,17 @@ module Google
3259
3268
  # See {Schema#integer}.
3260
3269
  #
3261
3270
  # @param [String] name The field name. The name must contain only
3262
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3271
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3263
3272
  # start with a letter or underscore. The maximum length is 128
3264
3273
  # characters.
3265
3274
  # @param [String] description A description of the field.
3266
3275
  # @param [Symbol] mode The field's mode. The possible values are
3267
3276
  # `:nullable`, `:required`, and `:repeated`. The default value is
3268
3277
  # `:nullable`.
3278
+ # @param [Array<String>, String] policy_tags The policy tag list or
3279
+ # single policy tag for the field. Policy tag identifiers are of
3280
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3281
+ # At most 1 policy tag is currently allowed.
3269
3282
  #
3270
3283
  # @example
3271
3284
  # require "google/cloud/bigquery"
@@ -3277,8 +3290,8 @@ module Google
3277
3290
  # end
3278
3291
  #
3279
3292
  # @!group Schema
3280
- def integer name, description: nil, mode: :nullable
3281
- schema.integer name, description: description, mode: mode
3293
+ def integer name, description: nil, mode: :nullable, policy_tags: nil
3294
+ schema.integer name, description: description, mode: mode, policy_tags: policy_tags
3282
3295
  end
3283
3296
 
3284
3297
  ##
@@ -3287,13 +3300,17 @@ module Google
3287
3300
  # See {Schema#float}.
3288
3301
  #
3289
3302
  # @param [String] name The field name. The name must contain only
3290
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3303
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3291
3304
  # start with a letter or underscore. The maximum length is 128
3292
3305
  # characters.
3293
3306
  # @param [String] description A description of the field.
3294
3307
  # @param [Symbol] mode The field's mode. The possible values are
3295
3308
  # `:nullable`, `:required`, and `:repeated`. The default value is
3296
3309
  # `:nullable`.
3310
+ # @param [Array<String>, String] policy_tags The policy tag list or
3311
+ # single policy tag for the field. Policy tag identifiers are of
3312
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3313
+ # At most 1 policy tag is currently allowed.
3297
3314
  #
3298
3315
  # @example
3299
3316
  # require "google/cloud/bigquery"
@@ -3305,8 +3322,8 @@ module Google
3305
3322
  # end
3306
3323
  #
3307
3324
  # @!group Schema
3308
- def float name, description: nil, mode: :nullable
3309
- schema.float name, description: description, mode: mode
3325
+ def float name, description: nil, mode: :nullable, policy_tags: nil
3326
+ schema.float name, description: description, mode: mode, policy_tags: policy_tags
3310
3327
  end
3311
3328
 
3312
3329
  ##
@@ -3326,13 +3343,27 @@ module Google
3326
3343
  # See {Schema#numeric}
3327
3344
  #
3328
3345
  # @param [String] name The field name. The name must contain only
3329
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3346
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3330
3347
  # start with a letter or underscore. The maximum length is 128
3331
3348
  # characters.
3332
3349
  # @param [String] description A description of the field.
3333
3350
  # @param [Symbol] mode The field's mode. The possible values are
3334
3351
  # `:nullable`, `:required`, and `:repeated`. The default value is
3335
3352
  # `:nullable`.
3353
+ # @param [Array<String>, String] policy_tags The policy tag list or
3354
+ # single policy tag for the field. Policy tag identifiers are of
3355
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3356
+ # At most 1 policy tag is currently allowed.
3357
+ # @param [Integer] precision The precision (maximum number of total
3358
+ # digits) for the field. Acceptable values for precision must be:
3359
+ # `1 ≤ (precision - scale) ≤ 29`. Values for scale must be:
3360
+ # `0 ≤ scale ≤ 9`. If the scale value is set, the precision value
3361
+ # must be set as well.
3362
+ # @param [Integer] scale The scale (maximum number of digits in the
3363
+ # fractional part) for the field. Acceptable values for precision
3364
+ # must be: `1 ≤ (precision - scale) ≤ 29`. Values for scale must
3365
+ # be: `0 ≤ scale ≤ 9`. If the scale value is set, the precision
3366
+ # value must be set as well.
3336
3367
  #
3337
3368
  # @example
3338
3369
  # require "google/cloud/bigquery"
@@ -3344,8 +3375,13 @@ module Google
3344
3375
  # end
3345
3376
  #
3346
3377
  # @!group Schema
3347
- def numeric name, description: nil, mode: :nullable
3348
- schema.numeric name, description: description, mode: mode
3378
+ def numeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
3379
+ schema.numeric name,
3380
+ description: description,
3381
+ mode: mode,
3382
+ policy_tags: policy_tags,
3383
+ precision: precision,
3384
+ scale: scale
3349
3385
  end
3350
3386
 
3351
3387
  ##
@@ -3365,13 +3401,27 @@ module Google
3365
3401
  # See {Schema#bignumeric}
3366
3402
  #
3367
3403
  # @param [String] name The field name. The name must contain only
3368
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3404
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3369
3405
  # start with a letter or underscore. The maximum length is 128
3370
3406
  # characters.
3371
3407
  # @param [String] description A description of the field.
3372
3408
  # @param [Symbol] mode The field's mode. The possible values are
3373
3409
  # `:nullable`, `:required`, and `:repeated`. The default value is
3374
3410
  # `:nullable`.
3411
+ # @param [Array<String>, String] policy_tags The policy tag list or
3412
+ # single policy tag for the field. Policy tag identifiers are of
3413
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3414
+ # At most 1 policy tag is currently allowed.
3415
+ # @param [Integer] precision The precision (maximum number of total
3416
+ # digits) for the field. Acceptable values for precision must be:
3417
+ # `1 ≤ (precision - scale) ≤ 38`. Values for scale must be:
3418
+ # `0 ≤ scale ≤ 38`. If the scale value is set, the precision value
3419
+ # must be set as well.
3420
+ # @param [Integer] scale The scale (maximum number of digits in the
3421
+ # fractional part) for the field. Acceptable values for precision
3422
+ # must be: `1 ≤ (precision - scale) ≤ 38`. Values for scale must
3423
+ # be: `0 ≤ scale ≤ 38`. If the scale value is set, the precision
3424
+ # value must be set as well.
3375
3425
  #
3376
3426
  # @example
3377
3427
  # require "google/cloud/bigquery"
@@ -3383,8 +3433,13 @@ module Google
3383
3433
  # end
3384
3434
  #
3385
3435
  # @!group Schema
3386
- def bignumeric name, description: nil, mode: :nullable
3387
- schema.bignumeric name, description: description, mode: mode
3436
+ def bignumeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil
3437
+ schema.bignumeric name,
3438
+ description: description,
3439
+ mode: mode,
3440
+ policy_tags: policy_tags,
3441
+ precision: precision,
3442
+ scale: scale
3388
3443
  end
3389
3444
 
3390
3445
  ##
@@ -3393,13 +3448,17 @@ module Google
3393
3448
  # See {Schema#boolean}.
3394
3449
  #
3395
3450
  # @param [String] name The field name. The name must contain only
3396
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3451
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3397
3452
  # start with a letter or underscore. The maximum length is 128
3398
3453
  # characters.
3399
3454
  # @param [String] description A description of the field.
3400
3455
  # @param [Symbol] mode The field's mode. The possible values are
3401
3456
  # `:nullable`, `:required`, and `:repeated`. The default value is
3402
3457
  # `:nullable`.
3458
+ # @param [Array<String>, String] policy_tags The policy tag list or
3459
+ # single policy tag for the field. Policy tag identifiers are of
3460
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3461
+ # At most 1 policy tag is currently allowed.
3403
3462
  #
3404
3463
  # @example
3405
3464
  # require "google/cloud/bigquery"
@@ -3411,8 +3470,8 @@ module Google
3411
3470
  # end
3412
3471
  #
3413
3472
  # @!group Schema
3414
- def boolean name, description: nil, mode: :nullable
3415
- schema.boolean name, description: description, mode: mode
3473
+ def boolean name, description: nil, mode: :nullable, policy_tags: nil
3474
+ schema.boolean name, description: description, mode: mode, policy_tags: policy_tags
3416
3475
  end
3417
3476
 
3418
3477
  ##
@@ -3421,13 +3480,19 @@ module Google
3421
3480
  # See {Schema#bytes}.
3422
3481
  #
3423
3482
  # @param [String] name The field name. The name must contain only
3424
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3483
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3425
3484
  # start with a letter or underscore. The maximum length is 128
3426
3485
  # characters.
3427
3486
  # @param [String] description A description of the field.
3428
3487
  # @param [Symbol] mode The field's mode. The possible values are
3429
3488
  # `:nullable`, `:required`, and `:repeated`. The default value is
3430
3489
  # `:nullable`.
3490
+ # @param [Array<String>, String] policy_tags The policy tag list or
3491
+ # single policy tag for the field. Policy tag identifiers are of
3492
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3493
+ # At most 1 policy tag is currently allowed.
3494
+ # @param [Integer] max_length The maximum the maximum number of
3495
+ # bytes in the field.
3431
3496
  #
3432
3497
  # @example
3433
3498
  # require "google/cloud/bigquery"
@@ -3439,8 +3504,8 @@ module Google
3439
3504
  # end
3440
3505
  #
3441
3506
  # @!group Schema
3442
- def bytes name, description: nil, mode: :nullable
3443
- schema.bytes name, description: description, mode: mode
3507
+ def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
3508
+ schema.bytes name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length
3444
3509
  end
3445
3510
 
3446
3511
  ##
@@ -3449,13 +3514,17 @@ module Google
3449
3514
  # See {Schema#timestamp}.
3450
3515
  #
3451
3516
  # @param [String] name The field name. The name must contain only
3452
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3517
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3453
3518
  # start with a letter or underscore. The maximum length is 128
3454
3519
  # characters.
3455
3520
  # @param [String] description A description of the field.
3456
3521
  # @param [Symbol] mode The field's mode. The possible values are
3457
3522
  # `:nullable`, `:required`, and `:repeated`. The default value is
3458
3523
  # `:nullable`.
3524
+ # @param [Array<String>, String] policy_tags The policy tag list or
3525
+ # single policy tag for the field. Policy tag identifiers are of
3526
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3527
+ # At most 1 policy tag is currently allowed.
3459
3528
  #
3460
3529
  # @example
3461
3530
  # require "google/cloud/bigquery"
@@ -3467,8 +3536,8 @@ module Google
3467
3536
  # end
3468
3537
  #
3469
3538
  # @!group Schema
3470
- def timestamp name, description: nil, mode: :nullable
3471
- schema.timestamp name, description: description, mode: mode
3539
+ def timestamp name, description: nil, mode: :nullable, policy_tags: nil
3540
+ schema.timestamp name, description: description, mode: mode, policy_tags: policy_tags
3472
3541
  end
3473
3542
 
3474
3543
  ##
@@ -3477,13 +3546,17 @@ module Google
3477
3546
  # See {Schema#time}.
3478
3547
  #
3479
3548
  # @param [String] name The field name. The name must contain only
3480
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3549
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3481
3550
  # start with a letter or underscore. The maximum length is 128
3482
3551
  # characters.
3483
3552
  # @param [String] description A description of the field.
3484
3553
  # @param [Symbol] mode The field's mode. The possible values are
3485
3554
  # `:nullable`, `:required`, and `:repeated`. The default value is
3486
3555
  # `:nullable`.
3556
+ # @param [Array<String>, String] policy_tags The policy tag list or
3557
+ # single policy tag for the field. Policy tag identifiers are of
3558
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3559
+ # At most 1 policy tag is currently allowed.
3487
3560
  #
3488
3561
  # @example
3489
3562
  # require "google/cloud/bigquery"
@@ -3495,8 +3568,8 @@ module Google
3495
3568
  # end
3496
3569
  #
3497
3570
  # @!group Schema
3498
- def time name, description: nil, mode: :nullable
3499
- schema.time name, description: description, mode: mode
3571
+ def time name, description: nil, mode: :nullable, policy_tags: nil
3572
+ schema.time name, description: description, mode: mode, policy_tags: policy_tags
3500
3573
  end
3501
3574
 
3502
3575
  ##
@@ -3505,13 +3578,17 @@ module Google
3505
3578
  # See {Schema#datetime}.
3506
3579
  #
3507
3580
  # @param [String] name The field name. The name must contain only
3508
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3581
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3509
3582
  # start with a letter or underscore. The maximum length is 128
3510
3583
  # characters.
3511
3584
  # @param [String] description A description of the field.
3512
3585
  # @param [Symbol] mode The field's mode. The possible values are
3513
3586
  # `:nullable`, `:required`, and `:repeated`. The default value is
3514
3587
  # `:nullable`.
3588
+ # @param [Array<String>, String] policy_tags The policy tag list or
3589
+ # single policy tag for the field. Policy tag identifiers are of
3590
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3591
+ # At most 1 policy tag is currently allowed.
3515
3592
  #
3516
3593
  # @example
3517
3594
  # require "google/cloud/bigquery"
@@ -3523,8 +3600,8 @@ module Google
3523
3600
  # end
3524
3601
  #
3525
3602
  # @!group Schema
3526
- def datetime name, description: nil, mode: :nullable
3527
- schema.datetime name, description: description, mode: mode
3603
+ def datetime name, description: nil, mode: :nullable, policy_tags: nil
3604
+ schema.datetime name, description: description, mode: mode, policy_tags: policy_tags
3528
3605
  end
3529
3606
 
3530
3607
  ##
@@ -3533,13 +3610,17 @@ module Google
3533
3610
  # See {Schema#date}.
3534
3611
  #
3535
3612
  # @param [String] name The field name. The name must contain only
3536
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3613
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3537
3614
  # start with a letter or underscore. The maximum length is 128
3538
3615
  # characters.
3539
3616
  # @param [String] description A description of the field.
3540
3617
  # @param [Symbol] mode The field's mode. The possible values are
3541
3618
  # `:nullable`, `:required`, and `:repeated`. The default value is
3542
3619
  # `:nullable`.
3620
+ # @param [Array<String>, String] policy_tags The policy tag list or
3621
+ # single policy tag for the field. Policy tag identifiers are of
3622
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3623
+ # At most 1 policy tag is currently allowed.
3543
3624
  #
3544
3625
  # @example
3545
3626
  # require "google/cloud/bigquery"
@@ -3551,8 +3632,39 @@ module Google
3551
3632
  # end
3552
3633
  #
3553
3634
  # @!group Schema
3554
- def date name, description: nil, mode: :nullable
3555
- schema.date name, description: description, mode: mode
3635
+ def date name, description: nil, mode: :nullable, policy_tags: nil
3636
+ schema.date name, description: description, mode: mode, policy_tags: policy_tags
3637
+ end
3638
+
3639
+ ##
3640
+ # Adds a geography field to the schema.
3641
+ #
3642
+ # @see https://cloud.google.com/bigquery/docs/gis-data Working with BigQuery GIS data
3643
+ #
3644
+ # @param [String] name The field name. The name must contain only
3645
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3646
+ # start with a letter or underscore. The maximum length is 128
3647
+ # characters.
3648
+ # @param [String] description A description of the field.
3649
+ # @param [Symbol] mode The field's mode. The possible values are
3650
+ # `:nullable`, `:required`, and `:repeated`. The default value is
3651
+ # `:nullable`.
3652
+ # @param [Array<String>, String] policy_tags The policy tag list or
3653
+ # single policy tag for the field. Policy tag identifiers are of
3654
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
3655
+ # At most 1 policy tag is currently allowed.
3656
+ #
3657
+ # @example
3658
+ # require "google/cloud/bigquery"
3659
+ #
3660
+ # bigquery = Google::Cloud::Bigquery.new
3661
+ # dataset = bigquery.dataset "my_dataset"
3662
+ # table = dataset.create_table "my_table" do |schema|
3663
+ # schema.geography "home", mode: :required
3664
+ # end
3665
+ #
3666
+ def geography name, description: nil, mode: :nullable, policy_tags: nil
3667
+ schema.geography name, description: description, mode: mode, policy_tags: policy_tags
3556
3668
  end
3557
3669
 
3558
3670
  ##
@@ -3565,7 +3677,7 @@ module Google
3565
3677
  # See {Schema#record}.
3566
3678
  #
3567
3679
  # @param [String] name The field name. The name must contain only
3568
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
3680
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
3569
3681
  # start with a letter or underscore. The maximum length is 128
3570
3682
  # characters.
3571
3683
  # @param [String] description A description of the field.