0
所以我有一个烧瓶API端点看起来像这样Flask Rest API没有看到更新的表?
所以现在遇到的问题IM是,可以说我运行查询
"Select * from tables where IP = '123'" -> returns "Capacity" : 80
不过,后来我进入我的数据库本身和编辑容量为50.注意:通过数据库控制台本身而不是API。
然而,其余API需要5-10分钟才能看到表中的变化!尽管表中的相同查询返回50,但在剩余的API中向端点提供相同的查询仍然会返回80.
烧瓶应用程序本身内是否存在一些缓存?
编辑:看来,当我重新连接到数据库,以做工精细...嗯
db = MySQLdb.connect("address","iuser","pass","table")
cursor = db.cursor()
@app.route('/sqlStatement', methods=['POST'])
def run_statement():
try:
statement = request.values['statement']
try:
cursor.execute(statement)
except mysql.connector.Error: #MySQLdb.Warning) as e:
return "BAD SQL STATEMENT DUMBASS"
return jsonify(data=cursor.fetchall())
except (AttributeError, MySQLdb.OperationalError):
open_db()
return run_statement()