From 6a22b7c26fe41741e3b7842602e046e0c542b05e Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Mon, 12 Aug 2024 13:24:59 -0400 Subject: [PATCH] docs: update async connection pool example in postgres how-to (#1318) --- examples/persistence_postgres.ipynb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/persistence_postgres.ipynb b/examples/persistence_postgres.ipynb index 7b62defefb..a78003a0ad 100644 --- a/examples/persistence_postgres.ipynb +++ b/examples/persistence_postgres.ipynb @@ -364,14 +364,12 @@ "source": [ "from psycopg_pool import AsyncConnectionPool\n", "\n", - "pool = AsyncConnectionPool(\n", + "async with AsyncConnectionPool(\n", " # Example configuration\n", " conninfo=DB_URI,\n", " max_size=20,\n", " kwargs=connection_kwargs\n", - ")\n", - "\n", - "async with pool.connection() as conn:\n", + ") as pool, pool.connection() as conn:\n", " checkpointer = AsyncPostgresSaver(conn)\n", "\n", " # NOTE: you need to call .setup() the first time you're using your checkpointer\n",