docs: update Postgres checkpointer for persistence (#1556)

This commit is contained in:
gbaian10
2024-09-03 11:00:14 -04:00
committed by GitHub
parent c1d7cbd67c
commit e5b09b8c20
+5 -9
View File
@@ -132,8 +132,6 @@
"metadata": {},
"outputs": [],
"source": [
"from psycopg.rows import dict_row\n",
"\n",
"connection_kwargs = {\n",
" \"autocommit\": True,\n",
" \"prepare_threshold\": 0,\n",
@@ -161,15 +159,13 @@
"source": [
"from psycopg_pool import ConnectionPool\n",
"\n",
"pool = ConnectionPool(\n",
"with ConnectionPool(\n",
" # Example configuration\n",
" conninfo=DB_URI,\n",
" max_size=20,\n",
" kwargs=connection_kwargs,\n",
")\n",
"\n",
"with pool.connection() as conn:\n",
" checkpointer = PostgresSaver(conn)\n",
") as pool:\n",
" checkpointer = PostgresSaver(pool)\n",
"\n",
" # NOTE: you need to call .setup() the first time you're using your checkpointer\n",
" checkpointer.setup()\n",
@@ -394,8 +390,8 @@
" conninfo=DB_URI,\n",
" max_size=20,\n",
" kwargs=connection_kwargs,\n",
") as pool, pool.connection() as conn:\n",
" checkpointer = AsyncPostgresSaver(conn)\n",
") as pool:\n",
" checkpointer = AsyncPostgresSaver(pool)\n",
"\n",
" # NOTE: you need to call .setup() the first time you're using your checkpointer\n",
" # await checkpointer.setup()\n",