Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. update_list = [['11259761' '24' '15.169291741233783']
  2. ['15293357' '82' '0.5716360249451222']
  3. ['18833226' '56' '7.073284312907512']
  4. ...
  5. ['75212792' '55' '0.31338063342346445']
  6. ['75213202' '62' '0.1843318978715103']
  7. ['8295513' '45' '3.9280856957929116']]
  8.  
  9. con = pymysql.connect('connection settings here')
  10. with con:
  11. cursor = con.cursor()
  12. sql = ("INSERT INTO properties (id, closest_point, distance_from_closest_point) VALUES (%s, %s, %s)"
  13. "ON DUPLICATE KEY UPDATE closest_point=VALUES(closest_point), distance_from_closest_point=VALUES(distance_from_closest_point)")
  14. cursor.executemany(sql, update_list)
  15. con.commit()
  16. print("done")
  17.  
  18. ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement