Sqoop的语法导入数据库中存在的100个表中的5个-不使用exclude关键字吗? [英] Syntax to Sqoop import 5 out of 100 tables present in database - don't use exclude keyword?
本文介绍了Sqoop的语法导入数据库中存在的100个表中的5个-不使用exclude关键字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在数据库中有100张表. 我只想导入5张桌子. 我不能/不使用-排除"命令
I have 100 tables in a database. I want to import only 5 tables. I can't/don't use "-- exclude" command
推荐答案
This can be done by shell script.
1)Prepare a input file which has list of 5 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
这篇关于Sqoop的语法导入数据库中存在的100个表中的5个-不使用exclude关键字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文