Skip to content

Commit e0bdb24

Browse files
authored
Merge pull request #22 from davidzhangbj/modifyPackageName
optimize: rename all MySQL-related package names, file names, and var…
2 parents 6f2abf6 + 7c38832 commit e0bdb24

28 files changed

Lines changed: 106 additions & 106 deletions

langgraph-checkpoint-oceanbase-plugin/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ In LangGraph's definition, Checkpointer refers to short-term memory (i.e. memory
2424
```python
2525
from langchain.chat_models import init_chat_model
2626
from langgraph.graph import StateGraph, MessagesState, START
27-
from langgraph.checkpoint.mysql.pymysql import PyMySQLSaver
27+
from langgraph.checkpoint.oceanbase.pyoceanbase import PyOceanBaseSaver
2828
from langchain_core.runnables.config import RunnableConfig
2929
from langchain_core.messages import HumanMessage
3030
model = init_chat_model(model="qwen-max-latest", api_key="xxx",
3131
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", model_provider="openai",temperature=0)
3232
DB_URI = "mysql://username:password@ip:port/database"
33-
with PyMySQLSaver.from_conn_string(DB_URI) as checkpointer:
33+
with PyOceanBaseSaver.from_conn_string(DB_URI) as checkpointer:
3434
checkpointer.setup()
3535

3636
def call_model(state: MessagesState):
@@ -63,7 +63,7 @@ with PyMySQLSaver.from_conn_string(DB_URI) as checkpointer:
6363
from langchain_core.runnables import RunnableConfig
6464
from langgraph.config import get_store
6565
from langgraph.prebuilt import create_react_agent
66-
from langgraph.store.mysql import PyMySQLStore
66+
from langgraph.store.oceanbase import PyOceanBaseStore
6767
from langchain.chat_models import init_chat_model
6868
from langchain_core.messages import HumanMessage
6969
from typing_extensions import TypedDict
@@ -86,7 +86,7 @@ def save_user_info(user_info: UserInfo, config: RunnableConfig) -> str:
8686
return "Successfully saved user info."
8787

8888

89-
with PyMySQLStore.from_conn_string(DB_URI) as store:
89+
with PyOceanBaseStore.from_conn_string(DB_URI) as store:
9090
store.setup()
9191
agent=create_react_agent(
9292
model=model,

langgraph-checkpoint-oceanbase-plugin/README_CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ langgraph-checkpoint-oceanbase 已经上传到 PyPI。可以使用下面的命
2424
```python
2525
from langchain.chat_models import init_chat_model
2626
from langgraph.graph import StateGraph, MessagesState, START
27-
from langgraph.checkpoint.mysql.pymysql import PyMySQLSaver
27+
from langgraph.checkpoint.oceanbase.pyoceanbase import PyOceanBaseSaver
2828
from langchain_core.runnables.config import RunnableConfig
2929
from langchain_core.messages import HumanMessage
3030
model = init_chat_model(model="qwen-max-latest", api_key="xxx",
3131
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", model_provider="openai",temperature=0)
3232
DB_URI = "mysql://username:password@ip:port/database"
33-
with PyMySQLSaver.from_conn_string(DB_URI) as checkpointer:
33+
with PyOceanBaseSaver.from_conn_string(DB_URI) as checkpointer:
3434
checkpointer.setup()
3535

3636
def call_model(state: MessagesState):
@@ -63,7 +63,7 @@ with PyMySQLSaver.from_conn_string(DB_URI) as checkpointer:
6363
from langchain_core.runnables import RunnableConfig
6464
from langgraph.config import get_store
6565
from langgraph.prebuilt import create_react_agent
66-
from langgraph.store.mysql import PyMySQLStore
66+
from langgraph.store.oceanbase import PyOceanBaseStore
6767
from langchain.chat_models import init_chat_model
6868
from langchain_core.messages import HumanMessage
6969
from typing_extensions import TypedDict
@@ -86,7 +86,7 @@ def save_user_info(user_info: UserInfo, config: RunnableConfig) -> str:
8686
return "Successfully saved user info."
8787

8888

89-
with PyMySQLStore.from_conn_string(DB_URI) as store:
89+
with PyOceanBaseStore.from_conn_string(DB_URI) as store:
9090
store.setup()
9191
agent=create_react_agent(
9292
model=model,

langgraph-checkpoint-oceanbase-plugin/langgraph-tests/tests/conftest_checkpointer.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pymysql
77
from sqlalchemy import Engine, create_engine
88

9-
from langgraph.checkpoint.mysql.aio import AIOMySQLSaver
10-
from langgraph.checkpoint.mysql.asyncmy import AsyncMySaver
11-
from langgraph.checkpoint.mysql.pymysql import PyMySQLSaver
9+
from langgraph.checkpoint.oceanbase.aio import AIOMySQLSaver
10+
from langgraph.checkpoint.oceanbase.asyncmy import AsyncMySaver
11+
from langgraph.checkpoint.oceanbase.pyoceanbase import PyOceanBaseSaver
1212

1313
DEFAULT_MYSQL_URI = "mysql://mysql:mysql@localhost:5441/"
1414

@@ -23,19 +23,19 @@ def _checkpointer_pymysql():
2323
database = f"test_{uuid4().hex[:16]}"
2424

2525
# create unique db
26-
with pymysql.connect(**PyMySQLSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
26+
with pymysql.connect(**PyOceanBaseSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
2727
with conn.cursor() as cursor:
2828
cursor.execute(f"CREATE DATABASE {database}")
2929
try:
3030
# yield checkpointer
31-
with PyMySQLSaver.from_conn_string(
31+
with PyOceanBaseSaver.from_conn_string(
3232
DEFAULT_MYSQL_URI + database
3333
) as checkpointer:
3434
checkpointer.setup()
3535
yield checkpointer
3636
finally:
3737
# drop unique db
38-
with pymysql.connect(**PyMySQLSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
38+
with pymysql.connect(**PyOceanBaseSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
3939
with conn.cursor() as cursor:
4040
cursor.execute(f"DROP DATABASE {database}")
4141

@@ -45,17 +45,17 @@ def _checkpointer_pymysql_pool():
4545
database = f"test_{uuid4().hex[:16]}"
4646

4747
# create unique db
48-
with pymysql.connect(**PyMySQLSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
48+
with pymysql.connect(**PyOceanBaseSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
4949
with conn.cursor() as cursor:
5050
cursor.execute(f"CREATE DATABASE {database}")
5151
try:
5252
pool = get_pymysql_sqlalchemy_engine(DEFAULT_MYSQL_URI + database)
53-
checkpointer = PyMySQLSaver(pool.raw_connection)
53+
checkpointer = PyOceanBaseSaver(pool.raw_connection)
5454
checkpointer.setup()
5555
yield checkpointer
5656
finally:
5757
# drop unique db
58-
with pymysql.connect(**PyMySQLSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
58+
with pymysql.connect(**PyOceanBaseSaver.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
5959
with conn.cursor() as cursor:
6060
cursor.execute(f"DROP DATABASE {database}")
6161

langgraph-checkpoint-oceanbase-plugin/langgraph-tests/tests/conftest_store.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pymysql
77
from sqlalchemy import Engine, create_engine
88

9-
from langgraph.store.mysql.aio import AIOMySQLStore
10-
from langgraph.store.mysql.asyncmy import AsyncMyStore
11-
from langgraph.store.mysql.pymysql import PyMySQLStore
9+
from langgraph.store.oceanbase.aio import AIOMySQLStore
10+
from langgraph.store.oceanbase.asyncmy import AsyncMyStore
11+
from langgraph.store.oceanbase.pyoceanbase import PyOceanBaseStore
1212

1313
DEFAULT_MYSQL_URI = "mysql://mysql:mysql@localhost:5441/"
1414

@@ -23,17 +23,17 @@ def _store_pymysql():
2323
database = f"test_{uuid4().hex[:16]}"
2424

2525
# create unique db
26-
with pymysql.connect(**PyMySQLStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
26+
with pymysql.connect(**PyOceanBaseStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
2727
with conn.cursor() as cursor:
2828
cursor.execute(f"CREATE DATABASE {database}")
2929
try:
3030
# yield store
31-
with PyMySQLStore.from_conn_string(DEFAULT_MYSQL_URI + database) as store:
31+
with PyOceanBaseStore.from_conn_string(DEFAULT_MYSQL_URI + database) as store:
3232
store.setup()
3333
yield store
3434
finally:
3535
# drop unique db
36-
with pymysql.connect(**PyMySQLStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
36+
with pymysql.connect(**PyOceanBaseStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
3737
with conn.cursor() as cursor:
3838
cursor.execute(f"DROP DATABASE {database}")
3939

@@ -43,18 +43,18 @@ def _store_pymysql_pool():
4343
database = f"test_{uuid4().hex[:16]}"
4444

4545
# create unique db
46-
with pymysql.connect(**PyMySQLStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
46+
with pymysql.connect(**PyOceanBaseStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
4747
with conn.cursor() as cursor:
4848
cursor.execute(f"CREATE DATABASE {database}")
4949
try:
5050
# yield store
5151
engine = get_pymysql_sqlalchemy_engine(DEFAULT_MYSQL_URI + database)
52-
store = PyMySQLStore(engine.raw_connection)
52+
store = PyOceanBaseStore(engine.raw_connection)
5353
store.setup()
5454
yield store
5555
finally:
5656
# drop unique db
57-
with pymysql.connect(**PyMySQLStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
57+
with pymysql.connect(**PyOceanBaseStore.parse_conn_string(DEFAULT_MYSQL_URI), autocommit=True) as conn:
5858
with conn.cursor() as cursor:
5959
cursor.execute(f"DROP DATABASE {database}")
6060

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/__init__.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
get_checkpoint_id,
1919
get_checkpoint_metadata,
2020
)
21-
from langgraph.checkpoint.mysql import _internal
22-
from langgraph.checkpoint.mysql.base import BaseMySQLSaver
23-
from langgraph.checkpoint.mysql.utils import (
21+
from langgraph.checkpoint.oceanbase import _internal
22+
from langgraph.checkpoint.oceanbase.base import BaseMySQLSaver
23+
from langgraph.checkpoint.oceanbase.utils import (
2424
deserialize_channel_values,
2525
deserialize_pending_sends,
2626
deserialize_pending_writes,
@@ -115,7 +115,7 @@ def list(
115115
Iterator[CheckpointTuple]: An iterator of checkpoint tuples.
116116
117117
Examples:
118-
>>> from langgraph.checkpoint.mysql import PyMySQLSaver
118+
>>> from langgraph.checkpoint.oceanbase import PyOceanBaseSaver
119119
>>> DB_URI = "mysql://mysql:mysql@localhost:5432/mysql"
120120
>>> with PyMySQLSaver.from_conn_string(DB_URI) as memory:
121121
... # Run a graph, then list the checkpoints
@@ -284,9 +284,9 @@ def put(
284284
285285
Examples:
286286
287-
>>> from langgraph.checkpoint.mysql import PyMySQLSaver
287+
>>> from langgraph.checkpoint.oceanbase import PyOceanBaseSaver
288288
>>> DB_URI = "mysql://mysql:mysql@localhost:5432/mysql"
289-
>>> with PyMySQLSaver.from_conn_string(DB_URI) as memory:
289+
>>> with PyOceanBaseSaver.from_conn_string(DB_URI) as memory:
290290
>>> config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
291291
>>> checkpoint = {"ts": "2024-05-04T06:32:42.235444+00:00", "id": "1ef4f797-8335-6428-8001-8a1503f9b875", "channel_values": {"key": "value"}}
292292
>>> saved_config = memory.put(config, checkpoint, {"source": "input", "step": 1, "writes": {"key": "value"}}, {})

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/_ainternal.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/_ainternal.py

File renamed without changes.

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/_internal.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/_internal.py

File renamed without changes.

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/aio.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/aio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import aiomysql # type: ignore
1010
from typing_extensions import Self, override
1111

12-
from langgraph.checkpoint.mysql import _ainternal
13-
from langgraph.checkpoint.mysql.aio_base import BaseAsyncMySQLSaver
14-
from langgraph.checkpoint.mysql.shallow import BaseShallowAsyncMySQLSaver
12+
from langgraph.checkpoint.oceanbase import _ainternal
13+
from langgraph.checkpoint.oceanbase.aio_base import BaseAsyncMySQLSaver
14+
from langgraph.checkpoint.oceanbase.shallow import BaseShallowAsyncMySQLSaver
1515
from langgraph.checkpoint.serde.base import SerializerProtocol
1616

1717
Conn = _ainternal.Conn[aiomysql.Connection] # For backward compatibility

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/aio_base.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/aio_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
get_checkpoint_id,
1919
get_checkpoint_metadata,
2020
)
21-
from langgraph.checkpoint.mysql import _ainternal
22-
from langgraph.checkpoint.mysql.base import BaseMySQLSaver
23-
from langgraph.checkpoint.mysql.utils import (
21+
from langgraph.checkpoint.oceanbase import _ainternal
22+
from langgraph.checkpoint.oceanbase.base import BaseMySQLSaver
23+
from langgraph.checkpoint.oceanbase.utils import (
2424
deserialize_channel_values,
2525
deserialize_pending_sends,
2626
deserialize_pending_writes,

langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/mysql/asyncmy.py renamed to langgraph-checkpoint-oceanbase-plugin/langgraph/checkpoint/oceanbase/asyncmy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from asyncmy.cursors import DictCursor # type: ignore
1111
from typing_extensions import Self, override
1212

13-
from langgraph.checkpoint.mysql.aio_base import BaseAsyncMySQLSaver
14-
from langgraph.checkpoint.mysql.shallow import BaseShallowAsyncMySQLSaver
13+
from langgraph.checkpoint.oceanbase.aio_base import BaseAsyncMySQLSaver
14+
from langgraph.checkpoint.oceanbase.shallow import BaseShallowAsyncMySQLSaver
1515
from langgraph.checkpoint.serde.base import SerializerProtocol
1616

1717

0 commit comments

Comments
 (0)