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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfd8eb30d69f00bd5456b486ff5fa103b58ef743f7218bab37ec26024c7b8ef2
|
|
4
|
+
data.tar.gz: 35b45c78ebdb2561f5e059ba52c3998232262607bbdbb9240bbe3ec14f738624
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 715cc0d0301c141f589f8e968fcb1aaa862d036fcf74775184a1a1cfc6c2aa56e35bbf6c5abccabebea5be5ebfca59939905ae56c5985953326167fd712be8ec
|
|
7
|
+
data.tar.gz: fd1c105c9eae04b004176351ead6287d856bc3f4a8c8ecee4ab6931a7b8ae1aded11a3c32faa296af725d0115edb8a793f9bfe9172c6f181ba0432e504dc140e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### 1.60.0 (2025-10-24)
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* Exposing reservation field in JobConfiguration ([#31777](https://github.com/googleapis/google-cloud-ruby/issues/31777))
|
|
8
|
+
|
|
9
|
+
### 1.59.0 (2025-09-17)
|
|
10
|
+
|
|
11
|
+
#### Features
|
|
12
|
+
|
|
13
|
+
* Support collation feature ([#30919](https://github.com/googleapis/google-cloud-ruby/issues/30919))
|
|
14
|
+
|
|
3
15
|
### 1.58.0 (2025-09-03)
|
|
4
16
|
|
|
5
17
|
#### Features
|
|
@@ -194,7 +194,8 @@ module Google
|
|
|
194
194
|
job_reference: job_ref,
|
|
195
195
|
configuration: Google::Apis::BigqueryV2::JobConfiguration.new(
|
|
196
196
|
copy: copy_cfg,
|
|
197
|
-
dry_run: options[:dryrun]
|
|
197
|
+
dry_run: options[:dryrun],
|
|
198
|
+
reservation: options[:reservation]
|
|
198
199
|
)
|
|
199
200
|
)
|
|
200
201
|
|
|
@@ -325,6 +326,18 @@ module Google
|
|
|
325
326
|
@gapi.configuration.update! labels: value
|
|
326
327
|
end
|
|
327
328
|
|
|
329
|
+
##
|
|
330
|
+
# Sets the reservation that job would use. User can specify a reservation
|
|
331
|
+
# to execute the job. If reservation is not set, reservation is determined
|
|
332
|
+
# based on the rules defined by the reservation assignments. The expected
|
|
333
|
+
# format is `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
334
|
+
# @param [String] value The reservation name.
|
|
335
|
+
#
|
|
336
|
+
# @!group Attributes
|
|
337
|
+
def reservation= value
|
|
338
|
+
@gapi.configuration.update! reservation: value
|
|
339
|
+
end
|
|
340
|
+
|
|
328
341
|
def cancel
|
|
329
342
|
raise "not implemented in #{self.class}"
|
|
330
343
|
end
|
|
@@ -197,6 +197,37 @@ module Google
|
|
|
197
197
|
patch_gapi! :description
|
|
198
198
|
end
|
|
199
199
|
|
|
200
|
+
##
|
|
201
|
+
# The default collation of the dataset.
|
|
202
|
+
#
|
|
203
|
+
# @return [String, nil] The default collation, or `nil` if not present or the object is a
|
|
204
|
+
# reference (see {#reference?}).
|
|
205
|
+
#
|
|
206
|
+
# @!group Attributes
|
|
207
|
+
#
|
|
208
|
+
def default_collation
|
|
209
|
+
return nil if reference?
|
|
210
|
+
ensure_full_data!
|
|
211
|
+
@gapi.default_collation
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
##
|
|
215
|
+
# Updates the default collation of the dataset.
|
|
216
|
+
#
|
|
217
|
+
# If the dataset is not a full resource representation (see
|
|
218
|
+
# {#resource_full?}), the full representation will be retrieved before
|
|
219
|
+
# the update to comply with ETag-based optimistic concurrency control.
|
|
220
|
+
#
|
|
221
|
+
# @param [String] new_default_collation The new default collation for the dataset.
|
|
222
|
+
#
|
|
223
|
+
# @!group Attributes
|
|
224
|
+
#
|
|
225
|
+
def default_collation= new_default_collation
|
|
226
|
+
reload! unless resource_full?
|
|
227
|
+
@gapi.update! default_collation: new_default_collation
|
|
228
|
+
patch_gapi! :default_collation
|
|
229
|
+
end
|
|
230
|
+
|
|
200
231
|
##
|
|
201
232
|
# The default lifetime of all tables in the dataset, in milliseconds.
|
|
202
233
|
#
|
|
@@ -1393,6 +1424,12 @@ module Google
|
|
|
1393
1424
|
# The default value is false.
|
|
1394
1425
|
# @param [String] session_id The ID of an existing session. See also the
|
|
1395
1426
|
# `create_session` param and {Job#session_id}.
|
|
1427
|
+
# @param [String] reservation The reservation that job would use. User
|
|
1428
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
1429
|
+
# set, reservation is determined based on the rules defined by the
|
|
1430
|
+
# reservation assignments. The expected format is
|
|
1431
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
1432
|
+
#
|
|
1396
1433
|
# @yield [job] a job configuration object
|
|
1397
1434
|
# @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
|
|
1398
1435
|
# configuration object for setting additional options for the query.
|
|
@@ -1565,7 +1602,8 @@ module Google
|
|
|
1565
1602
|
labels: nil,
|
|
1566
1603
|
udfs: nil,
|
|
1567
1604
|
create_session: nil,
|
|
1568
|
-
session_id: nil
|
|
1605
|
+
session_id: nil,
|
|
1606
|
+
reservation: nil
|
|
1569
1607
|
ensure_service!
|
|
1570
1608
|
options = {
|
|
1571
1609
|
params: params,
|
|
@@ -1588,7 +1626,8 @@ module Google
|
|
|
1588
1626
|
labels: labels,
|
|
1589
1627
|
udfs: udfs,
|
|
1590
1628
|
create_session: create_session,
|
|
1591
|
-
session_id: session_id
|
|
1629
|
+
session_id: session_id,
|
|
1630
|
+
reservation: reservation
|
|
1592
1631
|
}
|
|
1593
1632
|
|
|
1594
1633
|
updater = QueryJob::Updater.from_options service, query, options
|
|
@@ -1717,6 +1756,12 @@ module Google
|
|
|
1717
1756
|
# `create_session` param in {#query_job} and {Job#session_id}.
|
|
1718
1757
|
# @param [Boolean] format_options_use_int64_timestamp Output timestamp
|
|
1719
1758
|
# as usec int64. Default is true.
|
|
1759
|
+
# @param [String] reservation The reservation that job would use. User
|
|
1760
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
1761
|
+
# set, reservation is determined based on the rules defined by the
|
|
1762
|
+
# reservation assignments. The expected format is
|
|
1763
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
1764
|
+
#
|
|
1720
1765
|
# @yield [job] a job configuration object
|
|
1721
1766
|
# @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
|
|
1722
1767
|
# configuration object for setting additional options for the query.
|
|
@@ -1872,6 +1917,7 @@ module Google
|
|
|
1872
1917
|
legacy_sql: nil,
|
|
1873
1918
|
session_id: nil,
|
|
1874
1919
|
format_options_use_int64_timestamp: true,
|
|
1920
|
+
reservation: nil,
|
|
1875
1921
|
&block
|
|
1876
1922
|
job = query_job query,
|
|
1877
1923
|
params: params,
|
|
@@ -1881,6 +1927,7 @@ module Google
|
|
|
1881
1927
|
standard_sql: standard_sql,
|
|
1882
1928
|
legacy_sql: legacy_sql,
|
|
1883
1929
|
session_id: session_id,
|
|
1930
|
+
reservation: reservation,
|
|
1884
1931
|
&block
|
|
1885
1932
|
job.wait_until_done!
|
|
1886
1933
|
ensure_job_succeeded! job
|
|
@@ -2099,6 +2146,53 @@ module Google
|
|
|
2099
2146
|
# and the load job will happen in the table created within that session.
|
|
2100
2147
|
# Note: This will work only for _SESSION dataset.
|
|
2101
2148
|
# @param [string] session_id Session ID in which the load job must run.
|
|
2149
|
+
# @param [String] date_format Format used to parse DATE values.
|
|
2150
|
+
# Supports SQL-style format strings. See
|
|
2151
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2152
|
+
# @param [String] datetime_format Format used to parse DATETIME
|
|
2153
|
+
# values. Supports SQL-style format strings. See
|
|
2154
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2155
|
+
# @param [String] time_format Format used to parse TIME values.
|
|
2156
|
+
# Supports SQL-style format strings. See
|
|
2157
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2158
|
+
# @param [String] timestamp_format Format used to parse
|
|
2159
|
+
# TIMESTAMP values. Supports SQL-style format strings. See
|
|
2160
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2161
|
+
# @param [Array<String>] null_markers A list of strings represented as
|
|
2162
|
+
# SQL NULL value in a CSV file. null_marker and null_markers can't be
|
|
2163
|
+
# set at the same time. If null_marker is set, null_markers has to be
|
|
2164
|
+
# not set. If null_markers is set, null_marker has to be not set. If
|
|
2165
|
+
# both null_marker and null_markers are set at the same time, a user
|
|
2166
|
+
# error would be thrown. Any strings listed in null_markers, including
|
|
2167
|
+
# empty string would be interpreted as SQL NULL. This applies to all
|
|
2168
|
+
# column types.
|
|
2169
|
+
# @param [String] source_column_match Controls the strategy used to
|
|
2170
|
+
# match loaded columns to the schema. If not set, a sensible default is
|
|
2171
|
+
# chosen based on how the schema is provided. If autodetect is used,
|
|
2172
|
+
# then columns are matched by name. Otherwise, columns are matched by
|
|
2173
|
+
# position. This is done to keep the behavior backward-compatible.
|
|
2174
|
+
#
|
|
2175
|
+
# Acceptable values are:
|
|
2176
|
+
# * `POSITION` - matches by position. This assumes that the columns are
|
|
2177
|
+
# ordered the same way as the schema.
|
|
2178
|
+
# * `NAME` - matches by name. This reads the header row as column names
|
|
2179
|
+
# and reorders columns to match the field names in the schema.
|
|
2180
|
+
# @param [String] time_zone The time zone used when parsing timestamp
|
|
2181
|
+
# values.
|
|
2182
|
+
# @param [String] reference_file_schema_uri The URI of the reference
|
|
2183
|
+
# file with the reader schema. This file is only loaded if it is part
|
|
2184
|
+
# of source URIs, but is not loaded otherwise. It is enabled for the
|
|
2185
|
+
# following formats: `AVRO`, `PARQUET`, `ORC`.
|
|
2186
|
+
# @param [Boolean] preserve_ascii_control_characters When source_format
|
|
2187
|
+
# is set to `CSV`, indicates if the embedded ASCII control characters
|
|
2188
|
+
# (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
|
|
2189
|
+
# are preserved. By default, ASCII control characters are not
|
|
2190
|
+
# preserved.
|
|
2191
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2192
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2193
|
+
# set, reservation is determined based on the rules defined by the
|
|
2194
|
+
# reservation assignments. The expected format is
|
|
2195
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2102
2196
|
#
|
|
2103
2197
|
# @yield [updater] A block for setting the schema and other
|
|
2104
2198
|
# options for the destination table. The schema can be omitted if the
|
|
@@ -2193,7 +2287,10 @@ module Google
|
|
|
2193
2287
|
def load_job table_id, files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
|
|
2194
2288
|
quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
|
|
2195
2289
|
quote: nil, skip_leading: nil, schema: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
|
|
2196
|
-
null_marker: nil, dryrun: nil, create_session: nil, session_id: nil
|
|
2290
|
+
null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, date_format: nil,
|
|
2291
|
+
datetime_format: nil, time_format: nil, timestamp_format: nil, null_markers: nil,
|
|
2292
|
+
source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
|
|
2293
|
+
preserve_ascii_control_characters: nil, reservation: nil
|
|
2197
2294
|
ensure_service!
|
|
2198
2295
|
|
|
2199
2296
|
updater = load_job_updater table_id,
|
|
@@ -2203,7 +2300,13 @@ module Google
|
|
|
2203
2300
|
max_bad_records: max_bad_records, quote: quote, skip_leading: skip_leading,
|
|
2204
2301
|
dryrun: dryrun, schema: schema, job_id: job_id, prefix: prefix, labels: labels,
|
|
2205
2302
|
autodetect: autodetect, null_marker: null_marker, create_session: create_session,
|
|
2206
|
-
session_id: session_id
|
|
2303
|
+
session_id: session_id, date_format: date_format, datetime_format: datetime_format,
|
|
2304
|
+
time_format: time_format, timestamp_format: timestamp_format,
|
|
2305
|
+
null_markers: null_markers, source_column_match: source_column_match,
|
|
2306
|
+
time_zone: time_zone, reference_file_schema_uri: reference_file_schema_uri,
|
|
2307
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters,
|
|
2308
|
+
reservation: reservation
|
|
2309
|
+
|
|
2207
2310
|
|
|
2208
2311
|
yield updater if block_given?
|
|
2209
2312
|
|
|
@@ -2330,7 +2433,53 @@ module Google
|
|
|
2330
2433
|
# this option. Also note that for most use cases, the block yielded by
|
|
2331
2434
|
# this method is a more convenient way to configure the schema.
|
|
2332
2435
|
# @param [string] session_id Session ID in which the load job must run.
|
|
2333
|
-
#
|
|
2436
|
+
# @param [String] date_format Format used to parse DATE values.
|
|
2437
|
+
# Supports SQL-style format strings. See
|
|
2438
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2439
|
+
# @param [String] datetime_format Format used to parse DATETIME
|
|
2440
|
+
# values. Supports SQL-style format strings. See
|
|
2441
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2442
|
+
# @param [String] time_format Format used to parse TIME values.
|
|
2443
|
+
# Supports SQL-style format strings. See
|
|
2444
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2445
|
+
# @param [String] timestamp_format Format used to parse
|
|
2446
|
+
# TIMESTAMP values. Supports SQL-style format strings. See
|
|
2447
|
+
# [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
|
|
2448
|
+
# @param [Array<String>] null_markers A list of strings represented as
|
|
2449
|
+
# SQL NULL value in a CSV file. null_marker and null_markers can't be
|
|
2450
|
+
# set at the same time. If null_marker is set, null_markers has to be
|
|
2451
|
+
# not set. If null_markers is set, null_marker has to be not set. If
|
|
2452
|
+
# both null_marker and null_markers are set at the same time, a user
|
|
2453
|
+
# error would be thrown. Any strings listed in null_markers, including
|
|
2454
|
+
# empty string would be interpreted as SQL NULL. This applies to all
|
|
2455
|
+
# column types.
|
|
2456
|
+
# @param [String] source_column_match Controls the strategy used to
|
|
2457
|
+
# match loaded columns to the schema. If not set, a sensible default is
|
|
2458
|
+
# chosen based on how the schema is provided. If autodetect is used,
|
|
2459
|
+
# then columns are matched by name. Otherwise, columns are matched by
|
|
2460
|
+
# position. This is done to keep the behavior backward-compatible.
|
|
2461
|
+
#
|
|
2462
|
+
# Acceptable values are:
|
|
2463
|
+
# * `POSITION` - matches by position. This assumes that the columns are
|
|
2464
|
+
# ordered the same way as the schema.
|
|
2465
|
+
# * `NAME` - matches by name. This reads the header row as column names
|
|
2466
|
+
# and reorders columns to match the field names in the schema.
|
|
2467
|
+
# @param [String] time_zone The time zone used when parsing timestamp
|
|
2468
|
+
# values.
|
|
2469
|
+
# @param [String] reference_file_schema_uri The URI of the reference
|
|
2470
|
+
# file with the reader schema. This file is only loaded if it is part
|
|
2471
|
+
# of source URIs, but is not loaded otherwise. It is enabled for the
|
|
2472
|
+
# following formats: `AVRO`, `PARQUET`, `ORC`.
|
|
2473
|
+
# @param [Boolean] preserve_ascii_control_characters When source_format
|
|
2474
|
+
# is set to `CSV`, indicates if the embedded ASCII control characters
|
|
2475
|
+
# (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
|
|
2476
|
+
# are preserved. By default, ASCII control characters are not
|
|
2477
|
+
# preserved.
|
|
2478
|
+
# @param [String] reservation The reservation that job would use. User
|
|
2479
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
2480
|
+
# set, reservation is determined based on the rules defined by the
|
|
2481
|
+
# reservation assignments. The expected format is
|
|
2482
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2334
2483
|
#
|
|
2335
2484
|
# @yield [updater] A block for setting the schema of the destination
|
|
2336
2485
|
# table and other options for the load job. The schema can be omitted
|
|
@@ -2423,13 +2572,22 @@ module Google
|
|
|
2423
2572
|
#
|
|
2424
2573
|
def load table_id, files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
|
|
2425
2574
|
quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
|
|
2426
|
-
quote: nil, skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil,
|
|
2575
|
+
quote: nil, skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil,
|
|
2576
|
+
date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
|
|
2577
|
+
null_markers: nil, source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
|
|
2578
|
+
preserve_ascii_control_characters: nil,
|
|
2579
|
+
reservation: nil, &block
|
|
2427
2580
|
job = load_job table_id, files,
|
|
2428
2581
|
format: format, create: create, write: write, projection_fields: projection_fields,
|
|
2429
2582
|
jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
|
|
2430
2583
|
delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
|
|
2431
2584
|
quote: quote, skip_leading: skip_leading, schema: schema, autodetect: autodetect,
|
|
2432
|
-
null_marker: null_marker, session_id: session_id,
|
|
2585
|
+
null_marker: null_marker, session_id: session_id, date_format: date_format,
|
|
2586
|
+
datetime_format: datetime_format, time_format: time_format, timestamp_format: timestamp_format,
|
|
2587
|
+
null_markers: null_markers, source_column_match: source_column_match, time_zone: time_zone,
|
|
2588
|
+
reference_file_schema_uri: reference_file_schema_uri,
|
|
2589
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters,
|
|
2590
|
+
reservation: reservation, &block
|
|
2433
2591
|
|
|
2434
2592
|
job.wait_until_done!
|
|
2435
2593
|
ensure_job_succeeded! job
|
|
@@ -2930,7 +3088,7 @@ module Google
|
|
|
2930
3088
|
end
|
|
2931
3089
|
end
|
|
2932
3090
|
|
|
2933
|
-
def load_job_gapi table_id, dryrun, job_id: nil, prefix: nil
|
|
3091
|
+
def load_job_gapi table_id, dryrun, job_id: nil, prefix: nil, reservation: nil
|
|
2934
3092
|
job_ref = service.job_ref_from job_id, prefix
|
|
2935
3093
|
Google::Apis::BigqueryV2::Job.new(
|
|
2936
3094
|
job_reference: job_ref,
|
|
@@ -2942,43 +3100,63 @@ module Google
|
|
|
2942
3100
|
table_id: table_id
|
|
2943
3101
|
)
|
|
2944
3102
|
),
|
|
2945
|
-
dry_run: dryrun
|
|
3103
|
+
dry_run: dryrun,
|
|
3104
|
+
reservation: reservation
|
|
2946
3105
|
)
|
|
2947
3106
|
)
|
|
2948
3107
|
end
|
|
2949
3108
|
|
|
2950
3109
|
def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
|
|
2951
|
-
skip_leading: nil, null_marker: nil
|
|
3110
|
+
skip_leading: nil, null_marker: nil, null_markers: nil, source_column_match: nil,
|
|
3111
|
+
preserve_ascii_control_characters: nil
|
|
2952
3112
|
job.jagged_rows = jagged_rows unless jagged_rows.nil?
|
|
2953
3113
|
job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
|
|
2954
3114
|
job.delimiter = delimiter unless delimiter.nil?
|
|
2955
3115
|
job.null_marker = null_marker unless null_marker.nil?
|
|
2956
3116
|
job.quote = quote unless quote.nil?
|
|
2957
3117
|
job.skip_leading = skip_leading unless skip_leading.nil?
|
|
3118
|
+
job.null_markers = null_markers unless null_markers.nil?
|
|
3119
|
+
job.source_column_match = source_column_match unless source_column_match.nil?
|
|
3120
|
+
job.preserve_ascii_control_characters = preserve_ascii_control_characters unless
|
|
3121
|
+
preserve_ascii_control_characters.nil?
|
|
2958
3122
|
end
|
|
2959
3123
|
|
|
2960
3124
|
def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
|
|
2961
3125
|
encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
|
|
2962
|
-
skip_leading: nil, null_marker: nil
|
|
3126
|
+
skip_leading: nil, null_marker: nil, date_format: nil, datetime_format: nil,
|
|
3127
|
+
time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
|
|
3128
|
+
time_zone: nil, reference_file_schema_uri: nil,
|
|
3129
|
+
preserve_ascii_control_characters: nil
|
|
2963
3130
|
job.format = format unless format.nil?
|
|
2964
3131
|
job.projection_fields = projection_fields unless projection_fields.nil?
|
|
2965
3132
|
job.encoding = encoding unless encoding.nil?
|
|
2966
3133
|
job.ignore_unknown = ignore_unknown unless ignore_unknown.nil?
|
|
2967
3134
|
job.max_bad_records = max_bad_records unless max_bad_records.nil?
|
|
3135
|
+
job.date_format = date_format unless date_format.nil?
|
|
3136
|
+
job.datetime_format = datetime_format unless datetime_format.nil?
|
|
3137
|
+
job.time_format = time_format unless time_format.nil?
|
|
3138
|
+
job.timestamp_format = timestamp_format unless timestamp_format.nil?
|
|
3139
|
+
job.time_zone = time_zone unless time_zone.nil?
|
|
3140
|
+
job.reference_file_schema_uri = reference_file_schema_uri unless reference_file_schema_uri.nil?
|
|
2968
3141
|
load_job_csv_options! job, jagged_rows: jagged_rows,
|
|
2969
3142
|
quoted_newlines: quoted_newlines,
|
|
2970
3143
|
delimiter: delimiter,
|
|
2971
3144
|
quote: quote,
|
|
2972
3145
|
skip_leading: skip_leading,
|
|
2973
|
-
null_marker: null_marker
|
|
3146
|
+
null_marker: null_marker,
|
|
3147
|
+
null_markers: null_markers,
|
|
3148
|
+
source_column_match: source_column_match,
|
|
3149
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters
|
|
2974
3150
|
end
|
|
2975
3151
|
|
|
2976
3152
|
def load_job_updater table_id, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
|
|
2977
3153
|
quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil,
|
|
2978
3154
|
max_bad_records: nil, quote: nil, skip_leading: nil, dryrun: nil, schema: nil, job_id: nil,
|
|
2979
3155
|
prefix: nil, labels: nil, autodetect: nil, null_marker: nil, create_session: nil,
|
|
2980
|
-
session_id: nil
|
|
2981
|
-
|
|
3156
|
+
session_id: nil, date_format: nil, datetime_format: nil, time_format: nil,
|
|
3157
|
+
timestamp_format: nil, null_markers: nil, source_column_match: nil, time_zone: nil,
|
|
3158
|
+
reference_file_schema_uri: nil, preserve_ascii_control_characters: nil, reservation: nil
|
|
3159
|
+
new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix, reservation: reservation
|
|
2982
3160
|
LoadJob::Updater.new(new_job).tap do |job|
|
|
2983
3161
|
job.location = location if location # may be dataset reference
|
|
2984
3162
|
job.create = create unless create.nil?
|
|
@@ -2998,7 +3176,16 @@ module Google
|
|
|
2998
3176
|
max_bad_records: max_bad_records,
|
|
2999
3177
|
quote: quote,
|
|
3000
3178
|
skip_leading: skip_leading,
|
|
3001
|
-
null_marker: null_marker
|
|
3179
|
+
null_marker: null_marker,
|
|
3180
|
+
date_format: date_format,
|
|
3181
|
+
datetime_format: datetime_format,
|
|
3182
|
+
time_format: time_format,
|
|
3183
|
+
timestamp_format: timestamp_format,
|
|
3184
|
+
null_markers: null_markers,
|
|
3185
|
+
source_column_match: source_column_match,
|
|
3186
|
+
time_zone: time_zone,
|
|
3187
|
+
reference_file_schema_uri: reference_file_schema_uri,
|
|
3188
|
+
preserve_ascii_control_characters: preserve_ascii_control_characters
|
|
3002
3189
|
end
|
|
3003
3190
|
end
|
|
3004
3191
|
|
|
@@ -280,7 +280,8 @@ module Google
|
|
|
280
280
|
job_reference: job_ref,
|
|
281
281
|
configuration: Google::Apis::BigqueryV2::JobConfiguration.new(
|
|
282
282
|
extract: extract_config,
|
|
283
|
-
dry_run: options[:dryrun]
|
|
283
|
+
dry_run: options[:dryrun],
|
|
284
|
+
reservation: options[:reservation]
|
|
284
285
|
)
|
|
285
286
|
)
|
|
286
287
|
|
|
@@ -438,6 +439,18 @@ module Google
|
|
|
438
439
|
@gapi.configuration.extract.use_avro_logical_types = value
|
|
439
440
|
end
|
|
440
441
|
|
|
442
|
+
##
|
|
443
|
+
# Sets the reservation that job would use. User can specify a reservation
|
|
444
|
+
# to execute the job. If reservation is not set, reservation is determined
|
|
445
|
+
# based on the rules defined by the reservation assignments. The expected
|
|
446
|
+
# format is `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
447
|
+
# @param [String] value The reservation name.
|
|
448
|
+
#
|
|
449
|
+
# @!group Attributes
|
|
450
|
+
def reservation= value
|
|
451
|
+
@gapi.configuration.update! reservation: value
|
|
452
|
+
end
|
|
453
|
+
|
|
441
454
|
def cancel
|
|
442
455
|
raise "not implemented in #{self.class}"
|
|
443
456
|
end
|
|
@@ -737,7 +737,7 @@ module Google
|
|
|
737
737
|
end
|
|
738
738
|
|
|
739
739
|
##
|
|
740
|
-
# The URI of
|
|
740
|
+
# The URI of the reference file with the reader schema. This file is only
|
|
741
741
|
# loaded if it is part of source URIs, but is not loaded otherwise.
|
|
742
742
|
# It is enabled for the following formats: `AVRO`, `PARQUET`, `ORC`.
|
|
743
743
|
#
|
|
@@ -2779,7 +2779,7 @@ module Google
|
|
|
2779
2779
|
|
|
2780
2780
|
##
|
|
2781
2781
|
|
|
2782
|
-
# Sets the URI of
|
|
2782
|
+
# Sets the URI of the reference file with the reader schema. This file
|
|
2783
2783
|
# is only loaded if it is part of source URIs, but is not loaded
|
|
2784
2784
|
# otherwise. It is enabled for the following formats: `AVRO`,
|
|
2785
2785
|
# `PARQUET`, `ORC`.
|
|
@@ -2800,6 +2800,18 @@ module Google
|
|
|
2800
2800
|
@gapi.configuration.load.update! preserve_ascii_control_characters: val
|
|
2801
2801
|
end
|
|
2802
2802
|
|
|
2803
|
+
##
|
|
2804
|
+
# Sets the reservation that job would use. User can specify a reservation
|
|
2805
|
+
# to execute the job. If reservation is not set, reservation is determined
|
|
2806
|
+
# based on the rules defined by the reservation assignments. The expected
|
|
2807
|
+
# format is `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
2808
|
+
# @param [String] value The reservation name.
|
|
2809
|
+
#
|
|
2810
|
+
# @!group Attributes
|
|
2811
|
+
def reservation= value
|
|
2812
|
+
@gapi.configuration.update! reservation: value
|
|
2813
|
+
end
|
|
2814
|
+
|
|
2803
2815
|
def cancel
|
|
2804
2816
|
raise "not implemented in #{self.class}"
|
|
2805
2817
|
end
|
|
@@ -545,6 +545,11 @@ module Google
|
|
|
545
545
|
# * The key portion of a label must be unique. However, you can use the
|
|
546
546
|
# same key with multiple resources.
|
|
547
547
|
# * Keys must start with a lowercase letter or international character.
|
|
548
|
+
# @param [String] reservation The reservation that job would use. User
|
|
549
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
550
|
+
# set, reservation is determined based on the rules defined by the
|
|
551
|
+
# reservation assignments. The expected format is
|
|
552
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
548
553
|
#
|
|
549
554
|
# @yield [job] a job configuration object
|
|
550
555
|
# @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
|
|
@@ -566,9 +571,9 @@ module Google
|
|
|
566
571
|
#
|
|
567
572
|
# @!group Data
|
|
568
573
|
#
|
|
569
|
-
def extract_job extract_url, format: nil, job_id: nil, prefix: nil, labels: nil
|
|
574
|
+
def extract_job extract_url, format: nil, job_id: nil, prefix: nil, labels: nil, reservation: nil
|
|
570
575
|
ensure_service!
|
|
571
|
-
options = { format: format, job_id: job_id, prefix: prefix, labels: labels }
|
|
576
|
+
options = { format: format, job_id: job_id, prefix: prefix, labels: labels, reservation: reservation }
|
|
572
577
|
updater = ExtractJob::Updater.from_options service, model_ref, extract_url, options
|
|
573
578
|
updater.location = location if location # may be model reference
|
|
574
579
|
|
|
@@ -603,6 +608,12 @@ module Google
|
|
|
603
608
|
#
|
|
604
609
|
# * `ml_tf_saved_model` - TensorFlow SavedModel
|
|
605
610
|
# * `ml_xgboost_booster` - XGBoost Booster
|
|
611
|
+
# @param [String] reservation The reservation that job would use. User
|
|
612
|
+
# can specify a reservation to execute the job. If reservation is not
|
|
613
|
+
# set, reservation is determined based on the rules defined by the
|
|
614
|
+
# reservation assignments. The expected format is
|
|
615
|
+
# `projects/`project`/locations/`location`/reservations/`reservation``.
|
|
616
|
+
#
|
|
606
617
|
# @yield [job] a job configuration object
|
|
607
618
|
# @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
|
|
608
619
|
# configuration object for setting additional options.
|
|
@@ -620,8 +631,8 @@ module Google
|
|
|
620
631
|
#
|
|
621
632
|
# @!group Data
|
|
622
633
|
#
|
|
623
|
-
def extract extract_url, format: nil, &block
|
|
624
|
-
job = extract_job extract_url, format: format, &block
|
|
634
|
+
def extract extract_url, format: nil, reservation: nil, &block
|
|
635
|
+
job = extract_job extract_url, format: format, reservation: reservation, &block
|
|
625
636
|
job.wait_until_done!
|
|
626
637
|
ensure_job_succeeded! job
|
|
627
638
|
true
|