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. When I add a new record and try to get that record it doesn't exist.
I am using a script that adds records and I use one to get records.
I first tried it with SQLite, that worked perfectly. But with MySQL at Google Cloud SQL it doesn't.
Every time I add/change something to the database I use db.session.commit()
I use the pymysql module with this: pymysql.install_as_MySQLdb()
And my connection URI looks like this: mysql://...
Edit: This is what I use to add a new record (my script is for adding jokes):
new_joke = Jokes(joke, user["username"], user["id"], avatar_url, "0")
db.session.add(new_joke)
db.session.commit()
And this is what I use to get a record (random):
jokes = Jokes.query.all()
randint = random.randint(0, len(jokes) - 1)
joke = jokes[randint]