Skip to content

Commit b3079ee

Browse files
committed
fix: too many clients sql error
1 parent 233b745 commit b3079ee

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

execution_engine/converter/parser/fhir_parser_v1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ def parse_time_from_event(
7979

8080
new_combo = converter.to_temporal_combination(combo)
8181

82+
if not isinstance(new_combo, CriterionCombination):
83+
raise ValueError(f"Expected CriterionCombination, got {type(new_combo)}")
84+
8285
return new_combo
8386

8487
def parse_characteristics(self, ev: EvidenceVariable) -> CriterionCombination:

execution_engine/omop/sqlclient.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pandas as pd
66
import sqlalchemy
7-
from sqlalchemy import and_, bindparam, event, func, select, text
7+
from sqlalchemy import NullPool, and_, bindparam, event, func, select, text
88
from sqlalchemy.engine.interfaces import DBAPIConnection
99
from sqlalchemy.pool import ConnectionPoolEntry
1010
from sqlalchemy.sql import Insert, Select
@@ -83,6 +83,7 @@ def __init__(
8383
result_schema: str,
8484
timezone: str = "Europe/Berlin",
8585
disable_triggers: bool = False,
86+
null_pool: bool = False,
8687
) -> None:
8788
"""Initialize the OMOP SQL client."""
8889

@@ -97,6 +98,9 @@ def __init__(
9798
connection_string,
9899
connect_args={"options": "-csearch_path={}".format(self._data_schema)},
99100
future=True,
101+
poolclass=(
102+
NullPool if null_pool else None
103+
), # <--- ensures no persistent pool
100104
)
101105

102106
if disable_triggers:

execution_engine/task/task.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_engine() -> OMOPSQLClient:
2727
return OMOPSQLClient(
2828
**get_config().omop.model_dump(by_alias=True),
2929
timezone=get_config().timezone,
30+
null_pool=True,
3031
)
3132

3233

0 commit comments

Comments
 (0)