google-cloud-bigquery 1.58.0 → 1.60.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/CHANGELOG.md +12 -0
- data/lib/google/cloud/bigquery/copy_job.rb +14 -1
- data/lib/google/cloud/bigquery/dataset.rb +202 -15
- data/lib/google/cloud/bigquery/extract_job.rb +14 -1
- data/lib/google/cloud/bigquery/load_job.rb +14 -2
- data/lib/google/cloud/bigquery/model.rb +15 -4
- data/lib/google/cloud/bigquery/project.rb +91 -13
- data/lib/google/cloud/bigquery/query_job.rb +14 -1
- data/lib/google/cloud/bigquery/schema/field.rb +31 -3
- data/lib/google/cloud/bigquery/schema.rb +6 -3
- data/lib/google/cloud/bigquery/table.rb +154 -25
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +1 -1
|
@@ -752,6 +752,37 @@ module Google
|
|
|
752
752
|
patch_gapi! :description
|
|
753
753
|
end
|
|
754
754
|
|
|
755
|
+
##
|
|
756
|
+
# The default collation of the table.
|
|
757
|
+
#
|
|
758
|
+
# @return [String, nil] The default collation, or `nil` if not present or the object is a
|
|
759
|
+
# reference (see {#reference?}).
|
|
760
|
+
#
|
|
761
|
+
# @!group Attributes
|
|
762
|
+
#
|
|
763
|
+
def default_collation
|
|
764
|
+
return nil if reference?
|
|
765
|
+
ensure_full_data!
|
|
766
|
+
@gapi.default_collation
|
|
767
|
+
end
|
|
768
|
+
|
|
769
|
+
##
|
|
770
|
+
# Updates the default collation of the table.
|
|
771
|
+
#
|
|
772
|
+
# If the table is not a full resource representation (see
|
|
773
|
+
# {#resource_full?}), the full representation will be retrieved before
|
|
774
|
+
# the update to comply with ETag-based optimistic concurrency control.
|
|
775
|
+
#
|
|
776
|
+
# @param [String] new_default_collation The new default collation for the table.
|
|
777
|
+
#
|
|
778
|
+
# @!group Attributes
|
|
779
|
+
#
|
|
780
|
+
def default_collation= new_default_collation
|
|
781
|
+
reload! unless resource_full?
|
|
782
|
+
@gapi.update! default_collation: new_default_collation
|
|
783
|
+
patch_gapi! :default_collation
|
|
784
|
+
end
|
|
785
|
+
|
|
755
786
|
##
|
|
756
787
|
# The number of bytes in the table.
|
|
757
788
|
#
|
|
@@ -1817,6 +1848,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1817
1848
|
# @param [Boolean] dryrun If set, don't actually run this job. Behavior
|
|
1818
1849
|
# is undefined however for non-query jobs and may result in an error.
|
|
1819
1850
|
# Deprecated.
|
|
1851
|
+
# @param [String] operation_type The type of operation for this job.
|
|
1852
|
+
# @param [String] reservation The reservation that job would use. User
|
|
1853
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
1854
|
+
# set, reservation is determined based on the rules defined by the
|
|
1855
|
+
# reservation assignments. The expected format is
|
|
1856
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
1820
1857
|
#
|
|
1821
1858
|
# @yield [job] a job configuration object
|
|
1822
1859
|
# @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
|
|
@@ -1849,7 +1886,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1849
1886
|
# @!group Data
|
|
1850
1887
|
#
|
|
1851
1888
|
def copy_job destination_table, create: nil, write: nil, job_id: nil, prefix: nil, labels: nil, dryrun: nil,
|
|
1852
|
-
operation_type: nil
|
|
1889
|
+
operation_type: nil, reservation: nil
|
|
1853
1890
|
ensure_service!
|
|
1854
1891
|
options = { create: create,
|
|
1855
1892
|
write: write,
|
|
@@ -1857,7 +1894,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1857
1894
|
labels: labels,
|
|
1858
1895
|
job_id: job_id,
|
|
1859
1896
|
prefix: prefix,
|
|
1860
|
-
operation_type: operation_type
|
|
1897
|
+
operation_type: operation_type,
|
|
1898
|
+
reservation: reservation }
|
|
1861
1899
|
updater = CopyJob::Updater.from_options(
|
|
1862
1900
|
service,
|
|
1863
1901
|
table_ref,
|
|
@@ -1910,6 +1948,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1910
1948
|
# * `append` - BigQuery appends the data to the table.
|
|
1911
1949
|
# * `empty` - An error will be returned if the destination table
|
|
1912
1950
|
# already contains data.
|
|
1951
|
+
# @param [String] reservation The reservation that job would use. User
|
|
1952
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
1953
|
+
# set, reservation is determined based on the rules defined by the
|
|
1954
|
+
# reservation assignments. The expected format is
|
|
1955
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
1956
|
+
#
|
|
1913
1957
|
# @yield [job] a job configuration object
|
|
1914
1958
|
# @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
|
|
1915
1959
|
# configuration object for setting additional options.
|
|
@@ -1937,11 +1981,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1937
1981
|
#
|
|
1938
1982
|
# @!group Data
|
|
1939
1983
|
#
|
|
1940
|
-
def copy destination_table, create: nil, write: nil, &block
|
|
1984
|
+
def copy destination_table, create: nil, write: nil, reservation: nil, &block
|
|
1941
1985
|
copy_job_with_operation_type destination_table,
|
|
1942
1986
|
create: create,
|
|
1943
1987
|
write: write,
|
|
1944
1988
|
operation_type: OperationType::COPY,
|
|
1989
|
+
reservation: reservation,
|
|
1945
1990
|
&block
|
|
1946
1991
|
end
|
|
1947
1992
|
|
|
@@ -1967,6 +2012,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1967
2012
|
# Reference](https://cloud.google.com/bigquery/query-reference#from)
|
|
1968
2013
|
# (`project-name:dataset_id.table_id`). This is useful for referencing
|
|
1969
2014
|
# tables in other projects and datasets.
|
|
2015
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2016
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2017
|
+
# set, reservation is determined based on the rules defined by the
|
|
2018
|
+
# reservation assignments. The expected format is
|
|
2019
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
1970
2020
|
#
|
|
1971
2021
|
# @yield [job] a job configuration object
|
|
1972
2022
|
# @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
|
|
@@ -1995,9 +2045,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
1995
2045
|
#
|
|
1996
2046
|
# @!group Data
|
|
1997
2047
|
#
|
|
1998
|
-
def clone destination_table, &block
|
|
2048
|
+
def clone destination_table, reservation: nil, &block
|
|
1999
2049
|
copy_job_with_operation_type destination_table,
|
|
2000
2050
|
operation_type: OperationType::CLONE,
|
|
2051
|
+
reservation: reservation,
|
|
2001
2052
|
&block
|
|
2002
2053
|
end
|
|
2003
2054
|
|
|
@@ -2022,6 +2073,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2022
2073
|
# Reference](https://cloud.google.com/bigquery/query-reference#from)
|
|
2023
2074
|
# (`project-name:dataset_id.table_id`). This is useful for referencing
|
|
2024
2075
|
# tables in other projects and datasets.
|
|
2076
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2077
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2078
|
+
# set, reservation is determined based on the rules defined by the
|
|
2079
|
+
# reservation assignments. The expected format is
|
|
2080
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2025
2081
|
#
|
|
2026
2082
|
# @yield [job] a job configuration object
|
|
2027
2083
|
# @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
|
|
@@ -2050,9 +2106,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2050
2106
|
#
|
|
2051
2107
|
# @!group Data
|
|
2052
2108
|
#
|
|
2053
|
-
def snapshot destination_table, &block
|
|
2109
|
+
def snapshot destination_table, reservation: nil, &block
|
|
2054
2110
|
copy_job_with_operation_type destination_table,
|
|
2055
2111
|
operation_type: OperationType::SNAPSHOT,
|
|
2112
|
+
reservation: reservation,
|
|
2056
2113
|
&block
|
|
2057
2114
|
end
|
|
2058
2115
|
|
|
@@ -2094,6 +2151,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2094
2151
|
# * `append` - BigQuery appends the data to the table.
|
|
2095
2152
|
# * `empty` - An error will be returned if the destination table
|
|
2096
2153
|
# already contains data.
|
|
2154
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2155
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2156
|
+
# set, reservation is determined based on the rules defined by the
|
|
2157
|
+
# reservation assignments. The expected format is
|
|
2158
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2159
|
+
#
|
|
2097
2160
|
# @yield [job] a job configuration object
|
|
2098
2161
|
# @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
|
|
2099
2162
|
# configuration object for setting additional options.
|
|
@@ -2121,11 +2184,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2121
2184
|
#
|
|
2122
2185
|
# @!group Data
|
|
2123
2186
|
#
|
|
2124
|
-
def restore destination_table, create: nil, write: nil, &block
|
|
2187
|
+
def restore destination_table, create: nil, write: nil, reservation: nil, &block
|
|
2125
2188
|
copy_job_with_operation_type destination_table,
|
|
2126
2189
|
create: create,
|
|
2127
2190
|
write: write,
|
|
2128
2191
|
operation_type: OperationType::RESTORE,
|
|
2192
|
+
reservation: reservation,
|
|
2129
2193
|
&block
|
|
2130
2194
|
end
|
|
2131
2195
|
|
|
@@ -2198,6 +2262,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2198
2262
|
# @param [Boolean] dryrun If set, don't actually run this job. Behavior
|
|
2199
2263
|
# is undefined however for non-query jobs and may result in an error.
|
|
2200
2264
|
# Deprecated.
|
|
2265
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2266
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2267
|
+
# set, reservation is determined based on the rules defined by the
|
|
2268
|
+
# reservation assignments. The expected format is
|
|
2269
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2201
2270
|
#
|
|
2202
2271
|
# @yield [job] a job configuration object
|
|
2203
2272
|
# @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
|
|
@@ -2220,10 +2289,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2220
2289
|
# @!group Data
|
|
2221
2290
|
#
|
|
2222
2291
|
def extract_job extract_url, format: nil, compression: nil, delimiter: nil, header: nil, job_id: nil,
|
|
2223
|
-
prefix: nil, labels: nil, dryrun: nil
|
|
2292
|
+
prefix: nil, labels: nil, dryrun: nil, reservation: nil
|
|
2224
2293
|
ensure_service!
|
|
2225
2294
|
options = { format: format, compression: compression, delimiter: delimiter, header: header, dryrun: dryrun,
|
|
2226
|
-
job_id: job_id, prefix: prefix, labels: labels }
|
|
2295
|
+
job_id: job_id, prefix: prefix, labels: labels, reservation: reservation }
|
|
2227
2296
|
updater = ExtractJob::Updater.from_options service, table_ref, extract_url, options
|
|
2228
2297
|
updater.location = location if location # may be table reference
|
|
2229
2298
|
|
|
@@ -2267,6 +2336,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2267
2336
|
# exported data. Default is <code>,</code>.
|
|
2268
2337
|
# @param [Boolean] header Whether to print out a header row in the
|
|
2269
2338
|
# results. Default is `true`.
|
|
2339
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2340
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2341
|
+
# set, reservation is determined based on the rules defined by the
|
|
2342
|
+
# reservation assignments. The expected format is
|
|
2343
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2344
|
+
#
|
|
2270
2345
|
# @yield [job] a job configuration object
|
|
2271
2346
|
# @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
|
|
2272
2347
|
# configuration object for setting additional options.
|
|
@@ -2295,12 +2370,13 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2295
2370
|
#
|
|
2296
2371
|
# @!group Data
|
|
2297
2372
|
#
|
|
2298
|
-
def extract extract_url, format: nil, compression: nil, delimiter: nil, header: nil, &block
|
|
2373
|
+
def extract extract_url, format: nil, compression: nil, delimiter: nil, header: nil, reservation: nil, &block
|
|
2299
2374
|
job = extract_job extract_url,
|
|
2300
2375
|
format: format,
|
|
2301
2376
|
compression: compression,
|
|
2302
2377
|
delimiter: delimiter,
|
|
2303
2378
|
header: header,
|
|
2379
|
+
reservation: reservation,
|
|
2304
2380
|
&block
|
|
2305
2381
|
job.wait_until_done!
|
|
2306
2382
|
ensure_job_succeeded! job
|
|
@@ -2484,6 +2560,20 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2484
2560
|
# and reorders columns to match the field names in the schema.
|
|
2485
2561
|
# @param [String] time_zone The time zone used when parsing timestamp
|
|
2486
2562
|
# values.
|
|
2563
|
+
# @param [String] reference_file_schema_uri The URI of the reference
|
|
2564
|
+
# file with the reader schema. This file is only loaded if it is part
|
|
2565
|
+
# of source URIs, but is not loaded otherwise. It is enabled for the
|
|
2566
|
+
# following formats: `AVRO`, `PARQUET`, `ORC`.
|
|
2567
|
+
# @param [Boolean] preserve_ascii_control_characters When source_format
|
|
2568
|
+
# is set to `CSV`, indicates if the embedded ASCII control characters
|
|
2569
|
+
# (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
|
|
2570
|
+
# are preserved. By default, ASCII control characters are not
|
|
2571
|
+
# preserved.
|
|
2572
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2573
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2574
|
+
# set, reservation is determined based on the rules defined by the
|
|
2575
|
+
# reservation assignments. The expected format is
|
|
2576
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2487
2577
|
#
|
|
2488
2578
|
# @yield [load_job] a block for setting the load job
|
|
2489
2579
|
# @yieldparam [LoadJob] load_job the load job object to be updated
|
|
@@ -2542,7 +2632,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2542
2632
|
quote: nil, skip_leading: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
|
|
2543
2633
|
null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema,
|
|
2544
2634
|
date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
|
|
2545
|
-
null_markers: nil, source_column_match: nil, time_zone: nil
|
|
2635
|
+
null_markers: nil, source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
|
|
2636
|
+
preserve_ascii_control_characters: nil, reservation: nil
|
|
2546
2637
|
ensure_service!
|
|
2547
2638
|
|
|
2548
2639
|
updater = load_job_updater format: format, create: create, write: write, projection_fields: projection_fields,
|
|
@@ -2554,7 +2645,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2554
2645
|
session_id: session_id, date_format: date_format,
|
|
2555
2646
|
datetime_format: datetime_format, time_format: time_format,
|
|
2556
2647
|
timestamp_format: timestamp_format, null_markers: null_markers,
|
|
2557
|
-
source_column_match: source_column_match, time_zone: time_zone
|
|
2648
|
+
source_column_match: source_column_match, time_zone: time_zone,
|
|
2649
|
+
reference_file_schema_uri: reference_file_schema_uri,
|
|
2650
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters,
|
|
2651
|
+
reservation: reservation
|
|
2558
2652
|
|
|
2559
2653
|
yield updater if block_given?
|
|
2560
2654
|
|
|
@@ -2703,6 +2797,20 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2703
2797
|
# and reorders columns to match the field names in the schema.
|
|
2704
2798
|
# @param [String] time_zone The time zone used when parsing timestamp
|
|
2705
2799
|
# values.
|
|
2800
|
+
# @param [String] reference_file_schema_uri The URI of the reference
|
|
2801
|
+
# file with the reader schema. This file is only loaded if it is part
|
|
2802
|
+
# of source URIs, but is not loaded otherwise. It is enabled for the
|
|
2803
|
+
# following formats: `AVRO`, `PARQUET`, `ORC`.
|
|
2804
|
+
# @param [Boolean] preserve_ascii_control_characters When source_format
|
|
2805
|
+
# is set to `CSV`, indicates if the embedded ASCII control characters
|
|
2806
|
+
# (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
|
|
2807
|
+
# are preserved. By default, ASCII control characters are not
|
|
2808
|
+
# preserved.
|
|
2809
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2810
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2811
|
+
# set, reservation is determined based on the rules defined by the
|
|
2812
|
+
# reservation assignments. The expected format is
|
|
2813
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2706
2814
|
#
|
|
2707
2815
|
# @yield [updater] A block for setting the schema of the destination
|
|
2708
2816
|
# table and other options for the load job. The schema can be omitted
|
|
@@ -2766,7 +2874,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2766
2874
|
quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
|
|
2767
2875
|
quote: nil, skip_leading: nil, autodetect: nil, null_marker: nil, session_id: nil,
|
|
2768
2876
|
schema: self.schema, date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
|
|
2769
|
-
null_markers: nil, source_column_match: nil, time_zone: nil,
|
|
2877
|
+
null_markers: nil, source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
|
|
2878
|
+
preserve_ascii_control_characters: nil, reservation: nil, &block
|
|
2770
2879
|
job = load_job files, format: format, create: create, write: write, projection_fields: projection_fields,
|
|
2771
2880
|
jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
|
|
2772
2881
|
delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
|
|
@@ -2774,7 +2883,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
2774
2883
|
null_marker: null_marker, session_id: session_id, schema: schema,
|
|
2775
2884
|
date_format: date_format, datetime_format: datetime_format, time_format: time_format,
|
|
2776
2885
|
timestamp_format: timestamp_format, null_markers: null_markers,
|
|
2777
|
-
source_column_match: source_column_match, time_zone: time_zone,
|
|
2886
|
+
source_column_match: source_column_match, time_zone: time_zone,
|
|
2887
|
+
reference_file_schema_uri: reference_file_schema_uri,
|
|
2888
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters,
|
|
2889
|
+
reservation: reservation, &block
|
|
2778
2890
|
|
|
2779
2891
|
job.wait_until_done!
|
|
2780
2892
|
ensure_job_succeeded! job
|
|
@@ -3168,11 +3280,13 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3168
3280
|
|
|
3169
3281
|
protected
|
|
3170
3282
|
|
|
3171
|
-
def copy_job_with_operation_type destination_table, create: nil, write: nil, operation_type: nil,
|
|
3283
|
+
def copy_job_with_operation_type destination_table, create: nil, write: nil, operation_type: nil,
|
|
3284
|
+
reservation: nil, &block
|
|
3172
3285
|
job = copy_job destination_table,
|
|
3173
3286
|
create: create,
|
|
3174
3287
|
write: write,
|
|
3175
3288
|
operation_type: operation_type,
|
|
3289
|
+
reservation: reservation,
|
|
3176
3290
|
&block
|
|
3177
3291
|
job.wait_until_done!
|
|
3178
3292
|
ensure_job_succeeded! job
|
|
@@ -3223,7 +3337,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3223
3337
|
end
|
|
3224
3338
|
end
|
|
3225
3339
|
|
|
3226
|
-
def load_job_gapi table_id, dryrun, job_id: nil, prefix: nil
|
|
3340
|
+
def load_job_gapi table_id, dryrun, job_id: nil, prefix: nil, reservation: nil
|
|
3227
3341
|
job_ref = service.job_ref_from job_id, prefix
|
|
3228
3342
|
Google::Apis::BigqueryV2::Job.new(
|
|
3229
3343
|
job_reference: job_ref,
|
|
@@ -3235,13 +3349,15 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3235
3349
|
table_id: table_id
|
|
3236
3350
|
)
|
|
3237
3351
|
),
|
|
3238
|
-
dry_run: dryrun
|
|
3352
|
+
dry_run: dryrun,
|
|
3353
|
+
reservation: reservation
|
|
3239
3354
|
)
|
|
3240
3355
|
)
|
|
3241
3356
|
end
|
|
3242
3357
|
|
|
3243
3358
|
def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
|
|
3244
|
-
skip_leading: nil, null_marker: nil, null_markers: nil, source_column_match: nil
|
|
3359
|
+
skip_leading: nil, null_marker: nil, null_markers: nil, source_column_match: nil,
|
|
3360
|
+
preserve_ascii_control_characters: nil
|
|
3245
3361
|
job.jagged_rows = jagged_rows unless jagged_rows.nil?
|
|
3246
3362
|
job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
|
|
3247
3363
|
job.delimiter = delimiter unless delimiter.nil?
|
|
@@ -3250,13 +3366,16 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3250
3366
|
job.skip_leading = skip_leading unless skip_leading.nil?
|
|
3251
3367
|
job.null_markers = null_markers unless null_markers.nil?
|
|
3252
3368
|
job.source_column_match = source_column_match unless source_column_match.nil?
|
|
3369
|
+
job.preserve_ascii_control_characters = preserve_ascii_control_characters unless
|
|
3370
|
+
preserve_ascii_control_characters.nil?
|
|
3253
3371
|
end
|
|
3254
3372
|
|
|
3255
3373
|
def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
|
|
3256
3374
|
encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
|
|
3257
3375
|
skip_leading: nil, null_marker: nil, date_format: nil, datetime_format: nil,
|
|
3258
3376
|
time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
|
|
3259
|
-
time_zone: nil
|
|
3377
|
+
time_zone: nil, reference_file_schema_uri: nil,
|
|
3378
|
+
preserve_ascii_control_characters: nil
|
|
3260
3379
|
job.format = format unless format.nil?
|
|
3261
3380
|
job.projection_fields = projection_fields unless projection_fields.nil?
|
|
3262
3381
|
job.encoding = encoding unless encoding.nil?
|
|
@@ -3267,6 +3386,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3267
3386
|
job.time_format = time_format unless time_format.nil?
|
|
3268
3387
|
job.timestamp_format = timestamp_format unless timestamp_format.nil?
|
|
3269
3388
|
job.time_zone = time_zone unless time_zone.nil?
|
|
3389
|
+
job.reference_file_schema_uri = reference_file_schema_uri unless reference_file_schema_uri.nil?
|
|
3270
3390
|
load_job_csv_options! job, jagged_rows: jagged_rows,
|
|
3271
3391
|
quoted_newlines: quoted_newlines,
|
|
3272
3392
|
delimiter: delimiter,
|
|
@@ -3274,7 +3394,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3274
3394
|
skip_leading: skip_leading,
|
|
3275
3395
|
null_marker: null_marker,
|
|
3276
3396
|
null_markers: null_markers,
|
|
3277
|
-
source_column_match: source_column_match
|
|
3397
|
+
source_column_match: source_column_match,
|
|
3398
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters
|
|
3278
3399
|
end
|
|
3279
3400
|
|
|
3280
3401
|
def load_job_updater format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
|
|
@@ -3283,8 +3404,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3283
3404
|
prefix: nil, labels: nil, autodetect: nil, null_marker: nil,
|
|
3284
3405
|
create_session: nil, session_id: nil, date_format: nil, datetime_format: nil,
|
|
3285
3406
|
time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
|
|
3286
|
-
time_zone: nil
|
|
3287
|
-
|
|
3407
|
+
time_zone: nil, reference_file_schema_uri: nil, preserve_ascii_control_characters: nil,
|
|
3408
|
+
reservation: nil
|
|
3409
|
+
new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix, reservation: reservation
|
|
3288
3410
|
LoadJob::Updater.new(new_job).tap do |job|
|
|
3289
3411
|
job.location = location if location # may be table reference
|
|
3290
3412
|
job.create = create unless create.nil?
|
|
@@ -3311,7 +3433,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3311
3433
|
timestamp_format: timestamp_format,
|
|
3312
3434
|
null_markers: null_markers,
|
|
3313
3435
|
source_column_match: source_column_match,
|
|
3314
|
-
time_zone: time_zone
|
|
3436
|
+
time_zone: time_zone,
|
|
3437
|
+
reference_file_schema_uri: reference_file_schema_uri,
|
|
3438
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters
|
|
3315
3439
|
end
|
|
3316
3440
|
end
|
|
3317
3441
|
|
|
@@ -3706,7 +3830,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3706
3830
|
# At most 1 policy tag is currently allowed.
|
|
3707
3831
|
# @param [Integer] max_length The maximum UTF-8 length of strings
|
|
3708
3832
|
# allowed in the field.
|
|
3709
|
-
# @param
|
|
3833
|
+
# @param [String] default_value_expression The default value of a field
|
|
3710
3834
|
# using a SQL expression. It can only be set for top level fields (columns).
|
|
3711
3835
|
# Use a struct or array expression to specify default value for the entire struct or
|
|
3712
3836
|
# array. The valid SQL expressions are:
|
|
@@ -3722,6 +3846,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3722
3846
|
# `ST_GEOPOINT`
|
|
3723
3847
|
# - Struct or array composed with the above allowed functions, for example:
|
|
3724
3848
|
# "[CURRENT_DATE(), DATE '2020-01-01'"]
|
|
3849
|
+
# @param [String] collation The collation of the field.
|
|
3850
|
+
# Collation can be set only when the type of field is `STRING`.
|
|
3851
|
+
# The following values are supported:
|
|
3852
|
+
# - `und:ci`: undetermined locale, case insensitive.
|
|
3853
|
+
# - (empty string): Default to case-sensitive behavior.
|
|
3725
3854
|
#
|
|
3726
3855
|
# @example
|
|
3727
3856
|
# require "google/cloud/bigquery"
|
|
@@ -3743,9 +3872,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
|
|
|
3743
3872
|
#
|
|
3744
3873
|
# @!group Schema
|
|
3745
3874
|
def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil,
|
|
3746
|
-
default_value_expression: nil
|
|
3875
|
+
default_value_expression: nil, collation: nil
|
|
3747
3876
|
schema.string name, description: description, mode: mode, policy_tags: policy_tags, max_length: max_length,
|
|
3748
|
-
default_value_expression: default_value_expression
|
|
3877
|
+
default_value_expression: default_value_expression, collation: collation
|
|
3749
3878
|
end
|
|
3750
3879
|
|
|
3751
3880
|
##
|