import psycopg2
# Establish a connection to the database
conn = psycopg2.connect(database="your_database", user="your_user", password="your_password", host="your_host", port="your_port")
# Create a cursor object to interact with the database
cur = conn.cursor()
# Switch the transaction mode to read-write
conn.set_session(autocommit=True)
# Now you can execute your UPDATE statement
cur.execute("UPDATE your_table SET column_name = new_value WHERE condition")
# Commit the transaction
conn.commit()
# Close the cursor and connection
cur.close()
conn.close()