添加tap 2 influxdb脚本

This commit is contained in:
pengtao 2019-11-27 15:22:28 +08:00
parent 9290622622
commit 5157037e3f

View File

@ -19,7 +19,7 @@ class TAP2Influx:
self.tga = FromTga(url=url, token=api_secret) self.tga = FromTga(url=url, token=api_secret)
self.day = day self.day = day
self.influx = InfluxDBClient('10.10.3.19', '8086', 'miles', 'aspect', 'tap_data') self.influx = InfluxDBClient('10.10.3.19', '8086', 'miles', 'aspect', 'tap_data')
self.measurement = "tapdata" self.measurement = "tapdata_new"
def get_tga_data(self): def get_tga_data(self):
sql = f"""SELECT sql = f"""SELECT
@ -47,9 +47,10 @@ class TAP2Influx:
try: try:
for line in data: for line in data:
gameid, catename, cate, title, score, tag, reserve, watch, download, sell, review, topic, createdat = line gameid, catename, cate, title, score, tag, reserve, watch, download, sell, review, topic, createdat = line
tags = {"gameid": int(gameid), "catename": catename, "cate": cate, "catedat": createdat} tags = {"gameid": int(gameid), "catename": catename}
fields = {"title": title, "score": score, "tag": tag, "reserve": reserve, "watch": watch, fields = {"title": title, "score": score, "tag": tag, "reserve": reserve, "watch": watch,
"download": download, "sell": sell, "review": review, "topic": topic} "download": download, "sell": sell, "review": review, "topic": topic, "cate": cate,
"catedat": createdat}
temp = {"measurement": self.measurement, "tags": tags, "fields": fields} temp = {"measurement": self.measurement, "tags": tags, "fields": fields}
body.append(temp) body.append(temp)
except Exception: except Exception: