Sha256: 9f74289f4396ee29e78b7e2b627f733839f96662a8850b9466b73ac062fff2ab
Contents?: true
Size: 886 Bytes
Versions: 5
Compression:
Stored size: 886 Bytes
Contents
require 'chicago/etl/sink' module Chicago module ETL # Wrapper around FasterCSV's output object, to convert values to a # format required by MySQL's LOAD DATA INFILE command. # # @api public class MysqlDumpfile < Sink # Creates a new writer. # # @param csv a FasterCSV output object # @param [Symbol] column_names columns to be output # @param key an optional key to ensure rows are written only once. def initialize(csv, column_names, key=nil) super(csv, column_names, key) @transformer = MysqlLoadFileValueTransformer.new end protected # Writes a row to the output. # # @param Hash row Only keys in column_names will be output. def write(row) output << @column_names.map {|name| @transformer.transform(row[name]) } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems