...
'csvimport' and 와 'csvexport' are one of machbase utilities which users can import and export a csv format files는 csv 파일을 마크베이스 서버에 import/export 하기 위해 사용되는 도구이다.
csvimport
csvimport is based on machloader, and is a tool that makes csv file more convenient with simple options to import datacsvimport를 이용하면 쉽게 csv 파일을 서버에 입력할 수 잇다.
Basic use
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. |
...
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입력시에 csv 파일의 헤더를 빼고 입력하려면 다음의 옵션을 사용한다.
Option:
Code Block |
---|
-H: Set the first line in the csv file as a header which is excluded in importing. |
...
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). |
...
Code Block |
---|
csvimport -t table_name -d table_name.csv -C csvimport -t table_name -d table_name.csv -C -H |
csvexport
'csvexport'
...
로 데이터베이스 테이블 데이터를 csv 파일로 쉽게 export할 수 있다.
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 |
...
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다음의 옵션을 이용하면, Export할 csv파일에 칼럼명으로 헤더를 추가할 수 있다.
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. |
...