diff --git a/rust/lancedb/src/connection.rs b/rust/lancedb/src/connection.rs index 95d985aac..554ac7ad8 100644 --- a/rust/lancedb/src/connection.rs +++ b/rust/lancedb/src/connection.rs @@ -596,11 +596,8 @@ pub struct ConnectBuilder { } #[cfg(feature = "remote")] -const ENV_VARS_TO_STORAGE_OPTS: [(&str, &str); 3] = [ - ("AZURE_STORAGE_ACCOUNT_NAME", "azure_storage_account_name"), - ("AZURE_CLIENT_ID", "azure_client_id"), - ("AZURE_TENANT_ID", "azure_tenant_id"), -]; +const ENV_VARS_TO_STORAGE_OPTS: [(&str, &str); 1] = + [("AZURE_STORAGE_ACCOUNT_NAME", "azure_storage_account_name")]; impl ConnectBuilder { /// Create a new [`ConnectOptions`] with the given database URI. diff --git a/rust/lancedb/src/remote/client.rs b/rust/lancedb/src/remote/client.rs index 41a5949ca..9549c5b44 100644 --- a/rust/lancedb/src/remote/client.rs +++ b/rust/lancedb/src/remote/client.rs @@ -443,23 +443,13 @@ impl RestfulLanceDbClient { })?, ); } - // Map azure storage options to x-azure-* headers. - // The option key uses underscores (e.g. "azure_client_id") while the - // header uses hyphens (e.g. "x-azure-client-id"). - let azure_opts: [(&str, &str); 3] = [ - ("azure_storage_account_name", "x-azure-storage-account-name"), - ("azure_client_id", "x-azure-client-id"), - ("azure_tenant_id", "x-azure-tenant-id"), - ]; - for (opt_key, header_name) in azure_opts { - if let Some(v) = options.0.get(opt_key) { - headers.insert( - HeaderName::from_static(header_name), - HeaderValue::from_str(v).map_err(|_| Error::InvalidInput { - message: format!("non-ascii value '{}' for option '{}'", v, opt_key), - })?, - ); - } + if let Some(v) = options.0.get("azure_storage_account_name") { + headers.insert( + HeaderName::from_static("x-azure-storage-account-name"), + HeaderValue::from_str(v).map_err(|_| Error::InvalidInput { + message: format!("non-ascii storage account name '{}' provided", db_name), + })?, + ); } for (key, value) in &config.extra_headers { @@ -1082,34 +1072,4 @@ mod tests { _ => panic!("Expected Runtime error"), } } - - #[test] - fn test_default_headers_azure_opts() { - let mut opts = HashMap::new(); - opts.insert( - "azure_storage_account_name".to_string(), - "myaccount".to_string(), - ); - opts.insert("azure_client_id".to_string(), "my-client-id".to_string()); - opts.insert("azure_tenant_id".to_string(), "my-tenant-id".to_string()); - let remote_opts = RemoteOptions::new(opts); - - let headers = RestfulLanceDbClient::::default_headers( - "test-key", - "us-east-1", - "testdb", - false, - &remote_opts, - None, - &ClientConfig::default(), - ) - .unwrap(); - - assert_eq!( - headers.get("x-azure-storage-account-name").unwrap(), - "myaccount" - ); - assert_eq!(headers.get("x-azure-client-id").unwrap(), "my-client-id"); - assert_eq!(headers.get("x-azure-tenant-id").unwrap(), "my-tenant-id"); - } } diff --git a/rust/lancedb/src/remote/db.rs b/rust/lancedb/src/remote/db.rs index d84d7feb8..0d76e9057 100644 --- a/rust/lancedb/src/remote/db.rs +++ b/rust/lancedb/src/remote/db.rs @@ -782,12 +782,7 @@ impl RemoteOptions { impl From for RemoteOptions { fn from(options: StorageOptions) -> Self { - let supported_opts = vec![ - "account_name", - "azure_storage_account_name", - "azure_client_id", - "azure_tenant_id", - ]; + let supported_opts = vec!["account_name", "azure_storage_account_name"]; let mut filtered = HashMap::new(); for opt in supported_opts { if let Some(v) = options.0.get(opt) {