List of Contents
'csvimport' and 'csvexport' are one of machbase utilities which users can import and export a csv format files.
csvimport
csvimport is based on machloader, and is a tool that makes csv file more convenient with simple options to import data.
Basic use
You can set a name of table and a name of data file with these options.
Option:
-t: Set table name.
-d: Set name of data file.
* It can import with the table name and the file path specified without '-t' and '-d' option.
Example:
csvimport -t table_name -d table_name.csv
csvimport table_name file_path
csvimport file_path table_name
Exclude a header
You can skip the first line with this option.
Option:
-H: Set the first line in the csv file as a header which is excluded in importing.
Example:
csvimport -t table_name -d table_name.csv -H
Create a table
In case there is no table existed, a table with the columns can be created automatically with these options.
Option:
-C: Create a table with the columns in order of C0, C1, ... with data type of varchar(32767).
-H: Set the first line of csv file as a header with the data type of varchar(32767).
Example:
csvimport -t table_name -d table_name.csv -C
csvimport -t table_name -d table_name.csv -C -H
csvexport
'csvexport' is based on machloader, and is a tool that makes csv file more convenient with simple options to export data.
Basic use
Option:
-t: Set a table name.
-d: Set a name of data file.
* It can export with the table name and the file path specified without '-t' and '-d' option
Example:
csvexport -t table_name -d table_name.csv
csvexport table_name file_path
csvexport file_path table_name
Add a header
You can set a field name with this option.
Option:
-H: Set the column names of the table as the names of the fields in the first line of exported csv file.
Example:
csvexport -t table_name -d table_name.csv -H