@@ -47,7 +47,10 @@ A list of configuration keys currently understood by the extension:
47
47
connections after 8 hours idle by
48
48
default. Note that Flask-SQLAlchemy
49
49
automatically sets this to 2 hours if
50
- MySQL is used.
50
+ MySQL is used. Some backends may use a
51
+ different default timeout value. For more
52
+ information about timeouts see
53
+ :ref: `timeouts `.
51
54
``SQLALCHEMY_MAX_OVERFLOW `` Controls the number of connections that
52
55
can be created after the pool reached
53
56
its maximum size. When those additional
@@ -144,3 +147,21 @@ example, as suggested by the SQLAlchemy docs::
144
147
For more info about :class: `~sqlalchemy.schema.MetaData `,
145
148
`check out the official docs on it
146
149
<http://docs.sqlalchemy.org/en/latest/core/metadata.html> `_.
150
+
151
+ .. _timeouts :
152
+
153
+ Timeouts
154
+ --------
155
+
156
+ Certain database backends may impose different inactive connection timeouts,
157
+ which interferes with Flask-SQLAlchemy's connection pooling.
158
+
159
+ By default, MariaDB is configured to have a 600 second timeout. This often
160
+ surfaces hard to debug, production environment only exceptions like ``2013: Lost connection to MySQL server during query ``.
161
+
162
+ If you are using a backend (or a pre-configured database-as-a-service) with a
163
+ lower connection timeout, it is recommended that you set
164
+ `SQLALCHEMY_POOL_RECYCLE ` to a value less than your backend's timeout.
165
+
166
+
167
+
0 commit comments