add tags field

This commit is contained in:
pengtao 2019-11-04 11:22:56 +08:00
parent 78eba472f8
commit fb425f4157

View File

@ -3,7 +3,6 @@ from ops.mmysql import MysqlBase
from ops.plog import define_logger
import logging
import datetime
from collections import defaultdict
import pdb
define_logger("/data/logs/ops/split_tags.log")
log = logging.getLogger(__name__)
@ -21,8 +20,7 @@ class SplitTapTags:
def run(self):
all = dict()
for types in self.type:
pdb.set_trace()
all[types] = defaultdict[dict]
all[types] = {}
sql = f"""select
tags
from
@ -36,7 +34,7 @@ class SplitTapTags:
if line:
try:
for item in line[0].split(","):
all[types][item] = all[types].get('item', 0) + 1
all[types][item] = all[types].get(item, 0) + 1
except Exception:
log.error(f"split {line} failed!", exc_info=True)
print(all)