Commit 0bb76339 authored by 高雅喆's avatar 高雅喆

恢复画像数据写tidb

parent 90e88d11
......@@ -115,12 +115,12 @@ def get_user_tag_score(cl_id, all_log_df, size=10):
tag_id_list_json = json.dumps(tag_id_list)
gm_kv_cli.set(cl_id_portrait_key, tag_id_list_json)
# 写tidb
# replace_sql = """replace into user_portrait_tags (stat_date, cl_id, tag_list) values("{stat_date}","{cl_id}","{tag_list}")"""\
# .format(stat_date=stat_date, cl_id=cl_id, tag_list=tag_id_list)
# cur_jerry_test.execute(replace_sql)
# db_jerry_test.commit()
# db_jerry_test.close()
# return "sucess"
replace_sql = """replace into user_portrait_tags (stat_date, cl_id, tag_list) values("{stat_date}","{cl_id}","{tag_list}")"""\
.format(stat_date=stat_date, cl_id=cl_id, tag_list=tag_id_list)
cur_jerry_test.execute(replace_sql)
db_jerry_test.commit()
db_jerry_test.close()
return "sucess"
except Exception as e:
return 'pass'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment