llama-stack-mirror/llama_stack/providers/utils/sqlstore
Omer Tuchfeld 49c34dd0d4 Use pool_pre_ping=True in SQLAlchemy engine creation
We noticed that when llama-stack is running for a long time,  we would
run into database errors when trying to run messages through the agent
(which we configured to persist against postgres), seemingly due to the
database connections being stale or disconnected. This commit adds
`pool_pre_ping=True` to the SQLAlchemy engine creation to help mitigate
this issue by checking the connection before using it, and
re-establishing it if necessary.

More information in:

https://docs.sqlalchemy.org/en/20/core/pooling.html#dealing-with-disconnects

We're also open to other suggestions on how to handle this issue, this
PR is just a suggestion, we have not tested it yet (we're in the process
of doing that) and we're hoping it's going to resolve our issue.
2025-08-20 13:33:00 +02:00
..
__init__.py ci: add python package build test (#2457) 2025-06-19 18:57:32 +05:30
api.py feat: support auth attributes in inference/responses stores (#2389) 2025-06-20 10:24:45 -07:00
authorized_sqlstore.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
sqlalchemy_sqlstore.py Use pool_pre_ping=True in SQLAlchemy engine creation 2025-08-20 13:33:00 +02:00
sqlstore.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00