Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can set a name of table and a name of data file with these options.

Option:

Code Block
-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:

Code Block
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:

Code Block
-H: Set the first line in the csv file as a header which is excluded in importing.

...


Example:
Code Block
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:

Code Block
-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:

Code Block
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:

Code Block
-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:

Code Block
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:

Code Block
-H: Set the column names of the table as the names of the fields in the first line of exported csv file.

Example:

Code Block
csvexport -t table_name -d table_name.csv -H