Skip to content

Commit

Permalink
feat: Add UC support for all cloud providers
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Carman <[email protected]>
  • Loading branch information
hntd187 authored and ion-elgreco committed Jan 20, 2025
1 parent 0fcf2b6 commit 3d6f836
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/catalog-unity/src/datafusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ impl UnitySchemaProvider {
&self,
catalog: &str,
schema: &str,
name: &str,
table: &str,
) -> Result<TemporaryTableCredentials, UnityCatalogError> {
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()),
Expand Down
8 changes: 8 additions & 0 deletions crates/catalog-unity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
6 changes: 5 additions & 1 deletion crates/catalog-unity/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -419,6 +419,7 @@ impl TemporaryTableCredentials {

#[cfg(not(feature = "aws"))]
pub fn get_aws_credentials(&self) -> Option<HashMap<String, String>> {
tracing::warn!("AWS Credentials found, but the feature is not enabled.");
None
}

Expand All @@ -430,6 +431,7 @@ impl TemporaryTableCredentials {

#[cfg(not(feature = "azure"))]
pub fn get_azure_credentials(&self) -> Option<HashMap<String, String>> {
tracing::warn!("Azure credentials found, but the feature is not enabled.");
None
}

Expand All @@ -441,6 +443,7 @@ impl TemporaryTableCredentials {

#[cfg(not(feature = "gcp"))]
pub fn get_gcp_credentials(&self) -> Option<HashMap<String, String>> {
tracing::warn!("GCP credentials found, but the feature is not enabled.");
None
}

Expand All @@ -452,6 +455,7 @@ impl TemporaryTableCredentials {

#[cfg(not(feature = "r2"))]
pub fn get_r2_credentials(&self) -> Option<HashMap<String, String>> {
tracing::warn!("r2 credentials found, but feature is not enabled.");
None
}

Expand Down

0 comments on commit 3d6f836

Please sign in to comment.