diff --git a/src/connector/src/sink/mod.rs b/src/connector/src/sink/mod.rs index c42457632d4ce..ec18d38c7ea59 100644 --- a/src/connector/src/sink/mod.rs +++ b/src/connector/src/sink/mod.rs @@ -33,6 +33,7 @@ pub mod pulsar; pub mod redis; pub mod remote; pub mod snowflake; +pub mod snowflake_connector; pub mod starrocks; pub mod test_sink; pub mod trivial; diff --git a/src/connector/src/sink/snowflake_connector.rs b/src/connector/src/sink/snowflake_connector.rs new file mode 100644 index 0000000000000..e47a782e46e6e --- /dev/null +++ b/src/connector/src/sink/snowflake_connector.rs @@ -0,0 +1,51 @@ +use http::request::Builder; +use hyper::body::{Body, Sender}; +use hyper::client::HttpConnector; +use hyper::{body, Client, Request, StatusCode}; +use hyper_tls::HttpsConnector; + +use std::collections::HashMap; + +use super::{Result, SinkError}; + +const SNOWFLAKE_HOST_ADDR: &str = "snowflakecomputing.com"; +const SNOWFLAKE_REQUEST_ID: &str = "RW_SNOWFLAKE_SINK"; + +#[derive(Debug)] +pub struct SnowflakeInserterBuilder { + url: String, + header: HashMap, +} + +impl SnowflakeInserterBuilder { + pub fn new(account: String, db: String, schema: String, pipe: String, header: HashMap) -> Self { + // TODO: ensure if we need user to *explicitly* provide the request id + let url = format!("https://{}.{}/v1/data/pipes/{}.{}.{}/insertFiles?request_id={}", + account, + SNOWFLAKE_HOST_ADDR, + db, + schema. + pipe, + SNOWFLAKE_REQUEST_ID); + + Self { + url, + header, + } + } + + fn build_request_and_client() -> (Builder, Client>) { + + } + + pub async fn build(&self) -> Result { + + } +} + +#[derive(Debug)] +pub struct SnowflakeInserter { + sender: Option, + join_handle: Option>, + buffer: BytesMut, +} \ No newline at end of file