Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions src/connector/src/source/adbc_snowflake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct AdbcSnowflakeProperties {

/// The password for authentication.
#[serde(rename = "adbc_snowflake.password")]
pub password: String,
pub password: Option<String>,

/// The name of the database to use.
#[serde(rename = "adbc_snowflake.database")]
Expand Down Expand Up @@ -121,8 +121,14 @@ pub struct AdbcSnowflakeProperties {
pub auth_token: Option<String>,

/// JWT private key file path (when using `auth_jwt`).
#[serde(rename = "adbc_snowflake.jwt_private_key")]
pub jwt_private_key: Option<String>,
#[serde(rename = "adbc_snowflake.jwt_private_key_path")]
pub jwt_private_key_path: Option<String>,

#[serde(rename = "adbc_snowflake.jwt_private_key_pkcs8_value")]
pub jwt_private_key_pkcs8_value: Option<String>,

#[serde(rename = "adbc_snowflake.jwt_private_key_pkcs8_password")]
pub jwt_private_key_pkcs8_password: Option<String>,

/// Unknown fields for forward compatibility.
#[serde(flatten)]
Expand All @@ -133,7 +139,9 @@ impl crate::enforce_secret::EnforceSecret for AdbcSnowflakeProperties {
const ENFORCE_SECRET_PROPERTIES: phf::Set<&'static str> = phf::phf_set! {
"adbc_snowflake.password",
"adbc_snowflake.auth_token",
"adbc_snowflake.jwt_private_key",
"adbc_snowflake.jwt_private_key_path",
"adbc_snowflake.jwt_private_key_pkcs8_value",
"adbc_snowflake.jwt_private_key_pkcs8_password"
};
}

Expand Down Expand Up @@ -167,11 +175,14 @@ impl AdbcSnowflakeProperties {
let mut builder = DatabaseBuilder::default()
.with_account(&self.account)
.with_username(&self.username)
.with_password(&self.password)
.with_database(&self.database)
.with_schema(&self.schema)
.with_warehouse(&self.warehouse);

if let Some(ref password) = self.password {
builder = builder.with_password(password);
}

// Set the max timestamp precision to microseconds, as RisingWave supports at most microsecond precision.
builder.other.push((
OptionDatabase::Other(
Expand Down Expand Up @@ -210,8 +221,17 @@ impl AdbcSnowflakeProperties {
builder = builder.with_auth_token(auth_token);
}

if let Some(ref jwt_private_key) = self.jwt_private_key {
builder = builder.with_jwt_private_key(jwt_private_key.into());
if let Some(ref jwt_private_key_path) = self.jwt_private_key_path {
builder = builder.with_jwt_private_key(jwt_private_key_path.into());
}

if let Some(ref jwt_private_key_pkcs8_value) = self.jwt_private_key_pkcs8_value {
builder = builder.with_jwt_private_key_pkcs8_value(jwt_private_key_pkcs8_value.into());
}

if let Some(ref jwt_private_key_pkcs8_password) = self.jwt_private_key_pkcs8_password {
builder =
builder.with_jwt_private_key_pkcs8_password(jwt_private_key_pkcs8_password.into());
}

Ok(builder)
Expand Down
10 changes: 8 additions & 2 deletions src/connector/with_options_source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AdbcSnowflakeProperties:
- name: adbc_snowflake.password
field_type: String
comments: The password for authentication.
required: true
required: false
- name: adbc_snowflake.database
field_type: String
comments: The name of the database to use.
Expand Down Expand Up @@ -57,10 +57,16 @@ AdbcSnowflakeProperties:
field_type: String
comments: '`OAuth` token for authentication (when using `auth_oauth`).'
required: false
- name: adbc_snowflake.jwt_private_key
- name: adbc_snowflake.jwt_private_key_path
field_type: String
comments: JWT private key file path (when using `auth_jwt`).
required: false
- name: adbc_snowflake.jwt_private_key_pkcs8_value
field_type: String
required: false
- name: adbc_snowflake.jwt_private_key_pkcs8_password
field_type: String
required: false
AzblobProperties:
fields:
- name: azblob.container_name
Expand Down