@@ -90,6 +90,8 @@ def self.configure(config, schema, task_count)
9090 'clustering' => config . param ( 'clustering' , :hash , :default => nil ) , # google-api-ruby-client >= v0.21.0
9191 'schema_update_options' => config . param ( 'schema_update_options' , :array , :default => nil ) ,
9292
93+ 'temporary_table_expiration' => config . param ( 'temporary_table_expiration' , :integer , :default => nil ) ,
94+
9395 # for debug
9496 'skip_load' => config . param ( 'skip_load' , :bool , :default => false ) ,
9597 'temp_table' => config . param ( 'temp_table' , :string , :default => nil ) ,
@@ -300,19 +302,23 @@ def self.auto_create(task, bigquery)
300302 end
301303 end
302304
305+ temp_table_expiration = task [ 'temporary_table_expiration' ]
306+ temp_options = { 'expiration_time' => temp_table_expiration }
307+
303308 case task [ 'mode' ]
304309 when 'delete_in_advance'
305310 bigquery . delete_table_or_partition ( task [ 'table' ] )
306311 bigquery . create_table_if_not_exists ( task [ 'table' ] )
307312 when 'replace'
308- bigquery . create_table_if_not_exists ( task [ 'temp_table' ] )
313+ bigquery . create_table_if_not_exists ( task [ 'temp_table' ] , options : temp_options )
309314 bigquery . create_table_if_not_exists ( task [ 'table' ] ) # needs for when task['table'] is a partition
310315 when 'append'
311- bigquery . create_table_if_not_exists ( task [ 'temp_table' ] )
316+ bigquery . create_table_if_not_exists ( task [ 'temp_table' ] , options : temp_options )
312317 bigquery . create_table_if_not_exists ( task [ 'table' ] ) # needs for when task['table'] is a partition
313318 when 'replace_backup'
314- bigquery . create_table_if_not_exists ( task [ 'temp_table' ] )
319+ bigquery . create_table_if_not_exists ( task [ 'temp_table' ] , options : temp_options )
315320 bigquery . create_table_if_not_exists ( task [ 'table' ] )
321+
316322 bigquery . create_table_if_not_exists ( task [ 'table_old' ] , dataset : task [ 'dataset_old' ] ) # needs for when a partition
317323 else # append_direct
318324 if task [ 'auto_create_table' ]
0 commit comments