sqoop Hive 설정 가 져 오기

2307 단어 sqoop
데이터베이스 에 줄 바 꿈 문자 와 같은 데이터 가 자주 있 습 니 다. Hive 에 가 져 오 면 중대 한 문제 가 발생 할 수 있 습 니 다. 따라서 sqoop 은 이 문 제 를 해결 하 는 설정 항목 이 있 습 니 다.
 
sqoop import --connect jdbc:oracle:thin:@url --username user --password pwd \
--table PA18ODSDATA.PARTNER_INFO  \
--columns ID_PARTNER_INFO,PARTNER_ID,PARTNER_NAME,PROJECT_ID,PROJECT_NAME\
 -m 1 --fields-terminated-by '\001' --lines-terminated-by '
' \ --hive-drop-import-delims --hive-import --hive-overwrite \ --hive-table eshop.partner_info

 
-- query 를 사용 하려 면 -- output - dir 를 추가 하여 텍스트 형식 으로 데 이 터 를 내 보 내야 합 니 다.
시 계 를 직접 가 져 오 면 위의 코드 와 같 습 니 다.
그 중에서 -- hive - overwrite 키 워드 를 제거 하면 데 이 터 를 덮어 쓰 지 않 고 Hive 표 에 데 이 터 를 삽입 할 수 있 습 니 다.
 
데 이 터 를 삽입 하 는 표 는 text 표 나 sequence 표 여야 합 니 다. rcfile 표 는 새로운 데 이 터 를 삽입 하 는 것 을 지원 하지 않 습 니 다. 
 
그 중에서 Hive 설정 에 대한 설명 은 다음 과 같 습 니 다.
자세 한 내용 은:
http://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html
 
Table�14.�Hive arguments:
Argument
Description
--hive-home
Override $HIVE_HOME
--hive-import
Import tables into Hive (Uses Hive’s default delimiters if none are set.)
--hive-overwrite
Overwrite existing data in the Hive table.
--create-hive-table
If set, then the job will fail if the target hive
 
table exits. By default this property is false.
--hive-table
Sets the table name to use when importing to Hive.
--hive-drop-import-delims
Drops , \r, and \01 from string fields when importing to Hive.
--hive-delims-replacement
Replace , \r, and \01 from string fields with user defined string when importing to Hive.
--hive-partition-key
Name of a hive field to partition are sharded on
--hive-partition-value
String-value that serves as partition key for this imported into hive in this job.
--map-column-hive
Override default mapping from SQL type to Hive type for configured columns.
 

좋은 웹페이지 즐겨찾기