diff --git a/src/connector/src/source/adbc_snowflake/mod.rs b/src/connector/src/source/adbc_snowflake/mod.rs index f65cb0a8cd15f..b7b31e7da9268 100644 --- a/src/connector/src/source/adbc_snowflake/mod.rs +++ b/src/connector/src/source/adbc_snowflake/mod.rs @@ -77,7 +77,7 @@ pub struct AdbcSnowflakeProperties { /// The password for authentication. #[serde(rename = "adbc_snowflake.password")] - pub password: String, + pub password: Option, /// The name of the database to use. #[serde(rename = "adbc_snowflake.database")] @@ -121,8 +121,14 @@ pub struct AdbcSnowflakeProperties { pub auth_token: Option, /// JWT private key file path (when using `auth_jwt`). - #[serde(rename = "adbc_snowflake.jwt_private_key")] - pub jwt_private_key: Option, + #[serde(rename = "adbc_snowflake.jwt_private_key_path")] + pub jwt_private_key_path: Option, + + #[serde(rename = "adbc_snowflake.jwt_private_key_pkcs8_value")] + pub jwt_private_key_pkcs8_value: Option, + + #[serde(rename = "adbc_snowflake.jwt_private_key_pkcs8_password")] + pub jwt_private_key_pkcs8_password: Option, /// Unknown fields for forward compatibility. #[serde(flatten)] @@ -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" }; } @@ -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( @@ -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) diff --git a/src/connector/with_options_source.yaml b/src/connector/with_options_source.yaml index 81a3ffb78611b..e7bb4f35b1b5e 100644 --- a/src/connector/with_options_source.yaml +++ b/src/connector/with_options_source.yaml @@ -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. @@ -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