google-cloud-bigquery 1.50.0 → 1.51.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: 9e67dfdf938a25ab1800e16136f9d3bc9e1253eb16a89cdfb6437b835148b971
4
- data.tar.gz: f12d0a0281546ad8830602bd8c8cfda0017bfa6ddf326abe9875e9ebaaeb7165
3
+ metadata.gz: 2ea31e3ba9fb9234a89f1e1a25cf514087b01f6f116b7e5529408a09fd084a0d
4
+ data.tar.gz: 0444a72e4486d9dc3b736b8a8007e207ee37f6399e32116d4c974d58c14ed7bc
5
5
  SHA512:
6
- metadata.gz: 27031288672aa253d5250fecc387cfce57cddc16a82bc43ae8b09fef1c38a32f31df8884815bb5f65d10a701cbefc0c7a220295fef87088972199fdd75cce272
7
- data.tar.gz: a9d57161072a53ddbc488b9a8f4d837b82869d234510d7a18637f50534a39964214a022164b74639505c9116d21f38ec55bd856d2a8f578696cfc0e119c043ad
6
+ metadata.gz: 0ecdff16e754acc36a3c04231f54e101cfe21adda9b3be0978c802a859c3919fa4a54c72e62e3f76ee1c6de6c25164c6e3e5bf8d43111ac20c7bbe4e85247c44
7
+ data.tar.gz: 7f7ce9cffb5df5ae50bee4d17b62897a4e55f12521cf7792b4ba54c35d62bd5fc750dacc40d93949f22bb8cbe93286b8ec1f939d94d4ccf101ec524d7a08a656
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History
2
2
 
3
+ ### 1.51.0 (2024-12-04)
4
+
5
+ #### Features
6
+
7
+ * load jobs with dest tables in another project ([#27681](https://github.com/googleapis/google-cloud-ruby/issues/27681))
8
+ #### Bug Fixes
9
+
10
+ * remove reload! call on patch_table ([#27684](https://github.com/googleapis/google-cloud-ruby/issues/27684))
11
+
3
12
  ### 1.50.0 (2024-06-27)
4
13
 
5
14
  #### Features
@@ -899,7 +899,7 @@ module Google
899
899
  def table table_id, skip_lookup: nil, view: nil
900
900
  ensure_service!
901
901
  return Table.new_reference project_id, dataset_id, table_id, service if skip_lookup
902
- gapi = service.get_table dataset_id, table_id, metadata_view: view
902
+ gapi = service.get_project_table project_id, dataset_id, table_id, metadata_view: view
903
903
  Table.from_gapi gapi, service, metadata_view: view
904
904
  rescue Google::Cloud::NotFoundError
905
905
  nil
@@ -2444,7 +2444,7 @@ module Google
2444
2444
  #
2445
2445
  def reload!
2446
2446
  ensure_service!
2447
- @gapi = service.get_dataset dataset_id
2447
+ @gapi = service.get_project_dataset project_id, dataset_id
2448
2448
  @reference = nil
2449
2449
  @exists = nil
2450
2450
  self
@@ -2927,7 +2927,7 @@ module Google
2927
2927
  configuration: Google::Apis::BigqueryV2::JobConfiguration.new(
2928
2928
  load: Google::Apis::BigqueryV2::JobConfigurationLoad.new(
2929
2929
  destination_table: Google::Apis::BigqueryV2::TableReference.new(
2930
- project_id: @service.project,
2930
+ project_id: project_id,
2931
2931
  dataset_id: dataset_id,
2932
2932
  table_id: table_id
2933
2933
  )
@@ -1111,6 +1111,7 @@ module Google
1111
1111
  # Note: This will work only for tables in _SESSION dataset
1112
1112
  # else the property will be ignored by the backend.
1113
1113
  # @param [string] session_id Session ID in which the load job must run.
1114
+ # @param [string] project_id Project ID where the destination table exists.
1114
1115
  #
1115
1116
  # @yield [updater] A block for setting the schema and other
1116
1117
  # options for the destination table. The schema can be omitted if the
@@ -1138,10 +1139,10 @@ module Google
1138
1139
  projection_fields: nil, jagged_rows: nil, quoted_newlines: nil, encoding: nil,
1139
1140
  delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
1140
1141
  skip_leading: nil, schema: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
1141
- null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, &block
1142
+ null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, project_id: nil, &block
1142
1143
  ensure_service!
1143
1144
  dataset_id ||= "_SESSION" unless create_session.nil? && session_id.nil?
1144
- session_dataset = dataset dataset_id, skip_lookup: true
1145
+ session_dataset = dataset dataset_id, skip_lookup: true, project_id: project_id
1145
1146
  table = session_dataset.table table_id, skip_lookup: true
1146
1147
  table.load_job files,
1147
1148
  format: format, create: create, write: write, projection_fields: projection_fields,
@@ -1376,6 +1377,7 @@ module Google
1376
1377
  # object without verifying that the resource exists on the BigQuery
1377
1378
  # service. Calls made on this object will raise errors if the resource
1378
1379
  # does not exist. Default is `false`. Optional.
1380
+ # @param [String] project_id The GCP Project where the dataset lives.
1379
1381
  #
1380
1382
  # @return [Google::Cloud::Bigquery::Dataset, nil] Returns `nil` if the
1381
1383
  # dataset does not exist.
@@ -1388,6 +1390,14 @@ module Google
1388
1390
  # dataset = bigquery.dataset "my_dataset"
1389
1391
  # puts dataset.name
1390
1392
  #
1393
+ # @example
1394
+ # require "google/cloud/bigquery"
1395
+ #
1396
+ # bigquery = Google::Cloud::Bigquery.new
1397
+ #
1398
+ # dataset = bigquery.dataset "my_dataset", project_id: "another_project"
1399
+ # puts dataset.name
1400
+ #
1391
1401
  # @example Avoid retrieving the dataset resource with `skip_lookup`:
1392
1402
  # require "google/cloud/bigquery"
1393
1403
  #
@@ -1395,10 +1405,11 @@ module Google
1395
1405
  #
1396
1406
  # dataset = bigquery.dataset "my_dataset", skip_lookup: true
1397
1407
  #
1398
- def dataset dataset_id, skip_lookup: nil
1408
+ def dataset dataset_id, skip_lookup: nil, project_id: nil
1399
1409
  ensure_service!
1400
- return Dataset.new_reference project, dataset_id, service if skip_lookup
1401
- gapi = service.get_dataset dataset_id
1410
+ project_id ||= project
1411
+ return Dataset.new_reference project_id, dataset_id, service if skip_lookup
1412
+ gapi = service.get_project_dataset project_id, dataset_id
1402
1413
  Dataset.from_gapi gapi, service
1403
1414
  rescue Google::Cloud::NotFoundError
1404
1415
  nil
@@ -110,9 +110,15 @@ module Google
110
110
  ##
111
111
  # Returns the dataset specified by datasetID.
112
112
  def get_dataset dataset_id
113
+ get_project_dataset @project, dataset_id
114
+ end
115
+
116
+ ##
117
+ # Gets the specified dataset resource by full dataset reference.
118
+ def get_project_dataset project_id, dataset_id
113
119
  # The get operation is considered idempotent
114
120
  execute backoff: true do
115
- service.get_dataset @project, dataset_id
121
+ service.get_dataset project_id, dataset_id
116
122
  end
117
123
  end
118
124
 
@@ -3061,10 +3061,6 @@ module Google
3061
3061
  patch_gapi = Google::Apis::BigqueryV2::Table.new(**patch_args)
3062
3062
  patch_gapi.etag = etag if etag
3063
3063
  @gapi = service.patch_table dataset_id, table_id, patch_gapi
3064
-
3065
- # TODO: restore original impl after acceptance test indicates that
3066
- # service etag bug is fixed
3067
- reload!
3068
3064
  end
3069
3065
 
3070
3066
  def ensure_job_succeeded! job
@@ -3085,7 +3081,7 @@ module Google
3085
3081
  configuration: Google::Apis::BigqueryV2::JobConfiguration.new(
3086
3082
  load: Google::Apis::BigqueryV2::JobConfigurationLoad.new(
3087
3083
  destination_table: Google::Apis::BigqueryV2::TableReference.new(
3088
- project_id: @service.project,
3084
+ project_id: project_id,
3089
3085
  dataset_id: dataset_id,
3090
3086
  table_id: table_id
3091
3087
  )
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.50.0".freeze
19
+ VERSION = "1.51.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.50.0
4
+ version: 1.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-27 00:00:00.000000000 Z
12
+ date: 2024-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bigdecimal
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
- rubygems_version: 3.5.6
192
+ rubygems_version: 3.5.22
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: API Client library for Google BigQuery