Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcs_client in order to load data using gcs_bucket parameter #164

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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