如果自动识别没有数据,不再同步到数据库

This commit is contained in:
2024-08-07 15:15:48 +08:00
parent b9cdd95eea
commit 198e833602

View File

@@ -139,6 +139,9 @@ def get_values_of_keys(source, keys):
def save_or_update_ie(table, pk_phhd, data):
data = {k: v for k, v in data.items() if v is not None and v != ""}
if len(data) < 2:
# 没有识别数据就不存表了,因为pk_phhd一般都会有所以判断小于2
return
obj = table(**data)
session = MysqlSession()
db_data = session.query(table).filter_by(pk_phhd=pk_phhd).one_or_none()