feat: 从数据库转存到超表做count限制
This commit is contained in:
parent
bf98ea8a48
commit
d31cf4d143
|
|
@ -53,6 +53,10 @@ def db_insert_mplogx():
|
||||||
last_tag_id = config['enm'].get('last_tag_id', None)
|
last_tag_id = config['enm'].get('last_tag_id', None)
|
||||||
if last_tag_id is None:
|
if last_tag_id is None:
|
||||||
raise Exception("last_tag_id is None")
|
raise Exception("last_tag_id is None")
|
||||||
|
cursor.execute("select count(id) from tag_value where id > %s", (last_tag_id))
|
||||||
|
count = cursor.fetchone()[0]
|
||||||
|
if count > 400:
|
||||||
|
raise Exception("db inset count > 400")
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"select id, val, tag_code, update_time from tag_value where id > %s order by id, update_time", (last_tag_id))
|
"select id, val, tag_code, update_time from tag_value where id > %s order by id, update_time", (last_tag_id))
|
||||||
rows = cursor.fetchall() # 获取数据后保存至本地
|
rows = cursor.fetchall() # 获取数据后保存至本地
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue