Browse Source

添加历史数据导入

wdl 2 years ago
parent
commit
bd7bdf6131
1 changed files with 32 additions and 0 deletions
  1. 32 0
      energy/dayTask/bus_mysql_to_hdfs.sh

+ 32 - 0
energy/dayTask/bus_mysql_to_hdfs.sh

@@ -41,6 +41,28 @@ mysql_to_hdfs_lzo() {
 	--null-non-string '\\N'
 }
 
+mysql_to_hdfs_lzo_no_partition() {
+	sqoop import  \
+	-D mapred.job.queue.name=default  \
+	--connect "$1" \
+	--username "$2" \
+	--password "$3" \
+	--target-dir "$4""$7"/"$do_date" \
+	--delete-target-dir \
+	--columns "$5" \
+	--query "$6 and \$CONDITIONS" \
+	--num-mappers 1 \
+	--hive-drop-import-delims \
+	--fields-terminated-by '\001' \
+	--compress \
+	--compression-codec lzo \
+	--hive-import \
+	--hive-database saga_dw \
+	--hive-table "$7" \
+	--hive-overwrite \
+	--null-string '\\N' \
+	--null-non-string '\\N'
+}
 ## 空调操作记录表
 ods_feedback(){
   mysql_to_hdfs_lzo "$url" "$username" "$password" /warehouse/saga_dw/ods/tmp/  \
@@ -49,6 +71,13 @@ ods_feedback(){
   ods_bus_feedback
 }
 
+ods_feedback_tmp(){
+  mysql_to_hdfs_lzo "$url" "$username" "$password" /warehouse/saga_dw/ods/tmp/  \
+  "id, project_id, object_id, source_type, user_id, user_phone, user_name, value_type, item_id, value, create_time, next_open_time, model, duration_type, custom_plan, curr_temp, nick_name, result, exe_result, fb_temp, remark" \
+  "select id, project_id, object_id, source_type, user_id, user_phone, user_name, value_type, item_id, value, create_time, next_open_time, model, duration_type, custom_plan, curr_temp, nick_name, result, exe_result, fb_temp, remark from feedback where 1 = 1 " \
+  ods_bus_feedback_tmp
+}
+
 case $1 in
 "all")
   ods_feedback
@@ -56,4 +85,7 @@ case $1 in
 "ods_feedback")
   ods_feedback
   ;;
+"ods_feedback_tmp")
+  ods_feedback_tmp
+  ;;
 esac