Django with PyODBC and Oracle 8i: Temporary Table Issues After a Day

I'm using Django with PyODBC to connect to an Oracle 8i database. I run my Django application using Uvicorn as an ASGI server. However, after running for a day, I encounter an issue where temporary tables in Oracle 8i behave strangely. Specifically:

  • After executing an INSERT query, the data sometimes does not appear immediately when queried.
  • I have to refresh the page multiple times to see the inserted data.
  • This issue seems to happen only after the server has been running for a long period.

Setup Details:

  • Database: Oracle 8i

  • Backend: Django with PyODBC

  • Server: Uvicorn (ASGI)

  • Temporary Tables: Used for session-specific data storage

What I Have Tried:

  • Explicitly committing transactions after INSERT operations.

  • Checking whether ON COMMIT DELETE ROWS is causing the issue.

  • Disabling connection pooling in PyODBC.

  • Reducing the number of Uvicorn workers to 1 to avoid session inconsistencies.

  • Querying SYS_CONTEXT('USERENV', 'SESSIONID') to check if I'm using different sessions.

Questions:

  • What could be causing the temporary table to not reflect recent inserts immediately?

  • Are there specific settings in PyODBC, Django, or Uvicorn that I should check to ensure session consistency?

  • Could this be an Oracle 8i-specific behavior related to temporary tables?

Any insights from experts who have dealt with Oracle 8i and Django/PyODBC would be greatly appreciated!

Вернуться на верх