-
Couldn't load subscription status.
- Fork 18
Add support for using configuration options required for Snowpark Container Services #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for using configuration options required for Snowpark Container Services #58
Conversation
|
Woops, fixed formatting issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve noticed that the host, port, and protocol are usually configured together. To simplify URL configuration, I recommend providing an enum so users can choose between specifying the account components or supplying a full URL directly. For example:
pub struct SnowflakeSession {
// …
connection: SnowflakeConnectionConfig,
}
pub enum SnowflakeConnectionConfig {
/// Configure using account identifier
Account(String),
/// Configure using container URL
Url(Url),
}
The account name is needed elsewhere even when the hostname is provided, so unfortunately it won't work to make them mutually exclusive. My intent for choosing 3 separate configuration options was so they align with the variables provided in the SPCS environment (eg Another direction could be to have something like trait SnowflakeConnectionConfig {
fn get_base_url(&self) -> String;
}and then instead of adding fields to |
|
@kenkoooo I switched to a different approach that uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this PR together. This change is critical for basic SPCS usage, as setup pulls from env variables like in this example.
Accepting both account and host seems consistent with other tools like snowflake cli.
cc @kenkoooo
Hello! I've made some changes to add basic support for using Oauth tokens for authentication in the library. The motivation for this change is to support connecting using the token (and other configuration variables) provided by Snowpark Container Services to connect to Snowflake on the internal network. This change does not provide any facility for performing the oauth flow since in SPCS the token is just provided in an environment variable.
I've tested this manually in SPCS as well as running the existing tests against a local dev instance using the host/port parameters, but I haven't added any automated tests because I don't know which features your test instance has access to. I'm happy to add some, though, depending on what's available and your tolerance for spend.
I've also fixed a bug that prevents the
SESSION_EXPIREDerror from ever being bubbled up - instead, previously, if a session expired, the error was always a json decoding error.Thanks for this connector, it's made experimentation and prototyping a lot easier.
Disclaimer: I work for Snowflake, but this contribution is made in my personal capacity and not on behalf of Snowflake in any way.