0

I have a situation, where I save something to a postgres database with with dbsession.begin() as session: and as a next step, outside of the with-clause, I try to get the just updated value, with the following call:

table.query.filter(table.name == full_name).all()

the query works perfectly, except that it doesn't deliver the current (updated) values.

any idea, why this happens? can someone explain, why the query without a session does not load the current data?

Thanks for your help

MGmuer
  • 51
  • 4
  • Postgres does not support READ UNCOMITTED and even if it did, that is not the typical default isolation level. You will need to `commit` in your session to see the changes outside it. See Also : [PostgreSQL Transaction Isolation READ UNCOMMITTED](https://stackoverflow.com/a/33648607/218663) – JonSG Jul 20 '23 at 14:58
  • But if I close the with clause, the commit and close of the session is completed. So this is not the problem. I even tested it manually and it did not change anything – MGmuer Jul 20 '23 at 15:36
  • commit will end a transaction not a session – JonSG Jul 20 '23 at 15:39
  • You could try setting `engine.echo = True` before your `with` block to see if a COMMIT really does take place when it exits. – Gord Thompson Jul 20 '23 at 17:11

0 Answers0