fix: python remote correct open_table error message (#659)

This commit is contained in:
Bert
2023-11-24 19:28:33 -05:00
committed by Weston Pace
parent 57dda15f49
commit bbf34ae7f4
2 changed files with 10 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ from ..pydantic import LanceModel
from ..table import Table, _sanitize_data
from .arrow import to_ipc_binary
from .client import ARROW_STREAM_CONTENT_TYPE, RestfulLanceDBClient
from .errors import LanceDBClientError
class RemoteDBConnection(DBConnection):
@@ -101,11 +102,12 @@ class RemoteDBConnection(DBConnection):
self._loop.run_until_complete(
self._client.post(f"/v1/table/{name}/describe/")
)
except Exception:
logging.error(
"Table {name} does not exist."
"Please first call db.create_table({name}, data)"
)
except LanceDBClientError as err:
if str(err).startswith("Not found"):
logging.error(
f"Table {name} does not exist. "
f"Please first call db.create_table({name}, data)"
)
return RemoteTable(self, name)
@override

View File

@@ -26,6 +26,9 @@ class FakeLanceDBClient:
t = pa.schema([]).empty_table()
return VectorQueryResult(t)
async def post(self, path: str):
pass
def test_remote_db():
conn = lancedb.connect("db://client-will-be-injected", api_key="fake")