I have a working Flask app with pretty extensive SQLite database (~100k entries). I'm struggling to bootstrap some ModelViews with Flask-App-Builder (FAB) in simplest way according to docs:
class MyModelView(ModelView): datamodel = SQLAInterface(MyModel) list_columns = ['col1', 'col2']
than enabling them like this:
It works fine. The problem is, every time I visit list view, it is generated from scratch - DB query, some FAB processing, template generation. And it is subjectively very slow (tens of seconds by wall clock; I'm not sure how to properly profile Flask application).
I think caching FAB views at some point may help speed up things, but I'm unsure how to go about it. For ordinary views I use Flask-Cache:
@app.route('/some_route') @cache.cached() def view_function(): data = time_consuming_operation() return render_template('template.html', data=data)
How one would use cache with FAB ModelViews? Is there a way to speed up work of FAB ModelViews?