feat: expose underlying dataset uri of the table (#1704)

This commit is contained in:
Rob Meng
2024-09-27 10:20:02 -04:00
committed by GitHub
parent e606a455df
commit ee6c18f207
2 changed files with 15 additions and 0 deletions

View File

@@ -325,6 +325,9 @@ impl<S: HttpSend> TableInternal for RemoteTable<S> {
message: "table_definition is not supported on LanceDB cloud.".into(),
})
}
fn dataset_uri(&self) -> &str {
"NOT_SUPPORTED"
}
}
#[derive(Serialize)]

View File

@@ -419,6 +419,7 @@ pub(crate) trait TableInternal: std::fmt::Display + std::fmt::Debug + Send + Syn
async fn checkout_latest(&self) -> Result<()>;
async fn restore(&self) -> Result<()>;
async fn table_definition(&self) -> Result<TableDefinition>;
fn dataset_uri(&self) -> &str;
}
/// A Table is a collection of strong typed Rows.
@@ -950,6 +951,13 @@ impl Table {
pub async fn list_indices(&self) -> Result<Vec<IndexConfig>> {
self.inner.list_indices().await
}
/// Get the underlying dataset URI
///
/// Warning: This is an internal API and the return value is subject to change.
pub fn dataset_uri(&self) -> &str {
self.inner.dataset_uri()
}
}
impl From<NativeTable> for Table {
@@ -2172,6 +2180,10 @@ impl TableInternal for NativeTable {
Ok(IndexConfig { index_type, columns, name })
}).collect::<Result<Vec<_>>>()
}
fn dataset_uri(&self) -> &str {
self.uri.as_str()
}
}
#[cfg(test)]