Thursday, 15 May 2014

python - psycopg update doesn't work -


I am trying to use psycopg to update some rows in the postgre database And to do anything ', the script can be run without any errors, but the database does not change.

  import psycopg2 conn = psycopg2.connect ("dbname = timetrack user = n") cur = conn.cursor) cur.execute ("id, remove (select era from the beginning) Remove the form (e-mail from the term) ";) Rows = cur.fetchall () m = 10 ** 6 for the category i (0, line (rows)): line = rows [i] print (Line) cur.execute ("start update activities = (% s), \" end \ "= (% s) where id = (% s);", (line [0] * m, row [1] * M, row [2])) conn.commit () cur.close () conn.close ()  

find this address I have made a mistake in indexing the row variables. I want to begin to start, ends at the end, and want to ID the ID in the string. However, I started the ending setting ID, end to start, and ID to start. No rows could be found to update postgres because the id was incorrect, so it did nothing.


No comments:

Post a Comment