0

I am creating a session to the DB using

sessionmaker(bind=engine)

Then I want to read all data from a DB table using

session.query(SomeTask).all()

The second call and on, are always giving me the same result as the first call although the data in the DB changes (assume I am changing the data in the DB using an external tool like MySQL workbench)

I am changing the code in the DB using a tool

How do I force a call to the DB each time ?

Ilja Everilä
  • 50,538
  • 7
  • 126
  • 127
asaf
  • 958
  • 1
  • 16
  • 38
  • Please tell us how you are changing the data in the DB, or show your code that does so. Right now it is unclear how is the data update being done. – Epion Sep 21 '19 at 17:59
  • Please read https://docs.sqlalchemy.org/en/13/orm/session_basics.html#committing and the note about transaction isolation from https://docs.sqlalchemy.org/en/13/orm/session_state_management.html#when-to-expire-or-refresh. You are making a call to the DB each time, but likely in the same transaction (and MySQL even defaults to REPEATABLE READ). – Ilja Everilä Sep 21 '19 at 19:32

0 Answers0