lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-2.2.0 vs lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-2.3.0
- old
+ new
@@ -33,10 +33,11 @@
fields: record_schema.to_a,
}
}
definition.merge!(time_partitioning: time_partitioning) if time_partitioning
+ definition.merge!(require_partition_filter: require_partition_filter) if require_partition_filter
definition.merge!(clustering: clustering) if clustering
client.insert_table(project, dataset, definition, {})
log.debug "create table", project_id: project, dataset: dataset, table: table_id
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
message = e.message
@@ -313,9 +314,19 @@
field: @options[:time_partitioning_field] ? @options[:time_partitioning_field].to_s : nil,
expiration_ms: @options[:time_partitioning_expiration] ? @options[:time_partitioning_expiration] * 1000 : nil,
}.reject { |_, v| v.nil? }
else
@time_partitioning
+ end
+ end
+
+ def require_partition_filter
+ return @require_partition_filter if instance_variable_defined?(:@require_partition_filter)
+
+ if @options[:require_partition_filter]
+ @require_partition_filter = @options[:require_partition_filter]
+ else
+ @require_partition_filter
end
end
def clustering
return @clustering if instance_variable_defined?(:@clustering)