I do not update the table in postgresql with python

0

Query, the UPDATE clause with postgresql and psycopg2 generates problems for me, and I do not know why, the execution accepts the modification and without leaving the menu I see the changes, but in the bd postgresql table the update does not occur.

  

if opcionMenu == "1":
            print("Has pulsado la Opcion M2odificar Nit EPS")

            nit_eps=int(input("digite el nit a modificar"))
            nuevoniteps = int(input("digite el nuevo nit :" ))

            row=cur.execute("""UPDATE admin_eps SET nit_eps=%s WHERE nit_eps=%s""",([nuevoniteps, nit_eps]))
            if row:
                row.nit_eps = nuevoniteps
                conn.commit(row)
                conn.close()
  

What could be happening could someone guide me, I would appreciate the help.

> It also does not work with a select, and does not generate any error:

  

 if opcionMenu == "1":
            print("Has pulsado la Opcion M2odificar Nit EPS")
            nit_eps =[]

            nit_eps=int(input("digite el nit a modificar"))
            nuevoniteps = int(input("digite el nuevo nit :" ))
            #nuevoniteps = nit_eps

            cur.execute("""select * from admin_eps""")

            rows = [cur.fetchall()]

            if rows :
                nit_eps = nuevoniteps
                #cur.execute()
                conn.commit()
    
asked by Jsierra2017 02.03.2018 в 17:02
source

0 answers