lib/embulk/output/bigquery/bigquery_client.rb in embulk-output-bigquery-0.6.6 vs lib/embulk/output/bigquery/bigquery_client.rb in embulk-output-bigquery-0.6.7
- old
+ new
@@ -438,9 +438,14 @@
body[:clustering] = {
fields: options['clustering']['fields'],
}
end
+ if options['expiration_time']
+ # expiration_time is expressed in milliseconds
+ body[:expiration_time] = (Time.now.to_i + options['expiration_time']) * 1000
+ end
+
opts = {}
Embulk.logger.debug { "embulk-output-bigquery: insert_table(#{@project}, #{dataset}, #{@location_for_log}, #{body}, #{opts})" }
with_network_retry { client.insert_table(@project, dataset, body, opts) }
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
if e.status_code == 409 && /Already Exists:/ =~ e.message