Browse Source

完善维度表导入脚本

wudianlong 2 years ago
parent
commit
1288104cec
2 changed files with 17 additions and 2 deletions
  1. 14 2
      example/function/sqoop_func.sh
  2. 3 0
      example/hive_ddl/saga_dw_dim.sql

+ 14 - 2
example/function/sqoop_func.sh

@@ -47,5 +47,17 @@ dim_office_meter(){
   import_no_partition $url $username $password /warehouse/saga_dw/dim/tmp/ "id, meter, branch_code, branch_name, use_range" "select id, meter, branch_code, branch_name, use_range from office_meter where 1 = 1 " dim_office_meter
 }
 
-dim_date
-dim_office_meter
+
+
+case $1 in
+"all")
+  dim_date
+  dim_office_meter
+  ;;
+"dim_date")
+  dim_date
+  ;;
+"dim_office_meter")
+  dim_office_meter
+  ;;
+esac

+ 3 - 0
example/hive_ddl/saga_dw_dim.sql

@@ -5,6 +5,9 @@ create table saga_dw.dim_office_meter
     meter       integer comment '表号',
     branch_code string comment '支路编码',
     branch_name string comment '支路名称',
+    branch_type string comment '支路类型',
+    parent_code string comment '上级表编码',
+    use_range_type string comment '控制区域',
     use_range   string comment '区域范围'
 ) COMMENT '支路维度'
     ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'