This system adds a basic support for reading tables from and writing tables to csv files.
(defparameter *table*
(vellum:copy-from :csv "/path/to/csv/file/csv.csv"
:includes-header-p t
:columns '(a b)))
This system also supports cl-ds.fs:command input which allows to handle csv output produced by other programs. This is handy when dealing with compressed csv files.
(vellum:copy-to :csv "~/output.csv" *table* )
Strings are automaticly converted to values, depending on the :TYPE of the column. Only numbers and strings are supported at this point though. Additional types can be supported by specializing FROM-STRING and TO-STRING generic functions.
This system is implemented by the means of the CSV-RANGE. CSV-RANGE can be used on it’s own to aggregate CSV files that are unsuitable for putting in to the table. Example of these are a very large files, that are unlikely to fit into the main memory. Using reservoir sampling or data sketch techniques (available in CL-DS) can be favored in those situations.
Parser implemented in this system is based on the code written by Gilbert Baumann. Writer is based on the fare-csv code.