Skip to content

Commit 7b5e9d8

Browse files
authored
fix: dynamodb external manifest drop table (lancedb#1866)
second pr of lancedb#1812
1 parent 3b173e7 commit 7b5e9d8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

rust/lancedb/src/connection.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use crate::table::{NativeTable, TableDefinition, WriteOptions};
3838
use crate::utils::validate_table_name;
3939
use crate::Table;
4040
pub use lance_encoding::version::LanceFileVersion;
41+
use lance_table::io::commit::commit_handler_from_url;
4142

4243
pub const LANCE_FILE_EXTENSION: &str = "lance";
4344

@@ -1036,6 +1037,7 @@ impl ConnectionInternal for Database {
10361037
};
10371038

10381039
let mut write_params = options.write_options.lance_write_params.unwrap_or_default();
1040+
10391041
if matches!(&options.mode, CreateTableMode::Overwrite) {
10401042
write_params.mode = WriteMode::Overwrite;
10411043
}
@@ -1122,7 +1124,7 @@ impl ConnectionInternal for Database {
11221124
let dir_name = format!("{}.{}", name, LANCE_EXTENSION);
11231125
let full_path = self.base_path.child(dir_name.clone());
11241126
self.object_store
1125-
.remove_dir_all(full_path)
1127+
.remove_dir_all(full_path.clone())
11261128
.await
11271129
.map_err(|err| match err {
11281130
// this error is not lance::Error::DatasetNotFound,
@@ -1132,6 +1134,19 @@ impl ConnectionInternal for Database {
11321134
},
11331135
_ => Error::from(err),
11341136
})?;
1137+
1138+
let object_store_params = ObjectStoreParams {
1139+
storage_options: Some(self.storage_options.clone()),
1140+
..Default::default()
1141+
};
1142+
let mut uri = self.uri.clone();
1143+
if let Some(query_string) = &self.query_string {
1144+
uri.push_str(&format!("?{}", query_string));
1145+
}
1146+
let commit_handler = commit_handler_from_url(&uri, &Some(object_store_params))
1147+
.await
1148+
.unwrap();
1149+
commit_handler.delete(&full_path).await.unwrap();
11351150
Ok(())
11361151
}
11371152

0 commit comments

Comments
 (0)