| Crates.io | redshift |
| lib.rs | redshift |
| version | 1.0.3 |
| created_at | 2016-06-27 21:34:19.958741+00 |
| updated_at | 2016-06-30 18:06:37.088953+00 |
| description | Rust library for parsing redshift files generated by the UNLOAD command. |
| homepage | https://github.com/yurigorokhov/rust-redshift |
| repository | https://github.com/yurigorokhov/rust-redshift |
| max_upload_size | |
| id | 5513 |
| size | 31,669 |
Rust library for parsing redshift files generated by the UNLOAD command. The UNLOAD command must be executed with the following options: DELIMITER '|' ESCAPE ADDQUOTES.
// 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();
}
The above example is included as an executable redshift2csv. Usage:
redshift2csv < redshiftfile > redshiftfile.csv