Created
August 14, 2020 18:19
-
-
Save matthinea/9188fa4703c2a97d3318acaad1e816b2 to your computer and use it in GitHub Desktop.
Test execureach encoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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