From 9c7db48362bb5ee44d433c17dfdb11bb4aaf18ee Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Mon, 17 Feb 2020 21:36:01 -0800 Subject: [PATCH] Explicitly disable `SQLALCHEMY_TRACK_MODIFICATIONS` This silences deprecation warnings. Background: https://stackoverflow.com/a/33790196/770425 Note: This code can be removed once `flask_sqlalchemy` 3.0 ships, or any release that includes https://github.com/pallets/flask-sqlalchemy/pull/727. --- example/example.py | 4 ++++ test/basic_app.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/example/example.py b/example/example.py index a13b7a9..8ea9e46 100644 --- a/example/example.py +++ b/example/example.py @@ -17,6 +17,10 @@ #app.config['DEBUG_TB_HOSTS'] = ('127.0.0.1', '::1' ) app.config['SECRET_KEY'] = 'asd' app.config['DEBUG'] = True + +# TODO: This can be removed once flask_sqlalchemy 3.0 ships +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False + app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' db = SQLAlchemy(app) diff --git a/test/basic_app.py b/test/basic_app.py index c199951..beb2c32 100644 --- a/test/basic_app.py +++ b/test/basic_app.py @@ -8,6 +8,9 @@ app.debug = True app.config['SECRET_KEY'] = 'abc123' +# TODO: This can be removed once flask_sqlalchemy 3.0 ships +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False + # make sure these are printable in the config panel app.config['BYTES_VALUE'] = b'\x00' app.config['UNICODE_VALUE'] = u'\uffff'