-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Thanks for creating this crate, it's a time saver! We needed a way to query Snowflake and convert to arrow/parquet, so this is perfect for us. There are some tweaks I would need in order to use this for tests. I'm happy to submit a PR, but wanted to see if you were accepting them?
Currently, the host is hard-coded to go snowflakecomputing.com. There is a way to test snowflake now on LocalStack, but it requires a custom host and port (host: snowflake.localhost.localstack.cloud, port: 4566).
I think this can be added to the builder without affecting the current API in lib.rs (just the signature to request() in connection.rs):
pub struct SnowflakeApi {
connection: Arc<Connection>,
session: Session,
account_identifier: String,
host: Option<String>, // this is new
}
pub fn with_host(mut self, uri: &str) {
self.host = Some(uri);
}Then, in the request() function in connection.rs:
pub async fn request<R: serde::de::DeserializeOwned>(
&self,
query_type: QueryType,
account_identifier: &str,
extra_get_params: &[(&str, &str)],
auth: Option<&str>,
body: impl serde::Serialize,
host: Option<&str>, // this is new
)
...
let url = host.unwrap_or_else(|| format!(
"https://{}.snowflakecomputing.com/{}",
&account_identifier, context.path
));REFS:
Hard coding:
snowflake-rs/snowflake-api/src/connection.rs
Lines 147 to 149 in 57705c5
| let url = format!( | |
| "https://{}.snowflakecomputing.com/{}", | |
| &account_identifier, context.path |
LocalStack on Snowflake docs: https://snowflake.localstack.cloud/introduction/