google-cloud-bigquery 1.54.0 → 1.57.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.
@@ -109,29 +109,29 @@ module Google
109
109
 
110
110
  ##
111
111
  # Returns the dataset specified by datasetID.
112
- def get_dataset dataset_id
113
- get_project_dataset @project, dataset_id
112
+ def get_dataset dataset_id, access_policy_version: nil
113
+ get_project_dataset @project, dataset_id, access_policy_version: access_policy_version
114
114
  end
115
115
 
116
116
  ##
117
117
  # Gets the specified dataset resource by full dataset reference.
118
- def get_project_dataset project_id, dataset_id
118
+ def get_project_dataset project_id, dataset_id, access_policy_version: nil
119
119
  # The get operation is considered idempotent
120
120
  execute backoff: true do
121
- service.get_dataset project_id, dataset_id
121
+ service.get_dataset project_id, dataset_id, access_policy_version: access_policy_version
122
122
  end
123
123
  end
124
124
 
125
125
  ##
126
126
  # Creates a new empty dataset.
127
- def insert_dataset new_dataset_gapi
128
- execute { service.insert_dataset @project, new_dataset_gapi }
127
+ def insert_dataset new_dataset_gapi, access_policy_version: nil
128
+ execute { service.insert_dataset @project, new_dataset_gapi, access_policy_version: access_policy_version }
129
129
  end
130
130
 
131
131
  ##
132
132
  # Updates information in an existing dataset, only replacing
133
133
  # fields that are provided in the submitted dataset resource.
134
- def patch_dataset dataset_id, patched_dataset_gapi
134
+ def patch_dataset dataset_id, patched_dataset_gapi, access_policy_version: nil
135
135
  patch_with_backoff = false
136
136
  options = {}
137
137
  if patched_dataset_gapi.etag
@@ -140,7 +140,8 @@ module Google
140
140
  patch_with_backoff = true
141
141
  end
142
142
  execute backoff: patch_with_backoff do
143
- service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options
143
+ service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options,
144
+ access_policy_version: access_policy_version
144
145
  end
145
146
  end
146
147
 
@@ -2451,6 +2451,39 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2451
2451
  # Note: This will work only for tables in _SESSION dataset
2452
2452
  # else the property will be ignored by the backend.
2453
2453
  # @param [string] session_id Session ID in which the load job must run.
2454
+ # @param [String] date_format Format used to parse DATE values.
2455
+ # Supports SQL-style format strings. See
2456
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2457
+ # @param [String] datetime_format Format used to parse DATETIME
2458
+ # values. Supports SQL-style format strings. See
2459
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2460
+ # @param [String] time_format Format used to parse TIME values.
2461
+ # Supports SQL-style format strings. See
2462
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2463
+ # @param [String] timestamp_format Format used to parse
2464
+ # TIMESTAMP values. Supports SQL-style format strings. See
2465
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2466
+ # @param [Array<String>] null_markers A list of strings represented as
2467
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
2468
+ # set at the same time. If null_marker is set, null_markers has to be
2469
+ # not set. If null_markers is set, null_marker has to be not set. If
2470
+ # both null_marker and null_markers are set at the same time, a user
2471
+ # error would be thrown. Any strings listed in null_markers, including
2472
+ # empty string would be interpreted as SQL NULL. This applies to all
2473
+ # column types.
2474
+ # @param [String] source_column_match Controls the strategy used to
2475
+ # match loaded columns to the schema. If not set, a sensible default is
2476
+ # chosen based on how the schema is provided. If autodetect is used,
2477
+ # then columns are matched by name. Otherwise, columns are matched by
2478
+ # position. This is done to keep the behavior backward-compatible.
2479
+ #
2480
+ # Acceptable values are:
2481
+ # * `POSITION` - matches by position. This assumes that the columns are
2482
+ # ordered the same way as the schema.
2483
+ # * `NAME` - matches by name. This reads the header row as column names
2484
+ # and reorders columns to match the field names in the schema.
2485
+ # @param [String] time_zone The time zone used when parsing timestamp
2486
+ # values.
2454
2487
  #
2455
2488
  # @yield [load_job] a block for setting the load job
2456
2489
  # @yieldparam [LoadJob] load_job the load job object to be updated
@@ -2507,7 +2540,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2507
2540
  def load_job files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2508
2541
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2509
2542
  quote: nil, skip_leading: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
2510
- null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema
2543
+ null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema,
2544
+ date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2545
+ null_markers: nil, source_column_match: nil, time_zone: nil
2511
2546
  ensure_service!
2512
2547
 
2513
2548
  updater = load_job_updater format: format, create: create, write: write, projection_fields: projection_fields,
@@ -2516,8 +2551,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2516
2551
  max_bad_records: max_bad_records, quote: quote, skip_leading: skip_leading,
2517
2552
  dryrun: dryrun, job_id: job_id, prefix: prefix, schema: schema, labels: labels,
2518
2553
  autodetect: autodetect, null_marker: null_marker, create_session: create_session,
2519
- session_id: session_id
2520
-
2554
+ session_id: session_id, date_format: date_format,
2555
+ datetime_format: datetime_format, time_format: time_format,
2556
+ timestamp_format: timestamp_format, null_markers: null_markers,
2557
+ source_column_match: source_column_match, time_zone: time_zone
2521
2558
 
2522
2559
  yield updater if block_given?
2523
2560
 
@@ -2633,6 +2670,39 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2633
2670
  # value is `0`. This property is useful if you have header rows in the
2634
2671
  # file that should be skipped.
2635
2672
  # @param [string] session_id Session ID in which the load job must run.
2673
+ # @param [String] date_format Format used to parse DATE values.
2674
+ # Supports SQL-style format strings. See
2675
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2676
+ # @param [String] datetime_format Format used to parse DATETIME
2677
+ # values. Supports SQL-style format strings. See
2678
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2679
+ # @param [String] time_format Format used to parse TIME values.
2680
+ # Supports SQL-style format strings. See
2681
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2682
+ # @param [String] timestamp_format Format used to parse
2683
+ # TIMESTAMP values. Supports SQL-style format strings. See
2684
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2685
+ # @param [Array<String>] null_markers A list of strings represented as
2686
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
2687
+ # set at the same time. If null_marker is set, null_markers has to be
2688
+ # not set. If null_markers is set, null_marker has to be not set. If
2689
+ # both null_marker and null_markers are set at the same time, a user
2690
+ # error would be thrown. Any strings listed in null_markers, including
2691
+ # empty string would be interpreted as SQL NULL. This applies to all
2692
+ # column types.
2693
+ # @param [String] source_column_match Controls the strategy used to
2694
+ # match loaded columns to the schema. If not set, a sensible default is
2695
+ # chosen based on how the schema is provided. If autodetect is used,
2696
+ # then columns are matched by name. Otherwise, columns are matched by
2697
+ # position. This is done to keep the behavior backward-compatible.
2698
+ #
2699
+ # Acceptable values are:
2700
+ # * `POSITION` - matches by position. This assumes that the columns are
2701
+ # ordered the same way as the schema.
2702
+ # * `NAME` - matches by name. This reads the header row as column names
2703
+ # and reorders columns to match the field names in the schema.
2704
+ # @param [String] time_zone The time zone used when parsing timestamp
2705
+ # values.
2636
2706
  #
2637
2707
  # @yield [updater] A block for setting the schema of the destination
2638
2708
  # table and other options for the load job. The schema can be omitted
@@ -2695,12 +2765,16 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2695
2765
  def load files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2696
2766
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2697
2767
  quote: nil, skip_leading: nil, autodetect: nil, null_marker: nil, session_id: nil,
2698
- schema: self.schema, &block
2768
+ schema: self.schema, date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2769
+ null_markers: nil, source_column_match: nil, time_zone: nil, &block
2699
2770
  job = load_job files, format: format, create: create, write: write, projection_fields: projection_fields,
2700
2771
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
2701
2772
  delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
2702
2773
  quote: quote, skip_leading: skip_leading, autodetect: autodetect,
2703
- null_marker: null_marker, session_id: session_id, schema: schema, &block
2774
+ null_marker: null_marker, session_id: session_id, schema: schema,
2775
+ date_format: date_format, datetime_format: datetime_format, time_format: time_format,
2776
+ timestamp_format: timestamp_format, null_markers: null_markers,
2777
+ source_column_match: source_column_match, time_zone: time_zone, &block
2704
2778
 
2705
2779
  job.wait_until_done!
2706
2780
  ensure_job_succeeded! job
@@ -3167,36 +3241,49 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3167
3241
  end
3168
3242
 
3169
3243
  def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
3170
- skip_leading: nil, null_marker: nil
3244
+ skip_leading: nil, null_marker: nil, null_markers: nil, source_column_match: nil
3171
3245
  job.jagged_rows = jagged_rows unless jagged_rows.nil?
3172
3246
  job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
3173
3247
  job.delimiter = delimiter unless delimiter.nil?
3174
3248
  job.null_marker = null_marker unless null_marker.nil?
3175
3249
  job.quote = quote unless quote.nil?
3176
3250
  job.skip_leading = skip_leading unless skip_leading.nil?
3251
+ job.null_markers = null_markers unless null_markers.nil?
3252
+ job.source_column_match = source_column_match unless source_column_match.nil?
3177
3253
  end
3178
3254
 
3179
3255
  def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
3180
3256
  encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
3181
- skip_leading: nil, null_marker: nil
3257
+ skip_leading: nil, null_marker: nil, date_format: nil, datetime_format: nil,
3258
+ time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3259
+ time_zone: nil
3182
3260
  job.format = format unless format.nil?
3183
3261
  job.projection_fields = projection_fields unless projection_fields.nil?
3184
3262
  job.encoding = encoding unless encoding.nil?
3185
3263
  job.ignore_unknown = ignore_unknown unless ignore_unknown.nil?
3186
3264
  job.max_bad_records = max_bad_records unless max_bad_records.nil?
3265
+ job.date_format = date_format unless date_format.nil?
3266
+ job.datetime_format = datetime_format unless datetime_format.nil?
3267
+ job.time_format = time_format unless time_format.nil?
3268
+ job.timestamp_format = timestamp_format unless timestamp_format.nil?
3269
+ job.time_zone = time_zone unless time_zone.nil?
3187
3270
  load_job_csv_options! job, jagged_rows: jagged_rows,
3188
3271
  quoted_newlines: quoted_newlines,
3189
3272
  delimiter: delimiter,
3190
3273
  quote: quote,
3191
3274
  skip_leading: skip_leading,
3192
- null_marker: null_marker
3275
+ null_marker: null_marker,
3276
+ null_markers: null_markers,
3277
+ source_column_match: source_column_match
3193
3278
  end
3194
3279
 
3195
3280
  def load_job_updater format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
3196
3281
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil,
3197
3282
  max_bad_records: nil, quote: nil, skip_leading: nil, dryrun: nil, schema: nil, job_id: nil,
3198
3283
  prefix: nil, labels: nil, autodetect: nil, null_marker: nil,
3199
- create_session: nil, session_id: nil
3284
+ create_session: nil, session_id: nil, date_format: nil, datetime_format: nil,
3285
+ time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3286
+ time_zone: nil
3200
3287
  new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix
3201
3288
  LoadJob::Updater.new(new_job).tap do |job|
3202
3289
  job.location = location if location # may be table reference
@@ -3217,7 +3304,14 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3217
3304
  max_bad_records: max_bad_records,
3218
3305
  quote: quote,
3219
3306
  skip_leading: skip_leading,
3220
- null_marker: null_marker
3307
+ null_marker: null_marker,
3308
+ date_format: date_format,
3309
+ datetime_format: datetime_format,
3310
+ time_format: time_format,
3311
+ timestamp_format: timestamp_format,
3312
+ null_markers: null_markers,
3313
+ source_column_match: source_column_match,
3314
+ time_zone: time_zone
3221
3315
  end
3222
3316
  end
3223
3317
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.54.0".freeze
19
+ VERSION = "1.57.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.54.0
4
+ version: 1.57.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -134,6 +134,7 @@ files:
134
134
  - lib/google-cloud-bigquery.rb
135
135
  - lib/google/cloud/bigquery.rb
136
136
  - lib/google/cloud/bigquery/argument.rb
137
+ - lib/google/cloud/bigquery/condition.rb
137
138
  - lib/google/cloud/bigquery/convert.rb
138
139
  - lib/google/cloud/bigquery/copy_job.rb
139
140
  - lib/google/cloud/bigquery/credentials.rb