Library with an Oracle Database implementation of LangGraph checkpoint saver.
Project description
LangGraph Checkpoint Oracle
Implementation of LangGraph CheckpointSaver that uses Oracle Database.
[!TIP] The code in this repository tries to mimic the code in langgraph-checkpoint-postgres as much as possible to enable keeping in sync with the official checkpointer implementation.
[!NOTE] This implementation uses Oracle-specific SQL syntax and data types. Oracle Database 19c or later is recommended.
Supported Oracle Database
Oracle Database 18c or later is recommended.
Dependencies
To use Both synchronous OracleSaver and asynchronous AsyncOracleSaver, install the oracledb package.
There is currently no support for other drivers.
Usage
[!IMPORTANT] When using Oracle checkpointers for the first time, make sure to call the
.setup()method to create required tables. See example below.
[!IMPORTANT] When manually creating Oracle connections and passing them to
OracleSaver, pay attention to transaction management.
[!IMPORTANT]
__|default|__is not allowed as acheckpoint_nsbecause it is reserved for internal use.
from oracledb import ConnectParams
from langgraph.checkpoint.oracle import OracleSaver
write_config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
read_config = {"configurable": {"thread_id": "1"}}
DB_PARAMS = {
"user": "user",
"password": "password",
"dsn": "localhost:1521/ORCLPDB1",
}
params = ConnectParams(host="localhost", port=1521, service_name="FREE", user="system", password="test")
with OracleSaver.from_conn_params(DB_PARAMS) as checkpointer:
# call .setup() the first time you're using the checkpointer
checkpointer.setup()
checkpoint = {
"v": 2,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
"pending_sends": [],
}
# store checkpoint
checkpointer.put(write_config, checkpoint, {}, {})
# load checkpoint
checkpointer.get(read_config)
# list checkpoints
list(checkpointer.list(read_config))
Async
from oracledb import ConnectParams
from langgraph.checkpoint.oracle.aio import AsyncOracleSaver
params = ConnectParams(host="localhost", port=1521, service_name="FREE", user="system", password="test")
async with AsyncOracleSaver.from_conn_params(params) as checkpointer:
checkpoint = {
"v": 2,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
"pending_sends": [],
}
# store checkpoint
await checkpointer.aput(write_config, checkpoint, {}, {})
# load checkpoint
await checkpointer.aget(read_config)
# list checkpoints
[c async for c in checkpointer.alist(read_config)]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_checkpoint_oracle-2.0.0rc7.tar.gz.
File metadata
- Download URL: langgraph_checkpoint_oracle-2.0.0rc7.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.2 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c6f22d9610608794cdadb83c9c6cf6bd22b60fda332cf7e160210ffa9db2024
|
|
| MD5 |
dc5f4b072d6d09a4f283f7bb51b9c667
|
|
| BLAKE2b-256 |
c815bc804adbc3aa6c0689bb8578a72d72ae348f175e75d146a34e45150ae04d
|
File details
Details for the file langgraph_checkpoint_oracle-2.0.0rc7-py3-none-any.whl.
File metadata
- Download URL: langgraph_checkpoint_oracle-2.0.0rc7-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.2 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc442e4d2f370a11a303784307f17ce8636e42ad2aa697aebf545807fdebdfa
|
|
| MD5 |
7cf596dcba3a22f29370b9e397ea2f3b
|
|
| BLAKE2b-256 |
b039979164179f6bff6eca9363944ebc694b047ff6e8c512b9f05d9293426ab9
|