Skip to content

Commit b7ea399

Browse files
authored
langchain checkpointer fix (#396)
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
1 parent 32cebf4 commit b7ea399

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

integrations/langchain/src/databricks_langchain/checkpoint.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def __init__(
5353
super().__init__(self._lakebase.pool)
5454

5555
def __enter__(self):
56-
"""Enter context manager and create checkpoint tables."""
57-
self.setup()
56+
"""Enter context manager."""
5857
return self
5958

6059
def __exit__(self, exc_type, exc_val, exc_tb):
@@ -101,9 +100,8 @@ def __init__(
101100
super().__init__(self._lakebase.pool)
102101

103102
async def __aenter__(self):
104-
"""Enter async context manager, open the connection pool, and create checkpoint tables."""
103+
"""Enter async context manager and open the connection pool."""
105104
await self._lakebase.open()
106-
await self.setup()
107105
return self
108106

109107
async def __aexit__(self, exc_type, exc_val, exc_tb):

integrations/langchain/tests/unit_tests/test_checkpoint.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
from databricks_langchain import AsyncCheckpointSaver, CheckpointSaver
1313

1414

15-
async def _async_noop():
16-
"""No-op coroutine used to mock async setup() in tests."""
17-
pass
18-
19-
2015
class TestConnectionPool:
2116
def __init__(self, connection_value="conn"):
2217
self.connection_value = connection_value
@@ -139,7 +134,6 @@ async def test_async_checkpoint_saver_configures_lakebase(monkeypatch):
139134
async def test_async_checkpoint_saver_context_manager(monkeypatch):
140135
test_pool = TestAsyncConnectionPool(connection_value="async-lake-conn")
141136
monkeypatch.setattr(lakebase, "AsyncConnectionPool", test_pool)
142-
monkeypatch.setattr(AsyncCheckpointSaver, "setup", lambda self: _async_noop())
143137

144138
workspace = MagicMock()
145139
workspace.database.generate_database_credential.return_value = MagicMock(token="stub-token")
@@ -161,7 +155,6 @@ async def test_async_checkpoint_saver_context_manager(monkeypatch):
161155
async def test_async_checkpoint_saver_connection(monkeypatch):
162156
test_pool = TestAsyncConnectionPool(connection_value="async-lake-conn")
163157
monkeypatch.setattr(lakebase, "AsyncConnectionPool", test_pool)
164-
monkeypatch.setattr(AsyncCheckpointSaver, "setup", lambda self: _async_noop())
165158

166159
workspace = MagicMock()
167160
workspace.database.generate_database_credential.return_value = MagicMock(token="stub-token")
@@ -237,7 +230,6 @@ async def test_async_checkpoint_saver_autoscaling_configures_lakebase(monkeypatc
237230
async def test_async_checkpoint_saver_autoscaling_context_manager(monkeypatch):
238231
test_pool = TestAsyncConnectionPool(connection_value="async-lake-conn")
239232
monkeypatch.setattr(lakebase, "AsyncConnectionPool", test_pool)
240-
monkeypatch.setattr(AsyncCheckpointSaver, "setup", lambda self: _async_noop())
241233

242234
workspace = _create_autoscaling_workspace()
243235

0 commit comments

Comments
 (0)