feat: add list_indices to the async api (#1074)

This commit is contained in:
Weston Pace
2024-03-12 14:41:21 -07:00
parent 9031ec6878
commit b6a522d483
14 changed files with 233 additions and 16 deletions

View File

@@ -11,7 +11,10 @@ use pyo3::{
};
use pyo3_asyncio::tokio::future_into_py;
use crate::{error::PythonErrorExt, index::Index};
use crate::{
error::PythonErrorExt,
index::{Index, IndexConfig},
};
#[pyclass]
pub struct Table {
@@ -127,6 +130,19 @@ impl Table {
})
}
pub fn list_indices(self_: PyRef<'_, Self>) -> PyResult<&PyAny> {
let inner = self_.inner_ref()?.clone();
future_into_py(self_.py(), async move {
Ok(inner
.list_indices()
.await
.infer_error()?
.into_iter()
.map(IndexConfig::from)
.collect::<Vec<_>>())
})
}
pub fn __repr__(&self) -> String {
match &self.inner {
None => format!("ClosedTable({})", self.name),