Postgresql sessions from psql and psycopg2

1.5k Views Asked by At

I am running two terminal sessions, in the first one I've opened psql, and in the second one ipython with psycopg2 imported. I'm connected to the same db in both sessions. When I update a table through ipython/psycopg2, psql session queries won't reflect the updates (i.e. I add a row in a table via psycopg2, and psql still fetches no rows). What am I doing wrong?

1

There are 1 best solutions below

1
Gwidryj On BEST ANSWER

Probably, after executing update you didn't execute commit() (it makes the changes to the database persistent) on the connection object. See the first example in the docs http://initd.org/psycopg/docs/usage.html