From 3d6f8368bbfd4fe2eddd3872deaa57fa610f9c07 Mon Sep 17 00:00:00 2001 From: Stephen Carman Date: Fri, 17 Jan 2025 10:23:28 -0500 Subject: [PATCH] feat: Add UC support for all cloud providers Signed-off-by: Stephen Carman --- crates/catalog-unity/src/datafusion.rs | 6 +++--- crates/catalog-unity/src/lib.rs | 8 ++++++++ crates/catalog-unity/src/models.rs | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/catalog-unity/src/datafusion.rs b/crates/catalog-unity/src/datafusion.rs index 3f91d98e84..c8f9aa1e89 100644 --- a/crates/catalog-unity/src/datafusion.rs +++ b/crates/catalog-unity/src/datafusion.rs @@ -180,16 +180,16 @@ impl UnitySchemaProvider { &self, catalog: &str, schema: &str, - name: &str, + table: &str, ) -> Result { tracing::debug!( "Fetching new credential for: {}.{}.{}", catalog, schema, - name + table ); self.client - .get_temp_table_credentials(catalog, schema, name) + .get_temp_table_credentials(catalog, schema, table) .map(|resp| match resp { Ok(TableTempCredentialsResponse::Success(temp_creds)) => Ok(temp_creds), Ok(TableTempCredentialsResponse::Error(err)) => Err(err.into()), diff --git a/crates/catalog-unity/src/lib.rs b/crates/catalog-unity/src/lib.rs index 05b97c735b..611f777411 100644 --- a/crates/catalog-unity/src/lib.rs +++ b/crates/catalog-unity/src/lib.rs @@ -1,4 +1,12 @@ +#![warn(clippy::all)] +#![warn(rust_2018_idioms)] //! Databricks Unity Catalog. +#[cfg(not(any(feature = "aws", feature = "azure", feature = "gcp", feature = "r2")))] +compile_error!( + "At least one of the following crate features `aws`, `azure`, `gcp`, or `r2` must be enabled \ + for this crate to function properly." +); + use reqwest::header::{HeaderValue, InvalidHeaderValue, AUTHORIZATION}; use std::str::FromStr; diff --git a/crates/catalog-unity/src/models.rs b/crates/catalog-unity/src/models.rs index b939649b76..98be7481e7 100644 --- a/crates/catalog-unity/src/models.rs +++ b/crates/catalog-unity/src/models.rs @@ -403,7 +403,7 @@ pub struct TemporaryTableCredentials { pub url: String, } -#[cfg(feature = "aws")] +#[cfg(any(feature = "aws", feature = "r2"))] static INIT_AWS: Once = Once::new(); #[cfg(feature = "azure")] static INIT_AZURE: Once = Once::new(); @@ -419,6 +419,7 @@ impl TemporaryTableCredentials { #[cfg(not(feature = "aws"))] pub fn get_aws_credentials(&self) -> Option> { + tracing::warn!("AWS Credentials found, but the feature is not enabled."); None } @@ -430,6 +431,7 @@ impl TemporaryTableCredentials { #[cfg(not(feature = "azure"))] pub fn get_azure_credentials(&self) -> Option> { + tracing::warn!("Azure credentials found, but the feature is not enabled."); None } @@ -441,6 +443,7 @@ impl TemporaryTableCredentials { #[cfg(not(feature = "gcp"))] pub fn get_gcp_credentials(&self) -> Option> { + tracing::warn!("GCP credentials found, but the feature is not enabled."); None } @@ -452,6 +455,7 @@ impl TemporaryTableCredentials { #[cfg(not(feature = "r2"))] pub fn get_r2_credentials(&self) -> Option> { + tracing::warn!("r2 credentials found, but feature is not enabled."); None }