From 167fccc4275dc0abbcae28567ca904bb1d33d707 Mon Sep 17 00:00:00 2001 From: CyrusAttoun Date: Wed, 9 Jul 2025 16:27:08 -0500 Subject: [PATCH] fix: change 'return' to 'raise' for unimplemented remote table function (#2484) just noticed that we're doing a 'return' instead of a 'raise' while trying to get remote functionality working for my project. I went ahead and implemented tests for both of the unimplemented functions (to_pandas and to_arrow) while I was in there. --------- Co-authored-by: Cyrus Attoun --- python/python/lancedb/remote/table.py | 2 +- python/python/tests/test_remote_db.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/python/python/lancedb/remote/table.py b/python/python/lancedb/remote/table.py index a3523426..3c23d6e5 100644 --- a/python/python/lancedb/remote/table.py +++ b/python/python/lancedb/remote/table.py @@ -89,7 +89,7 @@ class RemoteTable(Table): def to_pandas(self): """to_pandas() is not yet supported on LanceDB cloud.""" - return NotImplementedError("to_pandas() is not yet supported on LanceDB cloud.") + raise NotImplementedError("to_pandas() is not yet supported on LanceDB cloud.") def checkout(self, version: Union[int, str]): return LOOP.run(self._table.checkout(version)) diff --git a/python/python/tests/test_remote_db.py b/python/python/tests/test_remote_db.py index aa7c0c72..ace9f263 100644 --- a/python/python/tests/test_remote_db.py +++ b/python/python/tests/test_remote_db.py @@ -210,6 +210,25 @@ async def test_retry_error(): assert cause.status_code == 429 +def test_table_unimplemented_functions(): + def handler(request): + if request.path == "/v1/table/test/create/?mode=create": + request.send_response(200) + request.send_header("Content-Type", "application/json") + request.end_headers() + request.wfile.write(b"{}") + else: + request.send_response(404) + request.end_headers() + + with mock_lancedb_connection(handler) as db: + table = db.create_table("test", [{"id": 1}]) + with pytest.raises(NotImplementedError): + table.to_arrow() + with pytest.raises(NotImplementedError): + table.to_pandas() + + def test_table_add_in_threadpool(): def handler(request): if request.path == "/v1/table/test/insert/":