python 2.7 - How to set timeouts of db calls using flask and SQLAlchemy? -
i need set timeout of db calls, , looked sqlalchemy documentation http://flask-sqlalchemy.pocoo.org/2.1/config/
there many configuration parameters, never illustrate example of how use them. show me how use sqlalchemy_pool_timeout in order set timeout of db calls? have them in .py files, don't know whether use parameter correctly.
app = flask(__name__) app.config["logger_name"] = ' '.join([app.logger_name, socket.gethostname(), instance_id]) app.config["sqlalchemy_database_uri"] = config.sqlalchemy_database_uri app.config["sqlalchemy_track_modifications"] = false app.config["sqlalchemy_pool_timeout"] = 30
the document states "specifies connection timeout pool. defaults 10." , don't know unit of 10, seconds or milliseconds?
Comments
Post a Comment