天天看點

[Sqoop基礎]-- 本地執行sqoop和oozie上執行sqoop指令需要注意

-------------------------------------------本地sqoop指令,需要修改為'\N'、并且添加sqoop字首-------------------------------------------
 #采購訂單
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_JQZ_T_GAS_GET_ORDER_NUM_INFO_S  --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_get_order_num_info_s  --input-null-string '\N' --input-null-non-string '\N' --fields-terminated-by ''\t'' --update-mode allowinsert --update-key order_num,times


 #在途庫存
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_JQZ_T_GAS_TOTAL_STORAGE_INFO_S  --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_total_storage_info_s  --input-null-string '\N' --input-null-non-string '\N' --fields-terminated-by ''\t'' --update-mode allowinsert --update-key  station_no,gather_time


 #地區資訊表
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_JQZ_T_GAS_AREA_DATA_INFO_M      --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_area_data_info_m  --input-null-string '\N' --input-null-non-string '\N' --fields-terminated-by ''\t'' --update-mode allowinsert --update-key  order_id,order_num


 #目前銷售額和銷售單數
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_YKT_T_GAS_ORDER_INFO_M          --export-dir  /user/hive/warehouse/origin_ennenergy_onecard_lng.db/a_ykt_t_gas_order_info_m     --input-fields-terminated-by ''\t'' --update-mode allowinsert --update-key FStationNo,FTradeDateTime


 #平均消耗
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_YKT_T_GAS_AVG_USED_INFO_S       --export-dir  /user/hive/warehouse/origin_ennenergy_onecard_lng.db/a_ykt_t_gas_avg_used_info_s  --input-fields-terminated-by '\t' --input-null-string '\N' --input-null-non-string '\N' --fields-terminated-by ''\t'' --update-mode allowinsert --update-key FStationNo,calculation_time


 #【新增】導出custom對應站點關系
 sqoop export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table C_NY_C_CUST_GAS_STATION_M         --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/c_ny_c_cust_gas_station_m    --input-null-string '\N' --input-null-non-string '\N' --fields-terminated-by ''\t'' --update-mode allowinsert --update-key  CUST_STATION_ID,CUSTOMER_ID




 -----------------------------------------------oozie上則需要全部使用雙引号--------------------------------------------
 #采購訂單
 export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password 123456 --table A_JQZ_T_GAS_GET_ORDER_NUM_INFO_S  --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_get_order_num_info_s  --input-null-string "\\N" --input-null-non-string "\\N" --fields-terminated-by "\t" --update-mode allowinsert --update-key order_num,times


 #在途庫存
 export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456  --table A_JQZ_T_GAS_TOTAL_STORAGE_INFO_S  --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_total_storage_info_s  --input-null-string "\\N" --input-null-non-string "\\N" --fields-terminated-by "\t" --update-mode allowinsert --update-key  station_no,gather_time


 #地區資訊表
 export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_JQZ_T_GAS_AREA_DATA_INFO_M      --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/a_jqz_t_gas_area_data_info_m  --input-null-string "\\N" --input-null-non-string "\\N" --fields-terminated-by "\t" --update-mode allowinsert --update-key  order_id,order_num


 #目前銷售額和銷售單數
 export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table A_YKT_T_GAS_ORDER_INFO_M          --export-dir  /user/hive/warehouse/origin_ennenergy_onecard_lng.db/a_ykt_t_gas_order_info_m     --input-fields-terminated-by "\t" --update-mode allowinsert --update-key FStationNo,FTradeDateTime


 #平均消耗
 export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456  --table A_YKT_T_GAS_AVG_USED_INFO_S       --export-dir  /user/hive/warehouse/origin_ennenergy_onecard_lng.db/a_ykt_t_gas_avg_used_info_s  --input-fields-terminated-by "\t" --input-null-string "\\N" --input-null-non-string "\\N" --fields-terminated-by "\t" --update-mode allowinsert --update-key FStationNo,calculation_time


 #【新增】導出custom對應站點關系 
export --connect jdbc:mysql://192.168.1.109/testtests?characterEncoding=utf8 --username root --password123456 --table C_NY_C_CUST_GAS_STATION_M         --export-dir  /user/hive/warehouse/origin_ennenergy_energytrade.db/c_ny_c_cust_gas_station_m    --input-null-string "\\N" --input-null-non-string "\\N" --fields-terminated-by "\t" --update-mode allowinsert --update-key  CUST_STATION_ID,CUSTOMER_ID