diff --git a/ereuse_devicehub/db.py b/ereuse_devicehub/db.py index 16ede4fc..1a63f431 100644 --- a/ereuse_devicehub/db.py +++ b/ereuse_devicehub/db.py @@ -70,6 +70,9 @@ def create_view(name, selectable): return table -db = SQLAlchemy(session_options={'autoflush': False}) +db = SQLAlchemy( + session_options={'autoflush': False}, + engine_options={"pool_size": 5, "max_overflow": 10} +) f = db.func exp = expression diff --git a/ereuse_devicehub/teal/db.py b/ereuse_devicehub/teal/db.py index 7f0b8c7f..cc863481 100644 --- a/ereuse_devicehub/teal/db.py +++ b/ereuse_devicehub/teal/db.py @@ -240,9 +240,10 @@ class SQLAlchemy(FlaskSQLAlchemy): metadata=None, query_class=BaseQuery, model_class=Model, + engine_options=None, ): super().__init__( - app, use_native_unicode, session_options, metadata, query_class, model_class + app, use_native_unicode, session_options, metadata, query_class, model_class, engine_options ) def create_session(self, options): @@ -266,9 +267,10 @@ class SchemaSQLAlchemy(SQLAlchemy): metadata=None, query_class=Query, model_class=Model, + engine_options=None, ): super().__init__( - app, use_native_unicode, session_options, metadata, query_class, model_class + app, use_native_unicode, session_options, metadata, query_class, model_class, engine_options ) # The following listeners set psql's search_path to the correct # schema and create the schemas accordingly