langgraph-checkpoint-postgres 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/PKG-INFO +1 -1
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/store/postgres/aio.py +6 -2
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/store/postgres/base.py +10 -15
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/pyproject.toml +1 -1
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/README.md +0 -0
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/checkpoint/postgres/__init__.py +0 -0
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/checkpoint/postgres/aio.py +0 -0
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/checkpoint/postgres/base.py +0 -0
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/checkpoint/py.typed +0 -0
- {langgraph_checkpoint_postgres-2.0.0 → langgraph_checkpoint_postgres-2.0.1}/langgraph/store/postgres/__init__.py +0 -0
|
@@ -18,6 +18,7 @@ from psycopg.errors import UndefinedTable
|
|
|
18
18
|
from psycopg.rows import dict_row
|
|
19
19
|
|
|
20
20
|
from langgraph.store.base import GetOp, ListNamespacesOp, Op, PutOp, Result, SearchOp
|
|
21
|
+
from langgraph.store.base.batch import AsyncBatchedBaseStore
|
|
21
22
|
from langgraph.store.postgres.base import (
|
|
22
23
|
BasePostgresStore,
|
|
23
24
|
Row,
|
|
@@ -29,7 +30,9 @@ from langgraph.store.postgres.base import (
|
|
|
29
30
|
logger = logging.getLogger(__name__)
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
class AsyncPostgresStore(BasePostgresStore[AsyncConnection]):
|
|
33
|
+
class AsyncPostgresStore(AsyncBatchedBaseStore, BasePostgresStore[AsyncConnection]):
|
|
34
|
+
__slots__ = ("_deserializer",)
|
|
35
|
+
|
|
33
36
|
def __init__(
|
|
34
37
|
self,
|
|
35
38
|
conn: AsyncConnection[Any],
|
|
@@ -38,7 +41,8 @@ class AsyncPostgresStore(BasePostgresStore[AsyncConnection]):
|
|
|
38
41
|
Callable[[Union[bytes, orjson.Fragment]], dict[str, Any]]
|
|
39
42
|
] = None,
|
|
40
43
|
) -> None:
|
|
41
|
-
super().__init__(
|
|
44
|
+
super().__init__()
|
|
45
|
+
self._deserializer = deserializer
|
|
42
46
|
self.conn = conn
|
|
43
47
|
self.conn = conn
|
|
44
48
|
self.loop = asyncio.get_running_loop()
|
|
@@ -59,20 +59,10 @@ CREATE INDEX IF NOT EXISTS store_prefix_idx ON store USING btree (prefix text_pa
|
|
|
59
59
|
C = TypeVar("C", bound=BaseConnection)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
class BasePostgresStore(
|
|
62
|
+
class BasePostgresStore(Generic[C]):
|
|
63
63
|
MIGRATIONS = MIGRATIONS
|
|
64
64
|
conn: C
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def __init__(
|
|
68
|
-
self,
|
|
69
|
-
*,
|
|
70
|
-
deserializer: Optional[
|
|
71
|
-
Callable[[Union[bytes, orjson.Fragment]], dict[str, Any]]
|
|
72
|
-
] = None,
|
|
73
|
-
) -> None:
|
|
74
|
-
super().__init__()
|
|
75
|
-
self._deserializer = deserializer
|
|
65
|
+
_deserializer: Optional[Callable[[Union[bytes, orjson.Fragment]], dict[str, Any]]]
|
|
76
66
|
|
|
77
67
|
def _get_batch_GET_ops_queries(
|
|
78
68
|
self,
|
|
@@ -166,7 +156,9 @@ class BasePostgresStore(BaseStore, Generic[C]):
|
|
|
166
156
|
params.extend([key, json.dumps(value)])
|
|
167
157
|
query += " AND " + " AND ".join(filter_conditions)
|
|
168
158
|
|
|
169
|
-
|
|
159
|
+
# Note: we will need to not do this if sim/keyword search
|
|
160
|
+
# is used
|
|
161
|
+
query += " ORDER BY updated_at DESC LIMIT %s OFFSET %s"
|
|
170
162
|
params.extend([op.limit, op.offset])
|
|
171
163
|
|
|
172
164
|
queries.append((query, params))
|
|
@@ -227,7 +219,9 @@ class BasePostgresStore(BaseStore, Generic[C]):
|
|
|
227
219
|
return queries
|
|
228
220
|
|
|
229
221
|
|
|
230
|
-
class PostgresStore(BasePostgresStore[Connection]):
|
|
222
|
+
class PostgresStore(BaseStore, BasePostgresStore[Connection]):
|
|
223
|
+
__slots__ = ("_deserializer",)
|
|
224
|
+
|
|
231
225
|
def __init__(
|
|
232
226
|
self,
|
|
233
227
|
conn: Connection[Any],
|
|
@@ -236,7 +230,8 @@ class PostgresStore(BasePostgresStore[Connection]):
|
|
|
236
230
|
Callable[[Union[bytes, orjson.Fragment]], dict[str, Any]]
|
|
237
231
|
] = None,
|
|
238
232
|
) -> None:
|
|
239
|
-
super().__init__(
|
|
233
|
+
super().__init__()
|
|
234
|
+
self._deserializer = deserializer
|
|
240
235
|
self.conn = conn
|
|
241
236
|
|
|
242
237
|
def batch(self, ops: Iterable[Op]) -> list[Result]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|