Commit 47efceac by wangkai

过车数据从oracle增量同步到hive脚本

parent 19f65040
/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/bin/hive -e "truncate table ods_jg_yp.ods_plate_realtime_tmp"
sleep 5
/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/bin/sqoop import --connect jdbc:oracle:thin:@172.16.17.82:1521:gyjg --username gyjg --password gyjg2018 -m 1 --target-dir /user/hive/warehouse/ods_jg_yp.db/ods_plate_realtime_tmp --delete-target-dir --fields-terminated-by "^" --lines-terminated-by "\n" --hive-drop-import-delims --split-by HUMAN_SFZMHM --where "1=1" --query """select add_no, car_color, car_logo, car_no, car_road, car_speed, car_type, check_value, confidence, create_time, device_desc, device_no, direction, in_kafka_time, picture, plate_color, type, upload_type, watch_time, works_no, xtbh from gyjg.plate_realtime where watch_time>=to_char(sysdate-1,'yyyy-MM-dd')||' 00:00:00' and watch_time<to_char(sysdate,'yyyy-MM-dd')||' 00:00:00' and \$CONDITIONS"""
/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/bin/hive -e "LOAD DATA INPATH '/user/hive/warehouse/ods_jg_yp.db/ods_plate_realtime_tmp' INTO TABLE ods_jg_yp.ods_plate_realtime_tmp"
sleep 60
/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/bin/hive -e "set hive.exec.dynamic.partition=true;set hive.exec.dynamic.partition.mode=nonstrict;insert overwrite table ods_jg_yp.ods_plate_realtime partition(day) select a.*,substr(a.watch_time,0,10) day from ods_jg_yp.ods_plate_realtime_tmp a"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment