Commit c6a571aa authored by Your Name's avatar Your Name

bug fix

parent 695259ff
......@@ -213,8 +213,10 @@ def update_or_insert(df2,queue_name):
cur = con.cursor()
try:
for i in range(0, device_count):
query = "INSERT INTO esmm_device_diary_queue_test (device_id, city_id, time,%s) VALUES(%s, %s, %s, %s) ON DUPLICATE KEY UPDATE device_id=%s, city_id=%s, time=%s, %s=%s"
cur.execute(query, (queue_name, df2.device_id[i], df2.city_id[i], df2.time[i], df2[queue_name][i], df2.device_id[i], df2.city_id[i], df2.time[i], queue_name, df2[queue_name][i]))
query = """INSERT INTO esmm_device_diary_queue_test (device_id, city_id, time,%s) VALUES(%s, %s, %s, %s) \
ON DUPLICATE KEY UPDATE device_id=%s, city_id=%s, time=%s, %s=%s""" % (queue_name, df2.device_id[i],df2.city_id[i], df2.time[i], df2[queue_name][i], df2.device_id[i], df2.city_id[i], df2.time[i], queue_name, df2[queue_name][i])
print(query)
cur.execute(query)
con.commit()
con.close()
print("insert or update sucess")
......
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