时间:2021-05-15 09:08:49 | 栏目:Shell | 点击:次
1、test.sh脚本内容如下:
#!/bin/bash #CURR_DATE=`date +"%Y-%m-%d %H:%M:%S"`------>不能使用 v_sql="insert into origin_ennenergy_energytrade.test2 values('"$(date +"%Y-%m-%d %H:%M:%S")"','"Y"')" echo $v_sql #insert into origin_ennenergy_energytrade.test2 values('2016-08-09 10:39:44','Y') hive -e "$v_sql;" sqoop export --connect jdbc:mysql://ip:3306/test23?characterEncoding=utf8 --username root --password 123--table test2--export-dir /user/hive/warehouse/origin_ennenergy_energytrade.db/test2/* --input-fields-terminated-by "\t" --update-mode allowinsert --update-key times;
2、执行:
sh test.sh