mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-01 11:08:55 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f54f5600ad | |||
| e34fe84c7f | |||
| 5b1f248257 | |||
| 95e34d47b9 | |||
| a0defd448f | |||
| 0fadb65153 | |||
| 15fbcf61fc |
@@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.31.0-beta.8"
|
current_version = "0.31.0-beta.7"
|
||||||
parse = """(?x)
|
parse = """(?x)
|
||||||
(?P<major>0|[1-9]\\d*)\\.
|
(?P<major>0|[1-9]\\d*)\\.
|
||||||
(?P<minor>0|[1-9]\\d*)\\.
|
(?P<minor>0|[1-9]\\d*)\\.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb-python"
|
name = "lancedb-python"
|
||||||
version = "0.31.0-beta.8"
|
version = "0.31.0-beta.7"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
description = "Python bindings for LanceDB"
|
description = "Python bindings for LanceDB"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ use crate::connection::NamespaceClientPushdownOperation;
|
|||||||
use crate::database::ReadConsistency;
|
use crate::database::ReadConsistency;
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::table::NativeTable;
|
use crate::table::NativeTable;
|
||||||
use lance::dataset::WriteMode;
|
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
BaseTable, CloneTableRequest, CreateTableMode, CreateTableRequest as DbCreateTableRequest,
|
BaseTable, CloneTableRequest, CreateTableMode, CreateTableRequest as DbCreateTableRequest,
|
||||||
@@ -185,7 +184,6 @@ impl Database for LanceNamespaceDatabase {
|
|||||||
async fn create_table(&self, request: DbCreateTableRequest) -> Result<Arc<dyn BaseTable>> {
|
async fn create_table(&self, request: DbCreateTableRequest) -> Result<Arc<dyn BaseTable>> {
|
||||||
let mut table_id = request.namespace_path.clone();
|
let mut table_id = request.namespace_path.clone();
|
||||||
table_id.push(request.name.clone());
|
table_id.push(request.name.clone());
|
||||||
let mut existing_table = None;
|
|
||||||
|
|
||||||
match request.mode {
|
match request.mode {
|
||||||
CreateTableMode::Create => {}
|
CreateTableMode::Create => {}
|
||||||
@@ -194,7 +192,20 @@ impl Database for LanceNamespaceDatabase {
|
|||||||
id: Some(table_id.clone()),
|
id: Some(table_id.clone()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
existing_table = self.namespace.describe_table(describe_request).await.ok();
|
let describe_result = self.namespace.describe_table(describe_request).await;
|
||||||
|
if describe_result.is_ok() {
|
||||||
|
// Drop the existing table - must succeed
|
||||||
|
let drop_request = DropTableRequest {
|
||||||
|
id: Some(table_id.clone()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
self.namespace
|
||||||
|
.drop_table(drop_request)
|
||||||
|
.await
|
||||||
|
.map_err(|e| Error::Runtime {
|
||||||
|
message: format!("Failed to drop existing table for overwrite: {}", e),
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CreateTableMode::ExistOk(_) => {
|
CreateTableMode::ExistOk(_) => {
|
||||||
let describe_request = DescribeTableRequest {
|
let describe_request = DescribeTableRequest {
|
||||||
@@ -229,16 +240,6 @@ impl Database for LanceNamespaceDatabase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let (location, initial_storage_options, managed_versioning) = {
|
let (location, initial_storage_options, managed_versioning) = {
|
||||||
if let Some(response) = existing_table {
|
|
||||||
let loc = response.location.ok_or_else(|| Error::Runtime {
|
|
||||||
message: "Table location is missing from describe_table response".to_string(),
|
|
||||||
})?;
|
|
||||||
let opts = response
|
|
||||||
.storage_options
|
|
||||||
.or_else(|| Some(self.storage_options.clone()))
|
|
||||||
.filter(|o| !o.is_empty());
|
|
||||||
(loc, opts, response.managed_versioning)
|
|
||||||
} else {
|
|
||||||
let response = self
|
let response = self
|
||||||
.namespace
|
.namespace
|
||||||
.declare_table(declare_request)
|
.declare_table(declare_request)
|
||||||
@@ -268,16 +269,11 @@ impl Database for LanceNamespaceDatabase {
|
|||||||
.or_else(|| Some(self.storage_options.clone()))
|
.or_else(|| Some(self.storage_options.clone()))
|
||||||
.filter(|o| !o.is_empty());
|
.filter(|o| !o.is_empty());
|
||||||
(loc, opts, response.managed_versioning)
|
(loc, opts, response.managed_versioning)
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build write params with storage options and commit handler
|
// Build write params with storage options and commit handler
|
||||||
let mut params = request.write_options.lance_write_params.unwrap_or_default();
|
let mut params = request.write_options.lance_write_params.unwrap_or_default();
|
||||||
|
|
||||||
if matches!(request.mode, CreateTableMode::Overwrite) {
|
|
||||||
params.mode = WriteMode::Overwrite;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up storage options if provided
|
// Set up storage options if provided
|
||||||
if let Some(storage_opts) = initial_storage_options {
|
if let Some(storage_opts) = initial_storage_options {
|
||||||
let store_params = params
|
let store_params = params
|
||||||
|
|||||||
Reference in New Issue
Block a user