Skip to content Skip to sidebar Skip to footer

Mysql Data Is Caching With Google Cloud Sql And Sqlalchemy

This is my first question on stackoverflow, so please correct me if I do something wrong :). My data from a database hosted at Google Cloud SQL is caching with Flask-SQLAlchemy. Wh

Solution 1:

I found an answer!

By doing db.session.commit() before making a query, it refreshes it's cache.

My code now looks like this:

db.session.commit()
jokes = Jokes.query.all()
randint = random.randint(0, len(jokes) - 1)
joke = jokes[randint]

Post a Comment for "Mysql Data Is Caching With Google Cloud Sql And Sqlalchemy"