From 97754f5123743bace0231828ebba4cf172c8bdfd Mon Sep 17 00:00:00 2001 From: Dan Tasse <105866+dantasse@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:29:17 -0400 Subject: [PATCH] fix: change _client reference to _conn (#3188) This code previously referenced `self._client`, which does not exist. This change makes it correctly call `self._conn.close()` --- python/python/lancedb/remote/db.py | 2 +- python/python/tests/test_remote_db.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/python/python/lancedb/remote/db.py b/python/python/lancedb/remote/db.py index 41ec1ba3c..decea4778 100644 --- a/python/python/lancedb/remote/db.py +++ b/python/python/lancedb/remote/db.py @@ -568,4 +568,4 @@ class RemoteDBConnection(DBConnection): async def close(self): """Close the connection to the database.""" - self._client.close() + self._conn.close() diff --git a/python/python/tests/test_remote_db.py b/python/python/tests/test_remote_db.py index 628a21e1b..0dd880cc0 100644 --- a/python/python/tests/test_remote_db.py +++ b/python/python/tests/test_remote_db.py @@ -1201,6 +1201,18 @@ async def test_header_provider_overrides_static_headers(): await db.table_names() +def test_close(): + """Test that close() works without AttributeError.""" + import asyncio + + def handler(req): + req.send_response(200) + req.end_headers() + + with mock_lancedb_connection(handler) as db: + asyncio.run(db.close()) + + @pytest.mark.parametrize("exception", [KeyboardInterrupt, SystemExit, GeneratorExit]) def test_background_loop_cancellation(exception): """Test that BackgroundEventLoop.run() cancels the future on interrupt."""