Skip to content

Instantly share code, notes, and snippets.

@matthinea
Created August 14, 2020 18:19
Show Gist options
  • Save matthinea/9188fa4703c2a97d3318acaad1e816b2 to your computer and use it in GitHub Desktop.
Save matthinea/9188fa4703c2a97d3318acaad1e816b2 to your computer and use it in GitHub Desktop.
Test execureach encoding
row_lookup_hash = DataTransforms::B2CLink::Execureach::INPUT_HEADERS.each.with_index.to_h.freeze
iterator = DataTransforms::CsvIterator.new(row_lookup_hash)
transformer = DataTransforms::B2CLink::ExecureachTransformer
exporter = S3File::CsvExporter.new
iterator.each_lines('/Users/matthew/Library/Preferences/RubyMine2019.3/scratches/scratch.csv.gz') do |line|
transformed_line = transformer.new(line).attributes
puts transformed_line
formatted_line = exporter.format_line(transformed_line)
unless formatted_line.valid_encoding?
formatted_line.encode!(formatted_line.encoding, invalid: :replace, replace: '')
end
puts formatted_line
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment