Versions Compared

Key

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


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는 CSV 파일을 마크베이스 서버에 import/export 하기 위해 사용되는 도구이다.

CSV 파일에 대해서 machloader 를 이용하여 보다 간단하게 사용할 수 있도록 옵션을 단순화하였다.

csvimport

csvimport를 이용하면 쉽게 CSV 파일을 서버에 입력할 수 있다.

기본 사용법

테이블 명과 데이터 파일명을 다음의 옵션에 따라 입력하여 수행한다.

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

...


CSV 헤더 제외

입력시에 CSV 파일의 헤더를 제외하고 입력하려면 다음의 옵션을 사용한다.

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

...

테이블 자동 생성

입력시 입력할 테이블을 생성하지 않은 경우, 다음 옵션을 통해서 테이블 생성도 동시에 수행할 수 있다.

Option:

Code Block
-C: Createimport할 a table테이블을 with자동 the생성한다. columns in order of C0칼럼명은 c0, C1c1, ... with자동으로 data생성된다. type생성되는 of칼럼은 varchar(32767) 타입이다.
-H: Set the first line ofimport할 때 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'

...

로 데이터베이스 테이블 데이터를 CSV 파일로 쉽게 export할 수 있다.

기본 사용법

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

...


CSV 헤더 사용

다음의 옵션을 이용하면, export할 CSV 파일에 칼럼명으로 헤더를 추가할 수 있다.

Option:

Code Block
-H: Set테이블 the칼럼명으로 columncsv 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

...