mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-23 21:39:57 +00:00
Compare commits
2 Commits
add-python
...
python-v0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ae08fe31d | ||
|
|
a517629c65 |
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.6.2
|
current_version = 0.6.3
|
||||||
commit = True
|
commit = True
|
||||||
message = [python] Bump version: {current_version} → {new_version}
|
message = [python] Bump version: {current_version} → {new_version}
|
||||||
tag = True
|
tag = True
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "lancedb"
|
name = "lancedb"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deprecation",
|
"deprecation",
|
||||||
"pylance==0.10.2",
|
"pylance==0.10.2",
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ def connect(
|
|||||||
host_override: Optional[str] = None,
|
host_override: Optional[str] = None,
|
||||||
read_consistency_interval: Optional[timedelta] = None,
|
read_consistency_interval: Optional[timedelta] = None,
|
||||||
request_thread_pool: Optional[Union[int, ThreadPoolExecutor]] = None,
|
request_thread_pool: Optional[Union[int, ThreadPoolExecutor]] = None,
|
||||||
|
**kwargs,
|
||||||
) -> DBConnection:
|
) -> DBConnection:
|
||||||
"""Connect to a LanceDB database.
|
"""Connect to a LanceDB database.
|
||||||
|
|
||||||
@@ -99,7 +100,12 @@ def connect(
|
|||||||
if isinstance(request_thread_pool, int):
|
if isinstance(request_thread_pool, int):
|
||||||
request_thread_pool = ThreadPoolExecutor(request_thread_pool)
|
request_thread_pool = ThreadPoolExecutor(request_thread_pool)
|
||||||
return RemoteDBConnection(
|
return RemoteDBConnection(
|
||||||
uri, api_key, region, host_override, request_thread_pool=request_thread_pool
|
uri,
|
||||||
|
api_key,
|
||||||
|
region,
|
||||||
|
host_override,
|
||||||
|
request_thread_pool=request_thread_pool,
|
||||||
|
**kwargs,
|
||||||
)
|
)
|
||||||
return LanceDBConnection(uri, read_consistency_interval=read_consistency_interval)
|
return LanceDBConnection(uri, read_consistency_interval=read_consistency_interval)
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class RestfulLanceDBClient:
|
|||||||
|
|
||||||
closed: bool = attrs.field(default=False, init=False)
|
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
|
@functools.cached_property
|
||||||
def session(self) -> requests.Session:
|
def session(self) -> requests.Session:
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
@@ -117,7 +120,7 @@ class RestfulLanceDBClient:
|
|||||||
urljoin(self.url, uri),
|
urljoin(self.url, uri),
|
||||||
params=params,
|
params=params,
|
||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
timeout=(120.0, 300.0),
|
timeout=(self.connection_timeout, self.read_timeout),
|
||||||
) as resp:
|
) as resp:
|
||||||
self._check_status(resp)
|
self._check_status(resp)
|
||||||
return resp.json()
|
return resp.json()
|
||||||
@@ -159,7 +162,7 @@ class RestfulLanceDBClient:
|
|||||||
urljoin(self.url, uri),
|
urljoin(self.url, uri),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
params=params,
|
params=params,
|
||||||
timeout=(120.0, 300.0),
|
timeout=(self.connection_timeout, self.read_timeout),
|
||||||
**req_kwargs,
|
**req_kwargs,
|
||||||
) as resp:
|
) as resp:
|
||||||
self._check_status(resp)
|
self._check_status(resp)
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ class RemoteDBConnection(DBConnection):
|
|||||||
region: str,
|
region: str,
|
||||||
host_override: Optional[str] = None,
|
host_override: Optional[str] = None,
|
||||||
request_thread_pool: Optional[ThreadPoolExecutor] = None,
|
request_thread_pool: Optional[ThreadPoolExecutor] = None,
|
||||||
|
connection_timeout: float = 120.0,
|
||||||
|
read_timeout: float = 300.0,
|
||||||
):
|
):
|
||||||
"""Connect to a remote LanceDB database."""
|
"""Connect to a remote LanceDB database."""
|
||||||
parsed = urlparse(db_url)
|
parsed = urlparse(db_url)
|
||||||
@@ -49,7 +51,12 @@ class RemoteDBConnection(DBConnection):
|
|||||||
self.db_name = parsed.netloc
|
self.db_name = parsed.netloc
|
||||||
self.api_key = api_key
|
self.api_key = api_key
|
||||||
self._client = RestfulLanceDBClient(
|
self._client = RestfulLanceDBClient(
|
||||||
self.db_name, region, api_key, host_override
|
self.db_name,
|
||||||
|
region,
|
||||||
|
api_key,
|
||||||
|
host_override,
|
||||||
|
connection_timeout=connection_timeout,
|
||||||
|
read_timeout=read_timeout,
|
||||||
)
|
)
|
||||||
self._request_thread_pool = request_thread_pool
|
self._request_thread_pool = request_thread_pool
|
||||||
|
|
||||||
|
|||||||
@@ -68,13 +68,9 @@ class RemoteTable(Table):
|
|||||||
|
|
||||||
def list_indices(self):
|
def list_indices(self):
|
||||||
"""List all the indices on the table"""
|
"""List all the indices on the table"""
|
||||||
|
print(self._name)
|
||||||
resp = self._conn._client.post(f"/v1/table/{self._name}/index/list/")
|
resp = self._conn._client.post(f"/v1/table/{self._name}/index/list/")
|
||||||
return resp
|
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(
|
def create_scalar_index(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user