feat(orm): add pool_size parameter to get_postgres_engine for connection management

This commit is contained in:
2026-07-24 11:38:50 -04:00
parent 4861f58f27
commit 584b209dfa
+3
View File
@@ -36,6 +36,7 @@ def get_postgres_engine(
name: str = "POSTGRES",
pool_pre_ping: bool = True,
vector_engine: bool = False,
pool_size: int = 8,
) -> Engine:
"""Create a SQLAlchemy engine from environment variables.
@@ -45,6 +46,7 @@ def get_postgres_engine(
This fixes the issue of trying to use a conection that has timed out on the database side.
vector_engine (bool, optional): Whether to use the vector search schema. Defaults to False.
This updates the search path the incldued the vecore types and operators.
pool_size (int, optional): Number of connections to keep in the pool. Defaults to 8.
Returns:
Engine: The SQLAlchemy engine.
@@ -70,4 +72,5 @@ def get_postgres_engine(
pool_pre_ping=pool_pre_ping,
pool_recycle=1800,
connect_args=connect_args,
pool_size=pool_size,
)