我在学sqoop。我想从数据库中导入一些选定的表,怎么做?如果我在一个数据库中有1000个表,那么我只想导入500个表。我可以使用--exclude表,但我不能在命令行中输入所有要排除的500个表的名称。好心的建议我,怎么实现呢?
kninwzqo1#
您可以通过编写类似这样的shell脚本来实现它。
# !/bin/sh# You can list excluded table here or you can list it in some file and call# it here.exclude_tables="tab1,tab2"import-all-tables --connect jdbc:mysql://192.168.0.101/mysql -username test \ -P --warehouse-dir /home/user_all_tables --exclude-tables $exclude_tables -m 1echo "Sqoop import completed."exit 0
# !/bin/sh
# You can list excluded table here or you can list it in some file and call
# it here.
exclude_tables="tab1,tab2"
import-all-tables --connect jdbc:mysql://192.168.0.101/mysql -username test \
-P --warehouse-dir /home/user_all_tables --exclude-tables $exclude_tables -m 1
echo "Sqoop import completed."
exit 0
1条答案
按热度按时间kninwzqo1#
您可以通过编写类似这样的shell脚本来实现它。