The client was disconnected by the server because of inactivity.

Hello, when i'm trying to load a page with information from my SQLDatabase, i often have this type of error : "The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior." I have to refresh the page once to fix it temporarily . I tried to add this line to my but it didn't help or maybe i missed something : app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {'pool_recycle' : 280}, Thanks in advance for your advices.

That looks like the correct code to set the connection management timeout parameters, so it should fix the issue. Could you post all of the code that you're using to set up the database connection? You can replace the password and any other secret stuff (like the app's secret key) in the posted code with something like [REDACTED].

it goes like that. Does the order have to do something with it ?

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://$XXX'
app.config['SECRET_KEY'] = 'XXX'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {'pool_recycle' : 280}

Yes, I think you've spotted the problem -- the SQLAlchemy library will read in those settings at the time that it's created. So if you put your last line, where you do the pool_recycle stuff, above that line -- perhaps immediately after the line where you set the SQLALCHEMY_DATABASE_URI -- then that should fix the problem.