From 659586947da4b57fb1b909d60e03683c23d5a8a6 Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Fri, 9 Aug 2024 09:39:30 -0400 Subject: [PATCH] checkpoint-postgres: fix setup for AsyncPostgresSaver (#1294) --- .../langgraph/checkpoint/postgres/aio.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py index e8b65322b..c325399e2 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py @@ -66,11 +66,10 @@ class AsyncPostgresSaver(BasePostgresSaver): async with self.lock: async with self.conn.cursor(binary=True) as cur: try: - version = ( - await cur.execute( - "SELECT v FROM checkpoint_migrations ORDER BY v DESC LIMIT 1" - ) - ).fetchone()["v"] + results = await cur.execute( + "SELECT v FROM checkpoint_migrations ORDER BY v DESC LIMIT 1" + ) + version = (await results.fetchone())["v"] except UndefinedTable: version = -1 for v, migration in zip(