@@ -121,7 +121,7 @@ def load_from_gcs(object_uris, table)
121121 opts = { }
122122
123123 Embulk . logger . debug { "embulk-output-bigquery: insert_job(#{ @project } , #{ body } , #{ opts } )" }
124- response = with_network_retry { client . insert_job ( @project , body , opts ) }
124+ response = with_network_retry { client . insert_job ( @project , body , ** opts ) }
125125 unless @task [ 'is_skip_job_result_check' ]
126126 response = wait_load ( 'Load' , response )
127127 end
@@ -222,7 +222,7 @@ def load(path, table, write_disposition: 'WRITE_APPEND')
222222 # },
223223 }
224224 Embulk . logger . debug { "embulk-output-bigquery: insert_job(#{ @project } , #{ body } , #{ opts } )" }
225- response = with_network_retry { client . insert_job ( @project , body , opts ) }
225+ response = with_network_retry { client . insert_job ( @project , body , ** opts ) }
226226 if @task [ 'is_skip_job_result_check' ]
227227 response
228228 else
@@ -278,7 +278,7 @@ def copy(source_table, destination_table, destination_dataset = nil, write_dispo
278278
279279 opts = { }
280280 Embulk . logger . debug { "embulk-output-bigquery: insert_job(#{ @project } , #{ body } , #{ opts } )" }
281- response = with_network_retry { client . insert_job ( @project , body , opts ) }
281+ response = with_network_retry { client . insert_job ( @project , body , ** opts ) }
282282 wait_load ( 'Copy' , response )
283283 rescue Google ::Apis ::ServerError , Google ::Apis ::ClientError , Google ::Apis ::AuthorizationError => e
284284 response = { status_code : e . status_code , message : e . message , error_class : e . class }
@@ -372,7 +372,7 @@ def create_dataset(dataset = nil, reference: nil)
372372 end
373373 opts = { }
374374 Embulk . logger . debug { "embulk-output-bigquery: insert_dataset(#{ @project } , #{ dataset } , #{ @location_for_log } , #{ body } , #{ opts } )" }
375- with_network_retry { client . insert_dataset ( @project , body , opts ) }
375+ with_network_retry { client . insert_dataset ( @project , body , ** opts ) }
376376 rescue Google ::Apis ::ServerError , Google ::Apis ::ClientError , Google ::Apis ::AuthorizationError => e
377377 if e . status_code == 409 && /Already Exists:/ =~ e . message
378378 # ignore 'Already Exists' error
@@ -420,6 +420,7 @@ def create_table_if_not_exists(table, dataset: nil, options: nil)
420420 table_reference : {
421421 table_id : table ,
422422 } ,
423+ description : @task [ 'description' ] ,
423424 schema : {
424425 fields : fields ,
425426 }
@@ -446,8 +447,8 @@ def create_table_if_not_exists(table, dataset: nil, options: nil)
446447 end
447448
448449 opts = { }
449- Embulk . logger . debug { "embulk-output-bigquery: insert_table(#{ @project } , #{ dataset } , #{ @location_for_log } , #{ body } , #{ opts } )" }
450- with_network_retry { client . insert_table ( @project , dataset , body , opts ) }
450+ Embulk . logger . debug { "embulk-output-bigquery: insert_table(#{ @destination_project } , #{ dataset } , #{ @location_for_log } , #{ body } , #{ opts } )" }
451+ with_network_retry { client . insert_table ( @destination_project , dataset , body , ** opts ) }
451452 rescue Google ::Apis ::ServerError , Google ::Apis ::ClientError , Google ::Apis ::AuthorizationError => e
452453 if e . status_code == 409 && /Already Exists:/ =~ e . message
453454 # ignore 'Already Exists' error
@@ -456,7 +457,7 @@ def create_table_if_not_exists(table, dataset: nil, options: nil)
456457
457458 response = { status_code : e . status_code , message : e . message , error_class : e . class }
458459 Embulk . logger . error {
459- "embulk-output-bigquery: insert_table(#{ @project } , #{ dataset } , #{ @location_for_log } , #{ body } , #{ opts } ), response:#{ response } "
460+ "embulk-output-bigquery: insert_table(#{ @destination_project } , #{ dataset } , #{ @location_for_log } , #{ body } , #{ opts } ), response:#{ response } "
460461 }
461462 raise Error , "failed to create table #{ @destination_project } :#{ dataset } .#{ table } in #{ @location_for_log } , response:#{ response } "
462463 end
0 commit comments