lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-0.5.0.beta2 vs lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-1.0.0

- old
+ new

@@ -40,11 +40,11 @@ if @options[:time_partitioning_type] definition[:time_partitioning] = { type: @options[:time_partitioning_type].to_s.upcase, expiration_ms: @options[:time_partitioning_expiration] ? @options[:time_partitioning_expiration] * 1000 : nil - }.compact + }.select { |_, value| !value.nil? } end client.insert_table(project, dataset, definition, {}) log.debug "create table", project_id: project, dataset: dataset, table: table_id @client = nil rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e @@ -71,10 +71,10 @@ end end def fetch_schema(project, dataset, table_id) res = client.get_table(project, dataset, table_id) - schema = res.schema.fields.as_json + schema = Fluent::BigQuery::Helper.deep_stringify_keys(res.schema.to_h[:fields]) log.debug "Load schema from BigQuery: #{project}:#{dataset}.#{table_id} #{schema}" schema rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e @client = nil