Browse Source

Merge remote-tracking branch 'origin/master'

李莎 2 years ago
parent
commit
0a394368bc
2 changed files with 22 additions and 7 deletions
  1. 17 3
      config.json
  2. 5 4
      start_mysql.py

+ 17 - 3
config.json

@@ -10,8 +10,22 @@
   },
   "building": {
     "id": [
-      "1101110001",
-      "1101080259"
+      "1101080259",
+      "3205060003",
+      "5101070005",
+      "1101020002",
+      "1101050030",
+      "1102290002",
+      "1101150003",
+      "5101070010",
+      "1101080255",
+      "1101020005",
+      "1101050039",
+      "1101050038",
+      "3301100002",
+      "1101140020",
+      "1101050043",
+      "6101120004"
     ]
   },
   "mysql": {
@@ -28,4 +42,4 @@
     "hcho_table": "hcho_15_min",
     "humidity_table": "humidity_15_min"
   }
-}
+}

+ 5 - 4
start_mysql.py

@@ -39,9 +39,10 @@ def get_data_time(hbase_database, hbase_table, buildingid, meter, funcid,from_ti
 #取hbase数据,处理成sql语句
 def hbase_energy_data(points,table,building):
     sqls = []
+    print("%s开始查询项目%s的%s至%s的数据" % (table, building, args.start_time, args.end_time))
     for i in points:
         meter,funcid = i[0],i[1]
-        print("%s开始查询项目%s的%s至%s的数据 %s-%s"%(table,building,args.start_time,args.end_time,meter,funcid))
+        # print("%s开始查询项目%s的%s至%s的数据 %s-%s"%(table,building,args.start_time,args.end_time,meter,funcid))
         datas = get_data_time(hbase_database,table,building,meter,funcid,args.start_time,args.end_time)
         for i in datas:
             data_time = i["data_time"]
@@ -77,7 +78,7 @@ args = parser.parse_args()
 # print(args.funcid)
 
 # 读取配置文件信息
-with open("config.json", "r") as f:
+with open("/mnt/datadisk0/saga/bi_saga/transfer_data/config.json", "r") as f:
     data = json.load(f)
     hbase_database = data["metadata"]["database"]
     url = data["metadata"]["url"]
@@ -120,8 +121,8 @@ for building in building_list:
 
         #电
         if args.funcid == 10101:
-            sqls = hbase_energy_data(points, "fjd_0_near_15min",building)
-            insert_mysql(sqls,building, my_fjd_table)
+            # sqls = hbase_energy_data(points, "fjd_0_near_15min",building)
+            # insert_mysql(sqls,building, my_fjd_table)
             sqls = hbase_energy_data(points, "data_servicedata_15min",building)
             insert_mysql(sqls,building, my_energy_table)
         #CO2