Shariar Imtiaz
Shariar Imtiaz

Reputation: 493

Import specific partitions from a table into hadoop

I am using sqoop to import data into hadoop. I am using below command to import a table into hadoop.

 sqoop import \
 --connect jdbc:oracle:thin:@172.16.XXX.XXX:15XX:TABS \
 --username user \
 --password pass \
 --table TABS.ADM_LOG0009 \
 --target-dir /hadoop/hptabs/recharge

Now I have another table named IVM_IMAGE, which is a partitioned table. I want to import only 3 partitions from Oracle to hadoop. Please help me to write command for this.

Table properties:

PARTITIONED BY (BILLDATE TIMESTAMP) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 'hdfs:/hadoop/hptabs/usage';

Upvotes: 0

Views: 962

Answers (1)

Shariar Imtiaz
Shariar Imtiaz

Reputation: 493

To import specific partitions i need to add "-Doraoop.import.partitions='"LESS20161101","LESS20161001","LESS20160901",'" to my sqoop command

sqoop import \
-Doraoop.disabled=false \
-Doraoop.import.partitions='"LESS20161101","LESS20161001","LESS20160901",' \
--connect jdbc:oracle:thin:@172.16.XXX.XXX:15XX:TABS \
--username user \
--password password \
--table TABS.IVM_IMAGE \
--target-dir /hadoop/hptabs/usage/ \
-m 1

Upvotes: 2

Related Questions