I'm parsing a csv file and trying to send it to a table with fewer fields than the original csv file. How do I remove those extraneous commas that are left over if I set the extra fields to nothing?
Here's the original csv format:
columns => id,first_name,last_name,phone,fax
sample row => 1,ben,tomas,5555555,6666666
Here's the final format:
column => id,phone,fax
sample row => 1,5555555,6666666
Notice the missing commas for the first and last name.
Here's the tentative row processor:
module ETL
module Processor
class PhoneProcessor < ETL::Processor::RowProcessor
def process(row)
#debugger
row = {:id => row[:id],
:phone => row[:phone],
:fax => row[:fax]}
row
end
end
end
end