When i run this SQL query via psql client it runs for several seconds (~90 seconds, that's normal since its a huge table) and it return, then i can check that my line is successfully inserted.
SELECT merge_data('898989', '111111111', '10000')
It is a stored procedure that runs an UPDATE or INSERT, the procedure is ran without errors and i get my entry in the table.
When trying to do the same from a python program, the query take 2 seconds and returns no errors, i get nothing in my table; for information, the statement is successfully executed on postgresqk backed (i can see it in pgsql logs), here's my code snippet:
conn = psycopg2.connect("...")
cursor = conn.cursor()
try:
cursor.callproc("merge_data", ['898989', '111111111', '10000'])
except:
print "ERROR !"
cursor.close()
Resolved !
By default, psycopg2 doesnt autocommit on each executed statement, so once i close the connection (at the end) all pending transactions are discarded as if a ROLLBACK was performed.
One may call conn.commit() after each cursor.execute() or .callproc, or just set it at a global scope using