Compare commits

..

2 Commits

Author SHA1 Message Date
qzhu
b7c816c919 add index_stats to python api 2024-03-12 16:28:15 -07:00
qzhu
34dd548bc8 init commit for test 2024-03-11 13:28:24 -07:00
6 changed files with 11 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.3
current_version = 0.6.2
commit = True
message = [python] Bump version: {current_version} → {new_version}
tag = True

View File

@@ -1,6 +1,6 @@
[project]
name = "lancedb"
version = "0.6.3"
version = "0.6.2"
dependencies = [
"deprecation",
"pylance==0.10.2",

View File

@@ -35,7 +35,6 @@ def connect(
host_override: Optional[str] = None,
read_consistency_interval: Optional[timedelta] = None,
request_thread_pool: Optional[Union[int, ThreadPoolExecutor]] = None,
**kwargs,
) -> DBConnection:
"""Connect to a LanceDB database.
@@ -100,12 +99,7 @@ def connect(
if isinstance(request_thread_pool, int):
request_thread_pool = ThreadPoolExecutor(request_thread_pool)
return RemoteDBConnection(
uri,
api_key,
region,
host_override,
request_thread_pool=request_thread_pool,
**kwargs,
uri, api_key, region, host_override, request_thread_pool=request_thread_pool
)
return LanceDBConnection(uri, read_consistency_interval=read_consistency_interval)

View File

@@ -58,9 +58,6 @@ class RestfulLanceDBClient:
closed: bool = attrs.field(default=False, init=False)
connection_timeout: float = attrs.field(default=120.0, kw_only=True)
read_timeout: float = attrs.field(default=300.0, kw_only=True)
@functools.cached_property
def session(self) -> requests.Session:
sess = requests.Session()
@@ -120,7 +117,7 @@ class RestfulLanceDBClient:
urljoin(self.url, uri),
params=params,
headers=self.headers,
timeout=(self.connection_timeout, self.read_timeout),
timeout=(120.0, 300.0),
) as resp:
self._check_status(resp)
return resp.json()
@@ -162,7 +159,7 @@ class RestfulLanceDBClient:
urljoin(self.url, uri),
headers=headers,
params=params,
timeout=(self.connection_timeout, self.read_timeout),
timeout=(120.0, 300.0),
**req_kwargs,
) as resp:
self._check_status(resp)

View File

@@ -41,8 +41,6 @@ class RemoteDBConnection(DBConnection):
region: str,
host_override: Optional[str] = None,
request_thread_pool: Optional[ThreadPoolExecutor] = None,
connection_timeout: float = 120.0,
read_timeout: float = 300.0,
):
"""Connect to a remote LanceDB database."""
parsed = urlparse(db_url)
@@ -51,12 +49,7 @@ class RemoteDBConnection(DBConnection):
self.db_name = parsed.netloc
self.api_key = api_key
self._client = RestfulLanceDBClient(
self.db_name,
region,
api_key,
host_override,
connection_timeout=connection_timeout,
read_timeout=read_timeout,
self.db_name, region, api_key, host_override
)
self._request_thread_pool = request_thread_pool

View File

@@ -68,9 +68,13 @@ class RemoteTable(Table):
def list_indices(self):
"""List all the indices on the table"""
print(self._name)
resp = self._conn._client.post(f"/v1/table/{self._name}/index/list/")
return resp
def index_stats(self, index_uuid: str):
"""List all the indices on the table"""
resp = self._conn._client.post(f"/v1/table/{self._name}/index/{index_uuid}/stats/")
return resp
def create_scalar_index(
self,