add tags field
This commit is contained in:
parent
78eba472f8
commit
fb425f4157
@ -3,7 +3,6 @@ from ops.mmysql import MysqlBase
|
|||||||
from ops.plog import define_logger
|
from ops.plog import define_logger
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
from collections import defaultdict
|
|
||||||
import pdb
|
import pdb
|
||||||
define_logger("/data/logs/ops/split_tags.log")
|
define_logger("/data/logs/ops/split_tags.log")
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -21,8 +20,7 @@ class SplitTapTags:
|
|||||||
def run(self):
|
def run(self):
|
||||||
all = dict()
|
all = dict()
|
||||||
for types in self.type:
|
for types in self.type:
|
||||||
pdb.set_trace()
|
all[types] = {}
|
||||||
all[types] = defaultdict[dict]
|
|
||||||
sql = f"""select
|
sql = f"""select
|
||||||
tags
|
tags
|
||||||
from
|
from
|
||||||
@ -36,7 +34,7 @@ class SplitTapTags:
|
|||||||
if line:
|
if line:
|
||||||
try:
|
try:
|
||||||
for item in line[0].split(","):
|
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:
|
except Exception:
|
||||||
log.error(f"split {line} failed!", exc_info=True)
|
log.error(f"split {line} failed!", exc_info=True)
|
||||||
print(all)
|
print(all)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user