Most likely, your application does not use the Flask-SQLAlchemy event system, so you can probably disable it. You will need to check the code to check - you are looking for anything that connects to models_committed or before_models_committed . If you find yourself using the Flask-SQLAlchemy event system, you should probably update your code to use the SQLAlchemy built-in event system.
To disable the Flask-SQLAlchemy event system (and disable the warning), simply add SQLALCHEMY_TRACK_MODIFICATIONS = False to the application configuration until the default value is changed (most likely in Flask-SQLAlchemy v3).
Background is what warns you:
Flask-SQLAlchemy has its own event notification system, which is superimposed on top of SQLAlchemy. To do this, it tracks changes to the SQLAlchemy session. This requires additional resources, so the SQLALCHEMY_TRACK_MODIFICATIONS option allows SQLALCHEMY_TRACK_MODIFICATIONS to disable the change tracking system. Currently, the default setting is True , but in the future, this default value will change to False , thereby disabling the event system.
As I understand it, the rationale for the change is three times:
Not many people use the Flask-SQLAlchemy event system, but most people do not realize that they can save system resources by disabling it. Thus, by default it is to disable it, and those who want it can enable it.
The event system in Flask-SQLAlchemy was rather erroneous (see problems associated with the pull request below), requiring additional maintenance for a function that few people use.
In v0.7, SQLAlchemy itself added a powerful event system, including the ability to create custom events. Ideally, the Flask-SQLAlchemy event system should do nothing more than create multiple custom event hooks and SQLAlchemy listeners, and then allow SQLAlchemy to independently control the event trigger.
You can see more in the discussion of the pull request that started to raise this warning .
Jeff Widman Nov 18 '15 at 20:56 2015-11-18 20:56
source share