#yesterday=`date -d "1 days ago" +%Y-%m-%d`
yesterday=`date -d "@$(($(date +%s)- 86400))" '+%Y-%m-%d'`
today=`date -d "@$(($(date +%s)))" '+%Y-%m-%d'`
sqoop import \
--connect jdbc:mysql://主机:3306/表 \
--username 用户名\
--password 密码\
--query "select line1,line2 from 库.表 where line1 >= '${yesterday} 00:00:00' and line2 <'${today} 00:00:00' and \$CONDITIONS " \
--driver com.mysql.jdbc.Driver \
--hive-overwrite \
--hcatalog-database 库\
--hcatalog-table 表\
--hcatalog-partition-keys 分区字段\
--hcatalog-partition-values ${yesterday} \
--hcatalog-storage-stanza 'stored as orc' \
--split-by 字段名\#容错手段
-m 1
mysql导入hive分区表
最新推荐文章于 2022-06-29 15:58:25 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)