Skip to content

Commit 8c9150b

Browse files
committed
feat: use Primary location unless location is set explicitly
1 parent 430fe61 commit 8c9150b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/embulk/output/bigquery/bigquery_client.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(task, schema, fields = nil)
2121
@destination_project = @task['destination_project']
2222
@dataset = @task['dataset']
2323
@location = @task['location']
24-
@location_for_log = @location.nil? ? 'us/eu' : @location
24+
@location_for_log = @location.nil? ? 'Primary location' : @location
2525

2626
@task['source_format'] ||= 'CSV'
2727
@task['max_bad_records'] ||= 0
@@ -300,6 +300,7 @@ def wait_load(kind, response)
300300

301301
while true
302302
job_id = _response.job_reference.job_id
303+
location = @location || _response.job_reference.location
303304
elapsed = Time.now - started
304305
status = _response.status.state
305306
if status == "DONE"
@@ -319,7 +320,7 @@ def wait_load(kind, response)
319320
"job_id:[#{job_id}] elapsed_time:#{elapsed.to_f}sec status:[#{status}]"
320321
}
321322
sleep wait_interval
322-
_response = with_network_retry { client.get_job(@project, job_id, location: @location) }
323+
_response = with_network_retry { client.get_job(@project, job_id, location: location) }
323324
end
324325
end
325326

0 commit comments

Comments
 (0)