#csv #generated #parser #command #row #file #unload

bin+lib redshift

Rust library for parsing redshift files generated by the UNLOAD command

4 stable releases

Uses old Rust 2015

1.0.3 Jun 30, 2016
1.0.0 Jun 27, 2016

#61 in #row

Apache-2.0

14KB
223 lines

rust-redshift

Rust library for parsing redshift files generated by the UNLOAD command. The UNLOAD command must be executed with the following options: DELIMITER '|' ESCAPE ADDQUOTES.

Build Status

Example usage:


    // transform redshift file to csv
    
    // parse redshift file from stdin
    let mut redshift_reader = redshift::reader::Reader::new(io::stdin());

    // create a writer to stdout
    let mut csv_writer = csv::Writer::from_writer(io::stdout());

    // write out each record
    for row in redshift_reader {
        csv_writer.encode(row.values).unwrap();
    }

redshift2csv

The above example is included as an executable redshift2csv. Usage:

redshift2csv < redshiftfile > redshiftfile.csv

Dependencies

~1.5MB
~12K SLoC