sqluldr2 批量抽取数据

sqluldr 抽取数据陈文件
sqluldr2 user=username/pwd@orcl field=0x09 charset=UTF8 direct=true safe=yes parallel=true log=/data/log/D_010202012.log  file=/data/data/clby2020/D_202003.011.txt query="select * from table_name where month_id='202003' AND PROV_ID = '11'" &  

 file_2_hive

less file_2_hive.sh
#!/bin/sh

file=$1
tablename=$2

hadoop fs -put /local/data/${file} /hdfs_dir

beeline -u 'jdbc:hive2://host_name:10000' -n user_name -p pwd -e "load data inpath '/hdfs_dir/${file}' overwrite into table db_dwa.${tablename}"

 

file_2_hive_part.sh
#!/bin/sh

tablename=$1
part=$2

hadoop fs -put /data/${tablename}_${part}.txt /hdfs_dir

beeline -u 'jdbc:hive2://hostname:10001' -n user_name -p pwd -e "load data inpath '/hdfs_dir/${tablename}_${part}.txt' overwrite into table db_dwa.${tablename} partition (month_id=${part}) " 
 

 

posted @ 2023-03-28 22:56  晓枫的春天  阅读(26)  评论(0编辑  收藏  举报