I am using python3, postgress 10 and Psycopg2 to query multiple records like so
import psycopg2
conn = psycopg2.connect(<my connection string>)
with conn:
with conn.cursor() as cur:
cur.execute('select id,field1 from table1')
for id, field1 from cur.fetchall():
print(id,field1)
#todo: how up update field1 to be f(field1) where f is an arbitrary python function
My question is: how do i update the value of the rows that I am reading and set the value of field1 to some arbitrary python-based calculation
edit: the purpose is to update the rows in the table