mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
fix: satisfy the lint and docs gates for the view APIs
The refusal test's closure never returns, so its response type needed naming; the Python binding's tuple needed a type alias; ruff and biome wanted their formatting; and the generated JS docs needed the four new verbs and the ViewDescription page.
This commit is contained in:
@@ -972,7 +972,9 @@ class DBConnection(EnforceOverrides):
|
||||
"View operations are not supported for this connection type"
|
||||
)
|
||||
|
||||
def drop_view(self, name: str, *, namespace_path: Optional[List[str]] = None) -> None:
|
||||
def drop_view(
|
||||
self, name: str, *, namespace_path: Optional[List[str]] = None
|
||||
) -> None:
|
||||
"""Drop a view.
|
||||
|
||||
The tables it reads are untouched: a view holds no rows of its own.
|
||||
@@ -1821,7 +1823,9 @@ class LanceDBConnection(DBConnection):
|
||||
return LOOP.run(self._conn.describe_view(name, namespace_path=namespace_path))
|
||||
|
||||
@override
|
||||
def drop_view(self, name: str, *, namespace_path: Optional[List[str]] = None) -> None:
|
||||
def drop_view(
|
||||
self, name: str, *, namespace_path: Optional[List[str]] = None
|
||||
) -> None:
|
||||
LOOP.run(self._conn.drop_view(name, namespace_path=namespace_path))
|
||||
|
||||
@override
|
||||
@@ -2795,9 +2799,7 @@ class AsyncConnection(object):
|
||||
[DBConnection.create_view][lancedb.DBConnection.create_view].
|
||||
"""
|
||||
return _view_description(
|
||||
await self._inner.create_view(
|
||||
name, query, list(namespace_path or [])
|
||||
)
|
||||
await self._inner.create_view(name, query, list(namespace_path or []))
|
||||
)
|
||||
|
||||
async def describe_view(
|
||||
|
||||
@@ -926,7 +926,9 @@ class RemoteDBConnection(DBConnection):
|
||||
return LOOP.run(self._conn.describe_view(name, namespace_path=namespace_path))
|
||||
|
||||
@override
|
||||
def drop_view(self, name: str, *, namespace_path: Optional[List[str]] = None) -> None:
|
||||
def drop_view(
|
||||
self, name: str, *, namespace_path: Optional[List[str]] = None
|
||||
) -> None:
|
||||
LOOP.run(self._conn.drop_view(name, namespace_path=namespace_path))
|
||||
|
||||
@override
|
||||
|
||||
@@ -104,13 +104,15 @@ fn parse_default_namespace_path(path: Option<Bound<'_, PyAny>>) -> PyResult<Vec<
|
||||
}
|
||||
}
|
||||
|
||||
/// A view description on its way to Python: name, namespace, query, default
|
||||
/// database, and the schema as pyarrow renders it.
|
||||
type PyViewDescription = (String, Vec<String>, String, String, Py<PyAny>);
|
||||
|
||||
/// A view description as a plain tuple, with the schema converted to the
|
||||
/// pyarrow schema the caller would get from any other lancedb API. The Python
|
||||
/// layer names the fields; this keeps the binding free of a class that would
|
||||
/// have to be kept in step with the Rust struct.
|
||||
fn view_description_to_py(
|
||||
view: lancedb::view::ViewDescription,
|
||||
) -> PyResult<(String, Vec<String>, String, String, Py<PyAny>)> {
|
||||
fn view_description_to_py(view: lancedb::view::ViewDescription) -> PyResult<PyViewDescription> {
|
||||
Python::attach(|py| {
|
||||
let schema = view.schema.to_pyarrow(py)?.unbind();
|
||||
Ok((
|
||||
|
||||
Reference in New Issue
Block a user