smisra3
smisra3

Reputation: 107

How to import the data from multiple source thru Sqoop

"How to import the data from multiple source thru Sqoop".

I don't have any idea on this..please let me know the mechanism for this.

Thanks

Upvotes: 2

Views: 1162

Answers (1)

vinayak_narune
vinayak_narune

Reputation: 737

This can be done by shell script.

1)Prepare a inputfile which has list of DBNAME.TABLENAME 2)The shell script will have this file as input, iterate line by line and execute sqoop statement for each line.

while read line;
do

    DBNAME=`echo $line | cut -d'.' -f1` 
    tableName=`echo $line | cut -d'.' -f2`


    sqoop import -Dmapreduce.job.queuename=$RM_QUEUE_NAME --connect '$JDBC_URL;databaseName=$DBNAME;username=$USERNAME;password=$PASSWORD' --table $tableName  --target-dir $DATA_COLLECTOR/$tableName  --fields-terminated-by '\001'  -m 1 

done<inputFile

Upvotes: 4

Related Questions