add tags field
This commit is contained in:
parent
fb425f4157
commit
4c7c9a310f
@ -17,7 +17,7 @@ class SplitTapTags:
|
|||||||
self.day = day
|
self.day = day
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def get_data(self):
|
||||||
all = dict()
|
all = dict()
|
||||||
for types in self.type:
|
for types in self.type:
|
||||||
all[types] = {}
|
all[types] = {}
|
||||||
@ -38,6 +38,26 @@ class SplitTapTags:
|
|||||||
except Exception:
|
except Exception:
|
||||||
log.error(f"split {line} failed!", exc_info=True)
|
log.error(f"split {line} failed!", exc_info=True)
|
||||||
print(all)
|
print(all)
|
||||||
|
return all
|
||||||
|
|
||||||
|
def write2db(self, data):
|
||||||
|
db_data = {}
|
||||||
|
tables_name = "tap_tags_counts"
|
||||||
|
for key in data.keys():
|
||||||
|
for k in data[key]:
|
||||||
|
db_data['type'] = key
|
||||||
|
db_data['name'] = k
|
||||||
|
db_data['date'] = self.day
|
||||||
|
db_data['nums'] = data[key][k]
|
||||||
|
try:
|
||||||
|
self.db_conn.insert(tables_name, db_data)
|
||||||
|
except Exception:
|
||||||
|
log.error(f"insert {db_data} failed!", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
data = self.get_data()
|
||||||
|
self.write2db(data)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user