From 32cb1b9ea4f9476c4addb932dbebb10dbb7afe27 Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Mon, 13 Nov 2023 21:43:48 +0100 Subject: [PATCH] feat: add RemoteTable.version in Python (#644) Please note: this is not tested as we don't have a server here and testing against a mock object wouldn't be that interesting. --- python/lancedb/remote/table.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/lancedb/remote/table.py b/python/lancedb/remote/table.py index b3064b2a..9e0931ff 100644 --- a/python/lancedb/remote/table.py +++ b/python/lancedb/remote/table.py @@ -44,6 +44,14 @@ class RemoteTable(Table): schema = json_to_schema(resp["schema"]) return schema + @property + def version(self) -> int: + """Get the current version of the table""" + resp = self._conn._loop.run_until_complete( + self._conn._client.post(f"/v1/table/{self._name}/describe/") + ) + return resp["version"] + def to_arrow(self) -> pa.Table: """Return the table as an Arrow table.""" raise NotImplementedError("to_arrow() is not supported on the LanceDB cloud")