Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change checkpoint_ns to 255 (temp fix) #40

Merged
merged 3 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.mypy_cache/
__pycache__/
.idea/
1 change: 1 addition & 0 deletions langgraph/checkpoint/mysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def setup(self) -> None:
):
cur.execute(migration)
cur.execute(f"INSERT INTO checkpoint_migrations (v) VALUES ({v})")
cur.execute("COMMIT")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why the upstream PostgreSQL checkpointer doesn't need this? (I assumed it was since it expects connections to be constructed using autocommit=True, but I'm open to making this support other cases too if I understand the use case.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, the version value is not up to date. So when I run setup next time. It will try to excute previouse migration. Previous migration will cause error.
I didn't dive much too. But I found execute 'commit' can make version up to date. So I added.
And now setup() can been call multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's caused by autocommit . When I use this repo. I read the readme. Noticed that I need autocommit set to True.

But when I use sqlalchemy import create_engine. I didn't find autocommit setting. After searching, I think the autocommit is set to True by default. So I didn't set autocommit in my code. Just use default value.


def list(
self,
Expand Down
3 changes: 3 additions & 0 deletions langgraph/checkpoint/mysql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"""
CREATE INDEX checkpoints_checkpoint_id_idx ON checkpoints (checkpoint_id);
""",
"ALTER TABLE checkpoints MODIFY COLUMN `checkpoint_ns` VARCHAR(255) NOT NULL DEFAULT '';",
"ALTER TABLE checkpoint_blobs MODIFY COLUMN `checkpoint_ns` VARCHAR(255) NOT NULL DEFAULT '';",
"ALTER TABLE checkpoint_writes MODIFY COLUMN `checkpoint_ns` VARCHAR(255) NOT NULL DEFAULT '';",
]

SELECT_SQL = f"""
Expand Down
Loading