fix change max connections

This commit is contained in:
Cayo Puigdefabregas 2024-01-30 12:04:17 +01:00
parent e687cef4a3
commit 660fe41b62
2 changed files with 8 additions and 3 deletions

View File

@ -70,6 +70,9 @@ def create_view(name, selectable):
return table 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 f = db.func
exp = expression exp = expression

View File

@ -240,9 +240,10 @@ class SQLAlchemy(FlaskSQLAlchemy):
metadata=None, metadata=None,
query_class=BaseQuery, query_class=BaseQuery,
model_class=Model, model_class=Model,
engine_options=None,
): ):
super().__init__( 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): def create_session(self, options):
@ -266,9 +267,10 @@ class SchemaSQLAlchemy(SQLAlchemy):
metadata=None, metadata=None,
query_class=Query, query_class=Query,
model_class=Model, model_class=Model,
engine_options=None,
): ):
super().__init__( 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 # The following listeners set psql's search_path to the correct
# schema and create the schemas accordingly # schema and create the schemas accordingly