Skip to content

Commit

Permalink
Merge pull request #164 from kashira202111/kashira/fix_bug_about_gcs_…
Browse files Browse the repository at this point in the history
…client

Fix `gcs_client` in order to load data using `gcs_bucket` parameter
  • Loading branch information
hiroyuki-sato authored Jul 21, 2024
2 parents b20fc4e + 2c1c9f6 commit c197ecf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/embulk/output/bigquery/gcs_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def insert_temporary_bucket(bucket = nil)
opts = {}

Embulk.logger.debug { "embulk-output-bigquery: insert_temporary_bucket(#{@project}, #{body}, #{opts})" }
with_network_retry { client.insert_bucket(@project, body, opts) }
with_network_retry { client.insert_bucket(@project, body, **opts) }
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
if e.status_code == 409 && /conflict:/ =~ e.message
# ignore 'Already Exists' error
Expand Down Expand Up @@ -81,7 +81,7 @@ def insert_object(path, object: nil, bucket: nil)

Embulk.logger.debug { "embulk-output-bigquery: insert_object(#{bucket}, #{body}, #{opts})" }
# memo: gcs is strongly consistent for insert (read-after-write). ref: https://cloud.google.com/storage/docs/consistency
with_network_retry { client.insert_object(bucket, body, opts) }
with_network_retry { client.insert_object(bucket, body, **opts) }
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
response = {status_code: e.status_code, message: e.message, error_class: e.class}
Embulk.logger.error {
Expand Down Expand Up @@ -114,7 +114,7 @@ def delete_object(object, bucket: nil)
opts = {}

Embulk.logger.debug { "embulk-output-bigquery: delete_object(#{bucket}, #{object}, #{opts})" }
response = with_network_retry { client.delete_object(bucket, object, opts) }
response = with_network_retry { client.delete_object(bucket, object, **opts) }
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
if e.status_code == 404 # ignore 'notFound' error
return nil
Expand Down

0 comments on commit c197ecf

Please sign in to comment.