0

I am using Pyramid, SQLalchemy (with ZopeTransactionExtension), Postgresql and uwsgi and I have a problem with my web app.

So when I save object using DBSession.add(object) and flush DBSession.flush() I get no error and I even get the id of the newly created object, but when the page reloads I see success message but the object does not appear in the list of all objects. (No error was thrown. In PostgreSQL I can see my insert query and even COMMIT right after it)

This can be seen in API. When I create the new object it returns me it's id, 2 seconds later I delete this object and I get the error that object with this id does not exist. The problem occurs randomly (sometimes more often and sometimes less often) only on production/testing environment (not local) and disappears after rebuilding (It comes back after 1-2 days of uptime).

Had someone a similar problem?

Mesbah Gueffaf
  • 518
  • 1
  • 7
  • 21
Blejwi
  • 1,005
  • 2
  • 10
  • 25

1 Answers1

0

Check out this answer. Generally, everything that is flushed will be temporarily stored into the database and will be persisted when a .commit() happens.

Community
  • 1
  • 1
alexpeits
  • 847
  • 8
  • 18