google-cloud-bigquery 1.59.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1f6d09bd925b1c1b03aa149fc848ab6e1524207045ef6abb2101f57254f9b5c
4
- data.tar.gz: 28e45683731235e96448f1b4d5eb3e20d14be7966fa0ad7e12f4cf342342dd3d
3
+ metadata.gz: cfd8eb30d69f00bd5456b486ff5fa103b58ef743f7218bab37ec26024c7b8ef2
4
+ data.tar.gz: 35b45c78ebdb2561f5e059ba52c3998232262607bbdbb9240bbe3ec14f738624
5
5
  SHA512:
6
- metadata.gz: 84e4dbca7f7e8194694b7ee127f822fb405d482610f84a6245b994d4b100c91e110a5d60737b9a889dd99cc5c28154bb62c64bff467078d4ced7bd78845dd268
7
- data.tar.gz: ee80b48d42b3a99e2f3cbc4cfb9297ccaa02f2c715bde3221dba31380eac3745822de30c7e50a9b263f3179108b62495238cf155a6bc7f4c6c6e33fb3a05b5e0
6
+ metadata.gz: 715cc0d0301c141f589f8e968fcb1aaa862d036fcf74775184a1a1cfc6c2aa56e35bbf6c5abccabebea5be5ebfca59939905ae56c5985953326167fd712be8ec
7
+ data.tar.gz: fd1c105c9eae04b004176351ead6287d856bc3f4a8c8ecee4ab6931a7b8ae1aded11a3c32faa296af725d0115edb8a793f9bfe9172c6f181ba0432e504dc140e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ### 1.59.0 (2025-09-17)
4
10
 
5
11
  #### 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
@@ -1424,6 +1424,12 @@ module Google
1424
1424
  # The default value is false.
1425
1425
  # @param [String] session_id The ID of an existing session. See also the
1426
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
+ #
1427
1433
  # @yield [job] a job configuration object
1428
1434
  # @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
1429
1435
  # configuration object for setting additional options for the query.
@@ -1596,7 +1602,8 @@ module Google
1596
1602
  labels: nil,
1597
1603
  udfs: nil,
1598
1604
  create_session: nil,
1599
- session_id: nil
1605
+ session_id: nil,
1606
+ reservation: nil
1600
1607
  ensure_service!
1601
1608
  options = {
1602
1609
  params: params,
@@ -1619,7 +1626,8 @@ module Google
1619
1626
  labels: labels,
1620
1627
  udfs: udfs,
1621
1628
  create_session: create_session,
1622
- session_id: session_id
1629
+ session_id: session_id,
1630
+ reservation: reservation
1623
1631
  }
1624
1632
 
1625
1633
  updater = QueryJob::Updater.from_options service, query, options
@@ -1748,6 +1756,12 @@ module Google
1748
1756
  # `create_session` param in {#query_job} and {Job#session_id}.
1749
1757
  # @param [Boolean] format_options_use_int64_timestamp Output timestamp
1750
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
+ #
1751
1765
  # @yield [job] a job configuration object
1752
1766
  # @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
1753
1767
  # configuration object for setting additional options for the query.
@@ -1903,6 +1917,7 @@ module Google
1903
1917
  legacy_sql: nil,
1904
1918
  session_id: nil,
1905
1919
  format_options_use_int64_timestamp: true,
1920
+ reservation: nil,
1906
1921
  &block
1907
1922
  job = query_job query,
1908
1923
  params: params,
@@ -1912,6 +1927,7 @@ module Google
1912
1927
  standard_sql: standard_sql,
1913
1928
  legacy_sql: legacy_sql,
1914
1929
  session_id: session_id,
1930
+ reservation: reservation,
1915
1931
  &block
1916
1932
  job.wait_until_done!
1917
1933
  ensure_job_succeeded! job
@@ -2130,6 +2146,53 @@ module Google
2130
2146
  # and the load job will happen in the table created within that session.
2131
2147
  # Note: This will work only for _SESSION dataset.
2132
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``.
2133
2196
  #
2134
2197
  # @yield [updater] A block for setting the schema and other
2135
2198
  # options for the destination table. The schema can be omitted if the
@@ -2224,7 +2287,10 @@ module Google
2224
2287
  def load_job table_id, files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2225
2288
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2226
2289
  quote: nil, skip_leading: nil, schema: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
2227
- 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
2228
2294
  ensure_service!
2229
2295
 
2230
2296
  updater = load_job_updater table_id,
@@ -2234,7 +2300,13 @@ module Google
2234
2300
  max_bad_records: max_bad_records, quote: quote, skip_leading: skip_leading,
2235
2301
  dryrun: dryrun, schema: schema, job_id: job_id, prefix: prefix, labels: labels,
2236
2302
  autodetect: autodetect, null_marker: null_marker, create_session: create_session,
2237
- 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
+
2238
2310
 
2239
2311
  yield updater if block_given?
2240
2312
 
@@ -2361,7 +2433,53 @@ module Google
2361
2433
  # this option. Also note that for most use cases, the block yielded by
2362
2434
  # this method is a more convenient way to configure the schema.
2363
2435
  # @param [string] session_id Session ID in which the load job must run.
2364
- #
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``.
2365
2483
  #
2366
2484
  # @yield [updater] A block for setting the schema of the destination
2367
2485
  # table and other options for the load job. The schema can be omitted
@@ -2454,13 +2572,22 @@ module Google
2454
2572
  #
2455
2573
  def load table_id, files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2456
2574
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2457
- quote: nil, skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil, &block
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
2458
2580
  job = load_job table_id, files,
2459
2581
  format: format, create: create, write: write, projection_fields: projection_fields,
2460
2582
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
2461
2583
  delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
2462
2584
  quote: quote, skip_leading: skip_leading, schema: schema, autodetect: autodetect,
2463
- null_marker: null_marker, session_id: session_id, &block
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
2464
2591
 
2465
2592
  job.wait_until_done!
2466
2593
  ensure_job_succeeded! job
@@ -2961,7 +3088,7 @@ module Google
2961
3088
  end
2962
3089
  end
2963
3090
 
2964
- 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
2965
3092
  job_ref = service.job_ref_from job_id, prefix
2966
3093
  Google::Apis::BigqueryV2::Job.new(
2967
3094
  job_reference: job_ref,
@@ -2973,43 +3100,63 @@ module Google
2973
3100
  table_id: table_id
2974
3101
  )
2975
3102
  ),
2976
- dry_run: dryrun
3103
+ dry_run: dryrun,
3104
+ reservation: reservation
2977
3105
  )
2978
3106
  )
2979
3107
  end
2980
3108
 
2981
3109
  def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
2982
- 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
2983
3112
  job.jagged_rows = jagged_rows unless jagged_rows.nil?
2984
3113
  job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
2985
3114
  job.delimiter = delimiter unless delimiter.nil?
2986
3115
  job.null_marker = null_marker unless null_marker.nil?
2987
3116
  job.quote = quote unless quote.nil?
2988
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?
2989
3122
  end
2990
3123
 
2991
3124
  def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
2992
3125
  encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
2993
- 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
2994
3130
  job.format = format unless format.nil?
2995
3131
  job.projection_fields = projection_fields unless projection_fields.nil?
2996
3132
  job.encoding = encoding unless encoding.nil?
2997
3133
  job.ignore_unknown = ignore_unknown unless ignore_unknown.nil?
2998
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?
2999
3141
  load_job_csv_options! job, jagged_rows: jagged_rows,
3000
3142
  quoted_newlines: quoted_newlines,
3001
3143
  delimiter: delimiter,
3002
3144
  quote: quote,
3003
3145
  skip_leading: skip_leading,
3004
- 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
3005
3150
  end
3006
3151
 
3007
3152
  def load_job_updater table_id, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
3008
3153
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil,
3009
3154
  max_bad_records: nil, quote: nil, skip_leading: nil, dryrun: nil, schema: nil, job_id: nil,
3010
3155
  prefix: nil, labels: nil, autodetect: nil, null_marker: nil, create_session: nil,
3011
- session_id: nil
3012
- new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix
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
3013
3160
  LoadJob::Updater.new(new_job).tap do |job|
3014
3161
  job.location = location if location # may be dataset reference
3015
3162
  job.create = create unless create.nil?
@@ -3029,7 +3176,16 @@ module Google
3029
3176
  max_bad_records: max_bad_records,
3030
3177
  quote: quote,
3031
3178
  skip_leading: skip_leading,
3032
- 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
3033
3189
  end
3034
3190
  end
3035
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 thereference file with the reader schema. This file is only
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 thereference file with the reader schema. This file
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
@@ -178,6 +178,12 @@ module Google
178
178
  # * The key portion of a label must be unique. However, you can use the
179
179
  # same key with multiple resources.
180
180
  # * Keys must start with a lowercase letter or international character.
181
+ # @param [String] reservation The reservation that job would use. User
182
+ # can specify a reservation to execute the job. If reservation is not
183
+ # set, reservation is determined based on the rules defined by the
184
+ # reservation assignments. The expected format is
185
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
186
+ #
181
187
  # @yield [job] a job configuration object
182
188
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
183
189
  # configuration object for setting additional options.
@@ -199,9 +205,11 @@ module Google
199
205
  #
200
206
  # @!group Data
201
207
  #
202
- def copy_job source_table, destination_table, create: nil, write: nil, job_id: nil, prefix: nil, labels: nil
208
+ def copy_job source_table, destination_table, create: nil, write: nil, job_id: nil, prefix: nil, labels: nil,
209
+ reservation: nil
203
210
  ensure_service!
204
- options = { create: create, write: write, labels: labels, job_id: job_id, prefix: prefix }
211
+ options = { create: create, write: write, labels: labels, job_id: job_id, prefix: prefix,
212
+ reservation: reservation }
205
213
 
206
214
  updater = CopyJob::Updater.from_options(
207
215
  service,
@@ -258,6 +266,12 @@ module Google
258
266
  # * `append` - BigQuery appends the data to the table.
259
267
  # * `empty` - An error will be returned if the destination table
260
268
  # already contains data.
269
+ # @param [String] reservation The reservation that job would use. User
270
+ # can specify a reservation to execute the job. If reservation is not
271
+ # set, reservation is determined based on the rules defined by the
272
+ # reservation assignments. The expected format is
273
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
274
+ #
261
275
  # @yield [job] a job configuration object
262
276
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
263
277
  # configuration object for setting additional options.
@@ -276,8 +290,8 @@ module Google
276
290
  #
277
291
  # @!group Data
278
292
  #
279
- def copy source_table, destination_table, create: nil, write: nil, &block
280
- job = copy_job source_table, destination_table, create: create, write: write, &block
293
+ def copy source_table, destination_table, create: nil, write: nil, reservation: nil, &block
294
+ job = copy_job source_table, destination_table, create: create, write: write, reservation: reservation, &block
281
295
  job.wait_until_done!
282
296
  ensure_job_succeeded! job
283
297
  true
@@ -479,6 +493,12 @@ module Google
479
493
  # The default value is false.
480
494
  # @param [String] session_id The ID of an existing session. See also the
481
495
  # `create_session` param and {Job#session_id}.
496
+ # @param [String] reservation The reservation that job would use. User
497
+ # can specify a reservation to execute the job. If reservation is not
498
+ # set, reservation is determined based on the rules defined by the
499
+ # reservation assignments. The expected format is
500
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
501
+ #
482
502
  # @yield [job] a job configuration object
483
503
  # @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
484
504
  # configuration object for setting query options.
@@ -631,7 +651,8 @@ module Google
631
651
  labels: nil,
632
652
  udfs: nil,
633
653
  create_session: nil,
634
- session_id: nil
654
+ session_id: nil,
655
+ reservation: nil
635
656
  ensure_service!
636
657
  project ||= self.project
637
658
  options = {
@@ -657,7 +678,8 @@ module Google
657
678
  labels: labels,
658
679
  udfs: udfs,
659
680
  create_session: create_session,
660
- session_id: session_id
681
+ session_id: session_id,
682
+ reservation: reservation
661
683
  }
662
684
 
663
685
  updater = QueryJob::Updater.from_options service, query, options
@@ -785,6 +807,11 @@ module Google
785
807
  # `create_session` param in {#query_job} and {Job#session_id}.
786
808
  # @param [Boolean] format_options_use_int64_timestamp Output timestamp
787
809
  # as usec int64. Default is true.
810
+ # @param [String] reservation The reservation that job would use. User
811
+ # can specify a reservation to execute the job. If reservation is not
812
+ # set, reservation is determined based on the rules defined by the
813
+ # reservation assignments. The expected format is
814
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
788
815
  #
789
816
  # @yield [job] a job configuration object
790
817
  # @yieldparam [Google::Cloud::Bigquery::QueryJob::Updater] job a job
@@ -933,6 +960,7 @@ module Google
933
960
  legacy_sql: nil,
934
961
  session_id: nil,
935
962
  format_options_use_int64_timestamp: true,
963
+ reservation: nil,
936
964
  &block
937
965
  job = query_job query,
938
966
  params: params,
@@ -944,6 +972,7 @@ module Google
944
972
  standard_sql: standard_sql,
945
973
  legacy_sql: legacy_sql,
946
974
  session_id: session_id,
975
+ reservation: reservation,
947
976
  &block
948
977
  job.wait_until_done!
949
978
 
@@ -1152,6 +1181,20 @@ module Google
1152
1181
  # and reorders columns to match the field names in the schema.
1153
1182
  # @param [String] time_zone The time zone used when parsing timestamp
1154
1183
  # values.
1184
+ # @param [String] reference_file_schema_uri The URI of the reference
1185
+ # file with the reader schema. This file is only loaded if it is part
1186
+ # of source URIs, but is not loaded otherwise. It is enabled for the
1187
+ # following formats: `AVRO`, `PARQUET`, `ORC`.
1188
+ # @param [Boolean] preserve_ascii_control_characters When source_format
1189
+ # is set to `CSV`, indicates if the embedded ASCII control characters
1190
+ # (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
1191
+ # are preserved. By default, ASCII control characters are not
1192
+ # preserved.
1193
+ # @param [String] reservation The reservation that job would use. User
1194
+ # can specify a reservation to execute the job. If reservation is not
1195
+ # set, reservation is determined based on the rules defined by the
1196
+ # reservation assignments. The expected format is
1197
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
1155
1198
  #
1156
1199
  # @yield [updater] A block for setting the schema and other
1157
1200
  # options for the destination table. The schema can be omitted if the
@@ -1178,7 +1221,8 @@ module Google
1178
1221
  skip_leading: nil, schema: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
1179
1222
  null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, project_id: nil,
1180
1223
  date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
1181
- null_markers: nil, source_column_match: nil, time_zone: nil, &block
1224
+ null_markers: nil, source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
1225
+ preserve_ascii_control_characters: nil, reservation: nil, &block
1182
1226
  ensure_service!
1183
1227
  dataset_id ||= "_SESSION" unless create_session.nil? && session_id.nil?
1184
1228
  session_dataset = dataset dataset_id, skip_lookup: true, project_id: project_id
@@ -1193,7 +1237,9 @@ module Google
1193
1237
  session_id: session_id, date_format: date_format, datetime_format: datetime_format,
1194
1238
  time_format: time_format, timestamp_format: timestamp_format,
1195
1239
  null_markers: null_markers, source_column_match: source_column_match,
1196
- time_zone: time_zone, &block
1240
+ time_zone: time_zone, reference_file_schema_uri: reference_file_schema_uri,
1241
+ preserve_ascii_control_characters: preserve_ascii_control_characters,
1242
+ reservation: reservation, &block
1197
1243
  end
1198
1244
 
1199
1245
  ##
@@ -1348,6 +1394,20 @@ module Google
1348
1394
  # and reorders columns to match the field names in the schema.
1349
1395
  # @param [String] time_zone The time zone used when parsing timestamp
1350
1396
  # values.
1397
+ # @param [String] reference_file_schema_uri The URI of the reference
1398
+ # file with the reader schema. This file is only loaded if it is part
1399
+ # of source URIs, but is not loaded otherwise. It is enabled for the
1400
+ # following formats: `AVRO`, `PARQUET`, `ORC`.
1401
+ # @param [Boolean] preserve_ascii_control_characters When source_format
1402
+ # is set to `CSV`, indicates if the embedded ASCII control characters
1403
+ # (the first 32 characters in the ASCII-table, from `\x00` to `\x1F`)
1404
+ # are preserved. By default, ASCII control characters are not
1405
+ # preserved.
1406
+ # @param [String] reservation The reservation that job would use. User
1407
+ # can specify a reservation to execute the job. If reservation is not
1408
+ # set, reservation is determined based on the rules defined by the
1409
+ # reservation assignments. The expected format is
1410
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
1351
1411
  #
1352
1412
  # @yield [updater] A block for setting the schema of the destination
1353
1413
  # table and other options for the load job. The schema can be omitted
@@ -1379,7 +1439,8 @@ module Google
1379
1439
  delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
1380
1440
  skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil,
1381
1441
  date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
1382
- null_markers: nil, source_column_match: nil, time_zone: nil, &block
1442
+ null_markers: nil, source_column_match: nil, time_zone: nil, reference_file_schema_uri: nil,
1443
+ preserve_ascii_control_characters: nil, reservation: nil, &block
1383
1444
  job = load_job table_id, files, dataset_id: dataset_id,
1384
1445
  format: format, create: create, write: write, projection_fields: projection_fields,
1385
1446
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
@@ -1388,7 +1449,10 @@ module Google
1388
1449
  null_marker: null_marker, session_id: session_id, date_format: date_format,
1389
1450
  datetime_format: datetime_format, time_format: time_format,
1390
1451
  timestamp_format: timestamp_format, null_markers: null_markers,
1391
- source_column_match: source_column_match, time_zone: time_zone, &block
1452
+ source_column_match: source_column_match, time_zone: time_zone,
1453
+ reference_file_schema_uri: reference_file_schema_uri,
1454
+ preserve_ascii_control_characters: preserve_ascii_control_characters, reservation: reservation,
1455
+ &block
1392
1456
 
1393
1457
  job.wait_until_done!
1394
1458
  ensure_job_succeeded! job
@@ -2091,6 +2155,12 @@ module Google
2091
2155
  # * The key portion of a label must be unique. However, you can use the
2092
2156
  # same key with multiple resources.
2093
2157
  # * Keys must start with a lowercase letter or international character.
2158
+ # @param [String] reservation The reservation that job would use. User
2159
+ # can specify a reservation to execute the job. If reservation is not
2160
+ # set, reservation is determined based on the rules defined by the
2161
+ # reservation assignments. The expected format is
2162
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
2163
+ #
2094
2164
  # @yield [job] a job configuration object
2095
2165
  # @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
2096
2166
  # configuration object for setting additional options.
@@ -2119,10 +2189,10 @@ module Google
2119
2189
  # @!group Data
2120
2190
  #
2121
2191
  def extract_job source, extract_url, format: nil, compression: nil, delimiter: nil, header: nil, job_id: nil,
2122
- prefix: nil, labels: nil
2192
+ prefix: nil, labels: nil, reservation: nil
2123
2193
  ensure_service!
2124
2194
  options = { format: format, compression: compression, delimiter: delimiter, header: header, job_id: job_id,
2125
- prefix: prefix, labels: labels }
2195
+ prefix: prefix, labels: labels, reservation: reservation }
2126
2196
  source_ref = if source.respond_to? :model_ref
2127
2197
  source.model_ref
2128
2198
  else
@@ -2189,6 +2259,12 @@ module Google
2189
2259
  # models.
2190
2260
  # @param [Boolean] header Whether to print out a header row in table
2191
2261
  # exports. Default is `true`. Not applicable when extracting models.
2262
+ # @param [String] reservation The reservation that job would use. User
2263
+ # can specify a reservation to execute the job. If reservation is not
2264
+ # set, reservation is determined based on the rules defined by the
2265
+ # reservation assignments. The expected format is
2266
+ # `projects/`project`/locations/`location`/reservations/`reservation``.
2267
+ #
2192
2268
  # @yield [job] a job configuration object
2193
2269
  # @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
2194
2270
  # configuration object for setting additional options.
@@ -2214,12 +2290,14 @@ module Google
2214
2290
  #
2215
2291
  # @!group Data
2216
2292
  #
2217
- def extract source, extract_url, format: nil, compression: nil, delimiter: nil, header: nil, &block
2293
+ def extract source, extract_url, format: nil, compression: nil, delimiter: nil, header: nil, reservation: nil,
2294
+ &block
2218
2295
  job = extract_job source, extract_url,
2219
2296
  format: format,
2220
2297
  compression: compression,
2221
2298
  delimiter: delimiter,
2222
2299
  header: header,
2300
+ reservation: reservation,
2223
2301
  &block
2224
2302
  job.wait_until_done!
2225
2303
  ensure_job_succeeded! job
@@ -792,7 +792,8 @@ module Google
792
792
  query: query,
793
793
  default_dataset: dataset_config,
794
794
  maximum_billing_tier: options[:maximum_billing_tier]
795
- )
795
+ ),
796
+ reservation: options[:reservation]
796
797
  )
797
798
  )
798
799
 
@@ -1596,6 +1597,18 @@ module Google
1596
1597
  @gapi.configuration.query.clustering.fields = fields
1597
1598
  end
1598
1599
 
1600
+ ##
1601
+ # Sets the reservation that job would use. User can specify a reservation
1602
+ # to execute the job. If reservation is not set, reservation is determined
1603
+ # based on the rules defined by the reservation assignments. The expected
1604
+ # format is `projects/`project`/locations/`location`/reservations/`reservation``.
1605
+ # @param [String] value The reservation name.
1606
+ #
1607
+ # @!group Attributes
1608
+ def reservation= value
1609
+ @gapi.configuration.update! reservation: value
1610
+ end
1611
+
1599
1612
  def cancel
1600
1613
  raise "not implemented in #{self.class}"
1601
1614
  end
@@ -1848,6 +1848,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1848
1848
  # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1849
1849
  # is undefined however for non-query jobs and may result in an error.
1850
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``.
1851
1857
  #
1852
1858
  # @yield [job] a job configuration object
1853
1859
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
@@ -1880,7 +1886,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1880
1886
  # @!group Data
1881
1887
  #
1882
1888
  def copy_job destination_table, create: nil, write: nil, job_id: nil, prefix: nil, labels: nil, dryrun: nil,
1883
- operation_type: nil
1889
+ operation_type: nil, reservation: nil
1884
1890
  ensure_service!
1885
1891
  options = { create: create,
1886
1892
  write: write,
@@ -1888,7 +1894,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1888
1894
  labels: labels,
1889
1895
  job_id: job_id,
1890
1896
  prefix: prefix,
1891
- operation_type: operation_type }
1897
+ operation_type: operation_type,
1898
+ reservation: reservation }
1892
1899
  updater = CopyJob::Updater.from_options(
1893
1900
  service,
1894
1901
  table_ref,
@@ -1941,6 +1948,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1941
1948
  # * `append` - BigQuery appends the data to the table.
1942
1949
  # * `empty` - An error will be returned if the destination table
1943
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
+ #
1944
1957
  # @yield [job] a job configuration object
1945
1958
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
1946
1959
  # configuration object for setting additional options.
@@ -1968,11 +1981,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1968
1981
  #
1969
1982
  # @!group Data
1970
1983
  #
1971
- def copy destination_table, create: nil, write: nil, &block
1984
+ def copy destination_table, create: nil, write: nil, reservation: nil, &block
1972
1985
  copy_job_with_operation_type destination_table,
1973
1986
  create: create,
1974
1987
  write: write,
1975
1988
  operation_type: OperationType::COPY,
1989
+ reservation: reservation,
1976
1990
  &block
1977
1991
  end
1978
1992
 
@@ -1998,6 +2012,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1998
2012
  # Reference](https://cloud.google.com/bigquery/query-reference#from)
1999
2013
  # (`project-name:dataset_id.table_id`). This is useful for referencing
2000
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``.
2001
2020
  #
2002
2021
  # @yield [job] a job configuration object
2003
2022
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
@@ -2026,9 +2045,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2026
2045
  #
2027
2046
  # @!group Data
2028
2047
  #
2029
- def clone destination_table, &block
2048
+ def clone destination_table, reservation: nil, &block
2030
2049
  copy_job_with_operation_type destination_table,
2031
2050
  operation_type: OperationType::CLONE,
2051
+ reservation: reservation,
2032
2052
  &block
2033
2053
  end
2034
2054
 
@@ -2053,6 +2073,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2053
2073
  # Reference](https://cloud.google.com/bigquery/query-reference#from)
2054
2074
  # (`project-name:dataset_id.table_id`). This is useful for referencing
2055
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``.
2056
2081
  #
2057
2082
  # @yield [job] a job configuration object
2058
2083
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
@@ -2081,9 +2106,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2081
2106
  #
2082
2107
  # @!group Data
2083
2108
  #
2084
- def snapshot destination_table, &block
2109
+ def snapshot destination_table, reservation: nil, &block
2085
2110
  copy_job_with_operation_type destination_table,
2086
2111
  operation_type: OperationType::SNAPSHOT,
2112
+ reservation: reservation,
2087
2113
  &block
2088
2114
  end
2089
2115
 
@@ -2125,6 +2151,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2125
2151
  # * `append` - BigQuery appends the data to the table.
2126
2152
  # * `empty` - An error will be returned if the destination table
2127
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
+ #
2128
2160
  # @yield [job] a job configuration object
2129
2161
  # @yieldparam [Google::Cloud::Bigquery::CopyJob::Updater] job a job
2130
2162
  # configuration object for setting additional options.
@@ -2152,11 +2184,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2152
2184
  #
2153
2185
  # @!group Data
2154
2186
  #
2155
- def restore destination_table, create: nil, write: nil, &block
2187
+ def restore destination_table, create: nil, write: nil, reservation: nil, &block
2156
2188
  copy_job_with_operation_type destination_table,
2157
2189
  create: create,
2158
2190
  write: write,
2159
2191
  operation_type: OperationType::RESTORE,
2192
+ reservation: reservation,
2160
2193
  &block
2161
2194
  end
2162
2195
 
@@ -2229,6 +2262,11 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2229
2262
  # @param [Boolean] dryrun If set, don't actually run this job. Behavior
2230
2263
  # is undefined however for non-query jobs and may result in an error.
2231
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``.
2232
2270
  #
2233
2271
  # @yield [job] a job configuration object
2234
2272
  # @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
@@ -2251,10 +2289,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2251
2289
  # @!group Data
2252
2290
  #
2253
2291
  def extract_job extract_url, format: nil, compression: nil, delimiter: nil, header: nil, job_id: nil,
2254
- prefix: nil, labels: nil, dryrun: nil
2292
+ prefix: nil, labels: nil, dryrun: nil, reservation: nil
2255
2293
  ensure_service!
2256
2294
  options = { format: format, compression: compression, delimiter: delimiter, header: header, dryrun: dryrun,
2257
- job_id: job_id, prefix: prefix, labels: labels }
2295
+ job_id: job_id, prefix: prefix, labels: labels, reservation: reservation }
2258
2296
  updater = ExtractJob::Updater.from_options service, table_ref, extract_url, options
2259
2297
  updater.location = location if location # may be table reference
2260
2298
 
@@ -2298,6 +2336,12 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2298
2336
  # exported data. Default is <code>,</code>.
2299
2337
  # @param [Boolean] header Whether to print out a header row in the
2300
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
+ #
2301
2345
  # @yield [job] a job configuration object
2302
2346
  # @yieldparam [Google::Cloud::Bigquery::ExtractJob::Updater] job a job
2303
2347
  # configuration object for setting additional options.
@@ -2326,12 +2370,13 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2326
2370
  #
2327
2371
  # @!group Data
2328
2372
  #
2329
- 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
2330
2374
  job = extract_job extract_url,
2331
2375
  format: format,
2332
2376
  compression: compression,
2333
2377
  delimiter: delimiter,
2334
2378
  header: header,
2379
+ reservation: reservation,
2335
2380
  &block
2336
2381
  job.wait_until_done!
2337
2382
  ensure_job_succeeded! job
@@ -2515,6 +2560,20 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2515
2560
  # and reorders columns to match the field names in the schema.
2516
2561
  # @param [String] time_zone The time zone used when parsing timestamp
2517
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``.
2518
2577
  #
2519
2578
  # @yield [load_job] a block for setting the load job
2520
2579
  # @yieldparam [LoadJob] load_job the load job object to be updated
@@ -2573,7 +2632,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2573
2632
  quote: nil, skip_leading: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
2574
2633
  null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema,
2575
2634
  date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2576
- 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
2577
2637
  ensure_service!
2578
2638
 
2579
2639
  updater = load_job_updater format: format, create: create, write: write, projection_fields: projection_fields,
@@ -2585,7 +2645,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2585
2645
  session_id: session_id, date_format: date_format,
2586
2646
  datetime_format: datetime_format, time_format: time_format,
2587
2647
  timestamp_format: timestamp_format, null_markers: null_markers,
2588
- 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
2589
2652
 
2590
2653
  yield updater if block_given?
2591
2654
 
@@ -2734,6 +2797,20 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2734
2797
  # and reorders columns to match the field names in the schema.
2735
2798
  # @param [String] time_zone The time zone used when parsing timestamp
2736
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``.
2737
2814
  #
2738
2815
  # @yield [updater] A block for setting the schema of the destination
2739
2816
  # table and other options for the load job. The schema can be omitted
@@ -2797,7 +2874,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2797
2874
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2798
2875
  quote: nil, skip_leading: nil, autodetect: nil, null_marker: nil, session_id: nil,
2799
2876
  schema: self.schema, date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2800
- null_markers: nil, source_column_match: nil, time_zone: nil, &block
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
2801
2879
  job = load_job files, format: format, create: create, write: write, projection_fields: projection_fields,
2802
2880
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
2803
2881
  delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
@@ -2805,7 +2883,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2805
2883
  null_marker: null_marker, session_id: session_id, schema: schema,
2806
2884
  date_format: date_format, datetime_format: datetime_format, time_format: time_format,
2807
2885
  timestamp_format: timestamp_format, null_markers: null_markers,
2808
- source_column_match: source_column_match, time_zone: time_zone, &block
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
2809
2890
 
2810
2891
  job.wait_until_done!
2811
2892
  ensure_job_succeeded! job
@@ -3199,11 +3280,13 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3199
3280
 
3200
3281
  protected
3201
3282
 
3202
- def copy_job_with_operation_type destination_table, create: nil, write: nil, operation_type: nil, &block
3283
+ def copy_job_with_operation_type destination_table, create: nil, write: nil, operation_type: nil,
3284
+ reservation: nil, &block
3203
3285
  job = copy_job destination_table,
3204
3286
  create: create,
3205
3287
  write: write,
3206
3288
  operation_type: operation_type,
3289
+ reservation: reservation,
3207
3290
  &block
3208
3291
  job.wait_until_done!
3209
3292
  ensure_job_succeeded! job
@@ -3254,7 +3337,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3254
3337
  end
3255
3338
  end
3256
3339
 
3257
- 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
3258
3341
  job_ref = service.job_ref_from job_id, prefix
3259
3342
  Google::Apis::BigqueryV2::Job.new(
3260
3343
  job_reference: job_ref,
@@ -3266,13 +3349,15 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3266
3349
  table_id: table_id
3267
3350
  )
3268
3351
  ),
3269
- dry_run: dryrun
3352
+ dry_run: dryrun,
3353
+ reservation: reservation
3270
3354
  )
3271
3355
  )
3272
3356
  end
3273
3357
 
3274
3358
  def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
3275
- 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
3276
3361
  job.jagged_rows = jagged_rows unless jagged_rows.nil?
3277
3362
  job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
3278
3363
  job.delimiter = delimiter unless delimiter.nil?
@@ -3281,13 +3366,16 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3281
3366
  job.skip_leading = skip_leading unless skip_leading.nil?
3282
3367
  job.null_markers = null_markers unless null_markers.nil?
3283
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?
3284
3371
  end
3285
3372
 
3286
3373
  def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
3287
3374
  encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
3288
3375
  skip_leading: nil, null_marker: nil, date_format: nil, datetime_format: nil,
3289
3376
  time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3290
- time_zone: nil
3377
+ time_zone: nil, reference_file_schema_uri: nil,
3378
+ preserve_ascii_control_characters: nil
3291
3379
  job.format = format unless format.nil?
3292
3380
  job.projection_fields = projection_fields unless projection_fields.nil?
3293
3381
  job.encoding = encoding unless encoding.nil?
@@ -3298,6 +3386,7 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3298
3386
  job.time_format = time_format unless time_format.nil?
3299
3387
  job.timestamp_format = timestamp_format unless timestamp_format.nil?
3300
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?
3301
3390
  load_job_csv_options! job, jagged_rows: jagged_rows,
3302
3391
  quoted_newlines: quoted_newlines,
3303
3392
  delimiter: delimiter,
@@ -3305,7 +3394,8 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3305
3394
  skip_leading: skip_leading,
3306
3395
  null_marker: null_marker,
3307
3396
  null_markers: null_markers,
3308
- source_column_match: source_column_match
3397
+ source_column_match: source_column_match,
3398
+ preserve_ascii_control_characters: preserve_ascii_control_characters
3309
3399
  end
3310
3400
 
3311
3401
  def load_job_updater format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
@@ -3314,8 +3404,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3314
3404
  prefix: nil, labels: nil, autodetect: nil, null_marker: nil,
3315
3405
  create_session: nil, session_id: nil, date_format: nil, datetime_format: nil,
3316
3406
  time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3317
- time_zone: nil
3318
- new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix
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
3319
3410
  LoadJob::Updater.new(new_job).tap do |job|
3320
3411
  job.location = location if location # may be table reference
3321
3412
  job.create = create unless create.nil?
@@ -3342,7 +3433,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3342
3433
  timestamp_format: timestamp_format,
3343
3434
  null_markers: null_markers,
3344
3435
  source_column_match: source_column_match,
3345
- 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
3346
3439
  end
3347
3440
  end
3348
3441
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.59.0".freeze
19
+ VERSION = "1.60.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.59.0
4
+ version: 1.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore