How to avoid caching in sqlalchemy?

I have a problem with SQL Alchemy - my application works as a constantly running python application.

I have a function like this:

def myFunction(self, param1):
   s = select([statsModel.c.STA_ID, statsModel.c.STA_DATE)])\
                        .select_from(statsModel)

   statsResult = self.connection.execute(s).fetchall()

   return {'result': statsResult, 'calculation': param1}

I think this is a clear example - one set of results is retrieved from the database, the second only as an argument.

The problem is that when the data in my database changes, this function still returns data, since nothing has changed. When I modify the data in the input parameter, the returned calculation parameter has the correct value.

When I restart the application server, the situation returns to normal - new data is retrieved from MySQL.

I know that there were several questions about SQLAlchemy caching, for example:

How to disable caching in an orm Sqlalchemy session?

How to disable SQLAlchemy caching?

? , SQLAlchemy . ?

+5
2
+10

.

  • session . , session , , , . , , , , , session .
  • , , session, session. "", , , . API ORM SQLAlchemy, .
  • . , , , , , .

: , SQLAlchemy , echo=True create_engine. , .

- , ORM , , . , .

+1

All Articles