Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax BasePostgresSaver _search_where assumption (implements discussion 2396) #2409

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,14 @@ def _search_where(

# construct predicate for config filter
if config:
wheres.append("thread_id = %s ")
param_values.append(config["configurable"]["thread_id"])
checkpoint_ns = config["configurable"].get("checkpoint_ns")
if checkpoint_ns is not None:
if thread_id := config["configurable"].get("thread_id") is not None:
wheres.append("thread_id = %s")
param_values.append(thread_id)
if checkpoint_ns := config["configurable"].get("checkpoint_ns") is not None:
wheres.append("checkpoint_ns = %s")
param_values.append(checkpoint_ns)

if checkpoint_id := get_checkpoint_id(config):
wheres.append("checkpoint_id = %s ")
wheres.append("checkpoint_id = %s")
param_values.append(checkpoint_id)

# construct predicate for metadata filter
Expand Down