google-cloud-bigquery 1.34.0 → 1.37.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.
@@ -87,8 +87,8 @@ module Google
87
87
  ##
88
88
  # A unique ID for this model.
89
89
  #
90
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
91
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
90
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
91
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
92
92
  #
93
93
  # @!group Attributes
94
94
  #
@@ -100,8 +100,8 @@ module Google
100
100
  ##
101
101
  # The ID of the `Dataset` containing this model.
102
102
  #
103
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers
104
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
103
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers
104
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
105
105
  #
106
106
  # @!group Attributes
107
107
  #
@@ -515,8 +515,8 @@ module Google
515
515
  # * `ml_tf_saved_model` - TensorFlow SavedModel
516
516
  # * `ml_xgboost_booster` - XGBoost Booster
517
517
  # @param [String] job_id A user-defined ID for the extract job. The ID
518
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
519
- # (_), or dashes (-). The maximum length is 1,024 characters. If
518
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
519
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
520
520
  # `job_id` is provided, then `prefix` will not be used.
521
521
  #
522
522
  # See [Generating a job
@@ -525,8 +525,8 @@ module Google
525
525
  # prepended to a generated value to produce a unique job ID. For
526
526
  # example, the prefix `daily_import_job_` can be given to generate a
527
527
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
528
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
529
- # underscores (_), or dashes (-). The maximum length of the entire ID
528
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
529
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
530
530
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
531
531
  # be used.
532
532
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -139,8 +139,8 @@ module Google
139
139
  # * `empty` - An error will be returned if the destination table
140
140
  # already contains data.
141
141
  # @param [String] job_id A user-defined ID for the copy job. The ID
142
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
143
- # (_), or dashes (-). The maximum length is 1,024 characters. If
142
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
143
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
144
144
  # `job_id` is provided, then `prefix` will not be used.
145
145
  #
146
146
  # See [Generating a job
@@ -149,8 +149,8 @@ module Google
149
149
  # prepended to a generated value to produce a unique job ID. For
150
150
  # example, the prefix `daily_import_job_` can be given to generate a
151
151
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
152
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
153
- # underscores (_), or dashes (-). The maximum length of the entire ID
152
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
153
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
154
154
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
155
155
  # be used.
156
156
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -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
- # Ruby types are mapped to BigQuery types as follows:
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` | | Query param values must be mapped in `types`. |
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`
@@ -404,8 +407,8 @@ module Google
404
407
  # (without incurring a charge). Optional. If unspecified, this will be
405
408
  # set to your project default.
406
409
  # @param [String] job_id A user-defined ID for the query job. The ID
407
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
408
- # (_), or dashes (-). The maximum length is 1,024 characters. If
410
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
411
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
409
412
  # `job_id` is provided, then `prefix` will not be used.
410
413
  #
411
414
  # See [Generating a job
@@ -414,8 +417,8 @@ module Google
414
417
  # prepended to a generated value to produce a unique job ID. For
415
418
  # example, the prefix `daily_import_job_` can be given to generate a
416
419
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
417
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
418
- # underscores (_), or dashes (-). The maximum length of the entire ID
420
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
421
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
419
422
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
420
423
  # be used.
421
424
  #
@@ -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
- # Ruby types are mapped to BigQuery types as follows:
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` | | Query param values must be mapped in `types`. |
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`
@@ -980,8 +986,8 @@ module Google
980
986
  # Creates a new dataset.
981
987
  #
982
988
  # @param [String] dataset_id A unique ID for this dataset, without the
983
- # project name. The ID must contain only letters (a-z, A-Z), numbers
984
- # (0-9), or underscores (_). The maximum length is 1,024 characters.
989
+ # project name. The ID must contain only letters (`[A-Za-z]`), numbers
990
+ # (`[0-9]`), or underscores (`_`). The maximum length is 1,024 characters.
985
991
  # @param [String] name A descriptive name for the dataset.
986
992
  # @param [String] description A user-friendly description of the
987
993
  # dataset.
@@ -1518,8 +1524,8 @@ module Google
1518
1524
  # @param [Boolean] header Whether to print out a header row in table
1519
1525
  # exports. Default is `true`. Not applicable when extracting models.
1520
1526
  # @param [String] job_id A user-defined ID for the extract job. The ID
1521
- # must contain only letters (a-z, A-Z), numbers (0-9), underscores
1522
- # (_), or dashes (-). The maximum length is 1,024 characters. If
1527
+ # must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), underscores
1528
+ # (`_`), or dashes (`-`). The maximum length is 1,024 characters. If
1523
1529
  # `job_id` is provided, then `prefix` will not be used.
1524
1530
  #
1525
1531
  # See [Generating a job
@@ -1528,8 +1534,8 @@ module Google
1528
1534
  # prepended to a generated value to produce a unique job ID. For
1529
1535
  # example, the prefix `daily_import_job_` can be given to generate a
1530
1536
  # job ID such as `daily_import_job_12vEDtMQ0mbp1Mo5Z7mzAFQJZazh`. The
1531
- # prefix must contain only letters (a-z, A-Z), numbers (0-9),
1532
- # underscores (_), or dashes (-). The maximum length of the entire ID
1537
+ # prefix must contain only letters (`[A-Za-z]`), numbers (`[0-9]`),
1538
+ # underscores (`_`), or dashes (`-`). The maximum length of the entire ID
1533
1539
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1534
1540
  # be used.
1535
1541
  # @param [Hash] labels A hash of user-provided labels associated with
@@ -891,7 +891,7 @@ module Google
891
891
  # use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql`
892
892
  # to true.
893
893
  #
894
- # Ruby types are mapped to BigQuery types as follows:
894
+ # BigQuery types are converted from Ruby types as follows:
895
895
  #
896
896
  # | BigQuery | Ruby | Notes |
897
897
  # |--------------|--------------------------------------|--------------------------------------------------|
@@ -899,10 +899,11 @@ module Google
899
899
  # | `INT64` | `Integer` | |
900
900
  # | `FLOAT64` | `Float` | |
901
901
  # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
902
- # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
902
+ # | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`. |
903
903
  # | `STRING` | `String` | |
904
904
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
905
905
  # | `DATE` | `Date` | |
906
+ # | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`. |
906
907
  # | `TIMESTAMP` | `Time` | |
907
908
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
908
909
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -910,7 +911,8 @@ module Google
910
911
  # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
911
912
  #
912
913
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
913
- # 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).
914
916
  #
915
917
  # @!group Attributes
916
918
  def params= params
@@ -926,7 +928,7 @@ module Google
926
928
  # use named query parameters. When set, `legacy_sql` will automatically be set to false and `standard_sql`
927
929
  # to true.
928
930
  #
929
- # Ruby types are mapped to BigQuery types as follows:
931
+ # BigQuery types are converted from Ruby types as follows:
930
932
  #
931
933
  # | BigQuery | Ruby | Notes |
932
934
  # |--------------|--------------------------------------|--------------------------------------------------|
@@ -934,10 +936,11 @@ module Google
934
936
  # | `INT64` | `Integer` | |
935
937
  # | `FLOAT64` | `Float` | |
936
938
  # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
937
- # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
939
+ # | `BIGNUMERIC` | `BigDecimal` | NOT AUTOMATIC: Must be mapped using `types`. |
938
940
  # | `STRING` | `String` | |
939
941
  # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
940
942
  # | `DATE` | `Date` | |
943
+ # | `GEOGRAPHY` | `String` (WKT or GeoJSON) | NOT AUTOMATIC: Must be mapped using `types`. |
941
944
  # | `TIMESTAMP` | `Time` | |
942
945
  # | `TIME` | `Google::Cloud::BigQuery::Time` | |
943
946
  # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
@@ -945,7 +948,8 @@ module Google
945
948
  # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
946
949
  #
947
950
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
948
- # 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).
949
953
  # @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
950
954
  # possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
951
955
  # specify the SQL type for these values.
@@ -962,6 +966,7 @@ module Google
962
966
  # * `:STRING`
963
967
  # * `:DATETIME`
964
968
  # * `:DATE`
969
+ # * `:GEOGRAPHY`
965
970
  # * `:TIMESTAMP`
966
971
  # * `:TIME`
967
972
  # * `:BYTES`
@@ -116,8 +116,8 @@ module Google
116
116
  ##
117
117
  # A unique ID for this routine, without the project name.
118
118
  #
119
- # @return [String] The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
120
- # length is 256 characters.
119
+ # @return [String] The ID must contain only letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`). The
120
+ # maximum length is 256 characters.
121
121
  #
122
122
  # @!group Attributes
123
123
  #
@@ -40,14 +40,31 @@ module Google
40
40
  MODES = ["NULLABLE", "REQUIRED", "REPEATED"].freeze
41
41
 
42
42
  # @private
43
- TYPES = ["STRING", "INTEGER", "INT64", "FLOAT", "FLOAT64", "NUMERIC", "BIGNUMERIC", "BOOLEAN", "BOOL",
44
- "BYTES", "TIMESTAMP", "TIME", "DATETIME", "DATE", "RECORD", "STRUCT"].freeze
43
+ TYPES = [
44
+ "BIGNUMERIC",
45
+ "BOOL",
46
+ "BOOLEAN",
47
+ "BYTES",
48
+ "DATE",
49
+ "DATETIME",
50
+ "FLOAT",
51
+ "FLOAT64",
52
+ "GEOGRAPHY",
53
+ "INTEGER",
54
+ "INT64",
55
+ "NUMERIC",
56
+ "RECORD",
57
+ "STRING",
58
+ "STRUCT",
59
+ "TIME",
60
+ "TIMESTAMP"
61
+ ].freeze
45
62
 
46
63
  ##
47
64
  # The name of the field.
48
65
  #
49
66
  # @return [String] The field name. The name must contain only
50
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
67
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
51
68
  # start with a letter or underscore. The maximum length is 128
52
69
  # characters.
53
70
  #
@@ -59,7 +76,7 @@ module Google
59
76
  # Updates the name of the field.
60
77
  #
61
78
  # @param [String] new_name The field name. The name must contain only
62
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
79
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
63
80
  # start with a letter or underscore. The maximum length is 128
64
81
  # characters.
65
82
  #
@@ -70,12 +87,25 @@ module Google
70
87
  ##
71
88
  # The data type of the field.
72
89
  #
73
- # @return [String] The field data type. Possible values include
74
- # `STRING`, `BYTES`, `INTEGER`, `INT64` (same as `INTEGER`),
75
- # `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `BIGNUMERIC`,
76
- # `BOOLEAN`, `BOOL` (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
77
- # `TIME`, `DATETIME`, `RECORD` (where `RECORD` indicates that the
78
- # field contains a nested schema) or `STRUCT` (same as `RECORD`).
90
+ # @return [String] The field data type. Possible values include:
91
+ #
92
+ # * `BIGNUMERIC`
93
+ # * `BOOL`
94
+ # * `BOOLEAN` (same as `BOOL`)
95
+ # * `BYTES`
96
+ # * `DATE`
97
+ # * `DATETIME`
98
+ # * `FLOAT`
99
+ # * `FLOAT64` (same as `FLOAT`)
100
+ # * `GEOGRAPHY`
101
+ # * `INTEGER`
102
+ # * `INT64` (same as `INTEGER`)
103
+ # * `NUMERIC`
104
+ # * `RECORD` (where `RECORD` indicates that the field contains a nested schema)
105
+ # * `STRING`
106
+ # * `STRUCT` (same as `RECORD`)
107
+ # * `TIME`
108
+ # * `TIMESTAMP`
79
109
  #
80
110
  def type
81
111
  @gapi.type
@@ -84,12 +114,25 @@ module Google
84
114
  ##
85
115
  # Updates the data type of the field.
86
116
  #
87
- # @param [String] new_type The data type. Possible values include
88
- # `STRING`, `BYTES`, `INTEGER`, `INT64` (same as `INTEGER`),
89
- # `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `BIGNUMERIC`,
90
- # `BOOLEAN`, `BOOL` (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
91
- # `TIME`, `DATETIME`, `RECORD` (where `RECORD` indicates that the
92
- # field contains a nested schema) or `STRUCT` (same as `RECORD`).
117
+ # @param [String] new_type The data type. Possible values include:
118
+ #
119
+ # * `BIGNUMERIC`
120
+ # * `BOOL`
121
+ # * `BOOLEAN` (same as `BOOL`)
122
+ # * `BYTES`
123
+ # * `DATE`
124
+ # * `DATETIME`
125
+ # * `FLOAT`
126
+ # * `FLOAT64` (same as `FLOAT`)
127
+ # * `GEOGRAPHY`
128
+ # * `INTEGER`
129
+ # * `INT64` (same as `INTEGER`)
130
+ # * `NUMERIC`
131
+ # * `RECORD` (where `RECORD` indicates that the field contains a nested schema)
132
+ # * `STRING`
133
+ # * `STRUCT` (same as `RECORD`)
134
+ # * `TIME`
135
+ # * `TIMESTAMP`
93
136
  #
94
137
  def type= new_type
95
138
  @gapi.update! type: verify_type(new_type)
@@ -357,6 +400,15 @@ module Google
357
400
  type == "DATE"
358
401
  end
359
402
 
403
+ ##
404
+ # Checks if the type of the field is `GEOGRAPHY`.
405
+ #
406
+ # @return [Boolean] `true` when `GEOGRAPHY`, `false` otherwise.
407
+ #
408
+ def geography?
409
+ type == "GEOGRAPHY"
410
+ end
411
+
360
412
  ##
361
413
  # Checks if the type of the field is `RECORD`.
362
414
  #
@@ -443,7 +495,7 @@ module Google
443
495
  # This can only be called on fields that are of type `RECORD`.
444
496
  #
445
497
  # @param [String] name The field name. The name must contain only
446
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
498
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
447
499
  # start with a letter or underscore. The maximum length is 128
448
500
  # characters.
449
501
  # @param [String] description A description of the field.
@@ -474,7 +526,7 @@ module Google
474
526
  # This can only be called on fields that are of type `RECORD`.
475
527
  #
476
528
  # @param [String] name The field name. The name must contain only
477
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
529
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
478
530
  # start with a letter or underscore. The maximum length is 128
479
531
  # characters.
480
532
  # @param [String] description A description of the field.
@@ -499,7 +551,7 @@ module Google
499
551
  # This can only be called on fields that are of type `RECORD`.
500
552
  #
501
553
  # @param [String] name The field name. The name must contain only
502
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
554
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
503
555
  # start with a letter or underscore. The maximum length is 128
504
556
  # characters.
505
557
  # @param [String] description A description of the field.
@@ -534,7 +586,7 @@ module Google
534
586
  # This can only be called on fields that are of type `RECORD`.
535
587
  #
536
588
  # @param [String] name The field name. The name must contain only
537
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
589
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
538
590
  # start with a letter or underscore. The maximum length is 128
539
591
  # characters.
540
592
  # @param [String] description A description of the field.
@@ -585,7 +637,7 @@ module Google
585
637
  # This can only be called on fields that are of type `RECORD`.
586
638
  #
587
639
  # @param [String] name The field name. The name must contain only
588
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
640
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
589
641
  # start with a letter or underscore. The maximum length is 128
590
642
  # characters.
591
643
  # @param [String] description A description of the field.
@@ -625,7 +677,7 @@ module Google
625
677
  # This can only be called on fields that are of type `RECORD`.
626
678
  #
627
679
  # @param [String] name The field name. The name must contain only
628
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
680
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
629
681
  # start with a letter or underscore. The maximum length is 128
630
682
  # characters.
631
683
  # @param [String] description A description of the field.
@@ -649,7 +701,7 @@ module Google
649
701
  # This can only be called on fields that are of type `RECORD`.
650
702
  #
651
703
  # @param [String] name The field name. The name must contain only
652
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
704
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
653
705
  # start with a letter or underscore. The maximum length is 128
654
706
  # characters.
655
707
  # @param [String] description A description of the field.
@@ -680,7 +732,7 @@ module Google
680
732
  # This can only be called on fields that are of type `RECORD`.
681
733
  #
682
734
  # @param [String] name The field name. The name must contain only
683
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
735
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
684
736
  # start with a letter or underscore. The maximum length is 128
685
737
  # characters.
686
738
  # @param [String] description A description of the field.
@@ -704,7 +756,7 @@ module Google
704
756
  # This can only be called on fields that are of type `RECORD`.
705
757
  #
706
758
  # @param [String] name The field name. The name must contain only
707
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
759
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
708
760
  # start with a letter or underscore. The maximum length is 128
709
761
  # characters.
710
762
  # @param [String] description A description of the field.
@@ -728,7 +780,7 @@ module Google
728
780
  # This can only be called on fields that are of type `RECORD`.
729
781
  #
730
782
  # @param [String] name The field name. The name must contain only
731
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
783
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
732
784
  # start with a letter or underscore. The maximum length is 128
733
785
  # characters.
734
786
  # @param [String] description A description of the field.
@@ -752,7 +804,7 @@ module Google
752
804
  # This can only be called on fields that are of type `RECORD`.
753
805
  #
754
806
  # @param [String] name The field name. The name must contain only
755
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
807
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
756
808
  # start with a letter or underscore. The maximum length is 128
757
809
  # characters.
758
810
  # @param [String] description A description of the field.
@@ -770,6 +822,30 @@ module Google
770
822
  add_field name, :date, description: description, mode: mode, policy_tags: policy_tags
771
823
  end
772
824
 
825
+ ##
826
+ # Adds a geography field to the nested schema of a record field.
827
+ #
828
+ # @see https://cloud.google.com/bigquery/docs/gis-data Working with BigQuery GIS data
829
+ #
830
+ # @param [String] name The field name. The name must contain only
831
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
832
+ # start with a letter or underscore. The maximum length is 128
833
+ # characters.
834
+ # @param [String] description A description of the field.
835
+ # @param [Symbol] mode The field's mode. The possible values are
836
+ # `:nullable`, `:required`, and `:repeated`. The default value is
837
+ # `:nullable`.
838
+ # @param [Array<String>, String] policy_tags The policy tag list or
839
+ # single policy tag for the field. Policy tag identifiers are of
840
+ # the form `projects/*/locations/*/taxonomies/*/policyTags/*`.
841
+ # At most 1 policy tag is currently allowed.
842
+ #
843
+ def geography name, description: nil, mode: :nullable, policy_tags: nil
844
+ record_check!
845
+
846
+ add_field name, :geography, description: description, mode: mode, policy_tags: policy_tags
847
+ end
848
+
773
849
  ##
774
850
  # Adds a record field to the nested schema of a record field. A block
775
851
  # must be passed describing the nested fields of the record. For more
@@ -779,7 +855,7 @@ module Google
779
855
  # This can only be called on fields that are of type `RECORD`.
780
856
  #
781
857
  # @param [String] name The field name. The name must contain only
782
- # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
858
+ # letters (`[A-Za-z]`), numbers (`[0-9]`), or underscores (`_`), and must
783
859
  # start with a letter or underscore. The maximum length is 128
784
860
  # characters.
785
861
  # @param [String] description A description of the field.
@@ -863,7 +939,14 @@ module Google
863
939
  "Cannot add fields to a non-RECORD field (#{type})"
864
940
  end
865
941
 
866
- def add_field name, type, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
942
+ def add_field name,
943
+ type,
944
+ description: nil,
945
+ mode: :nullable,
946
+ policy_tags: nil,
947
+ max_length: nil,
948
+ precision: nil,
949
+ scale: nil
867
950
  frozen_check!
868
951
 
869
952
  new_gapi = Google::Apis::BigqueryV2::TableFieldSchema.new(
@@ -878,6 +961,8 @@ module Google
878
961
  new_gapi.policy_tags = Google::Apis::BigqueryV2::TableFieldSchema::PolicyTags.new names: policy_tags
879
962
  end
880
963
  new_gapi.max_length = max_length if max_length
964
+ new_gapi.precision = precision if precision
965
+ new_gapi.scale = scale if scale
881
966
  # Remove any existing field of this name
882
967
  @gapi.fields ||= []
883
968
  @gapi.fields.reject! { |f| f.name == new_gapi.name }