wudianlong 2 years ago
parent
commit
62493ba608

config/config.sh → energy/config.sh


+ 5 - 0
example/config/config.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+MYSQL_URL='jdbc:mysql://192.168.0.76:3306/sagacloud_review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false'
+MYSQL_USER=root
+MYSQL_PASSWORD=123456

function/hive_func.sh → example/function/hive_func.sh


function/mysql_func.sh → example/function/mysql_func.sh


function/sqoop_func.sh → example/function/sqoop_func.sh


+ 20 - 2
hive_ddl/saga_dw_ods.sql

@@ -12,8 +12,26 @@ create table if not exists ods_energy_week_day (
     update_time string comment "更新时间"
 ) COMMENT '能耗系统'
 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
-STORED AS ORC
+STORED AS TEXTFILE
 LOCATION
 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_week_day'
 TBLPROPERTIES (
-'orc.compress'='lzo');
+'orc.compress'='lzo');
+
+/** 历史数据 */
+create table ods_energy_15_min_history
+(
+    building   string,
+    func_id    string,
+    meter      string,
+    data_time  string,
+    data_value decimal(20, 15),
+    `dt` string
+) COMMENT '能源原始数据15min历史数据'
+    partitioned by (`dt` string)
+ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
+STORED AS TEXTFILE
+LOCATION
+  'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_15_min_history'
+TBLPROPERTIES (
+  'orc.compress'='lzo');

job/mysql_to_hdfs.sh → example/job/mysql_to_hdfs.sh