From 8d339381739508c33de42fbef27faa60bf18cfa3 Mon Sep 17 00:00:00 2001 From: ArrayPD Date: Tue, 18 Mar 2025 17:29:05 -0400 Subject: [PATCH] Improve documentation string for SqliteSaver (#3857) * Document that `check_same_thread` as an option when creating sqlite connection. * Document why it's OK to do that. --------- Co-authored-by: Eugene Yurtsev --- .../langgraph/checkpoint/sqlite/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py index 71a098f75..a53728ab1 100644 --- a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py +++ b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py @@ -56,7 +56,10 @@ class SqliteSaver(BaseCheckpointSaver[str]): >>> builder.add_node("add_one", lambda x: x + 1) >>> builder.set_entry_point("add_one") >>> builder.set_finish_point("add_one") - >>> conn = sqlite3.connect("checkpoints.sqlite") + >>> # Create a new SqliteSaver instance + >>> # Note: check_same_thread=False is OK as the implementation uses a lock + >>> # to ensure thread safety. + >>> conn = sqlite3.connect("checkpoints.sqlite", check_same_thread=False) >>> memory = SqliteSaver(conn) >>> graph = builder.compile(checkpointer=memory) >>> config = {"configurable": {"thread_id": "1"}}