Add OAuth authentication method for Snowflake#177
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Snowflake authentication config model intended to support OAuth-based connections, and exposes it via the package public API.
Changes:
- Introduces
SnowflakeOAuthAuthwith a secrettokenfield. - Extends
SnowflakeConnectionProperties.authunion to acceptSnowflakeOAuthAuth. - Exports
SnowflakeOAuthAuthfromdatabao_context_engine.__init__.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/databao_context_engine/plugins/databases/snowflake/config_file.py |
Adds OAuth auth model and makes it selectable in Snowflake connection config. |
src/databao_context_engine/__init__.py |
Re-exports the new auth model for external consumers. |
Comments suppressed due to low confidence (1)
src/databao_context_engine/plugins/databases/snowflake/config_file.py:47
SnowflakeOAuthAuthcurrently only contributestokenintoto_snowflake_kwargs(). Snowflake’s Python connector requiresauthenticator='oauth'(in addition totoken) for OAuth-based connections; without setting this,snowflake.connector.connect(**kwargs)will still use the default authenticator and the token will be ignored / auth will fail. Consider either adding anauthenticatorfield toSnowflakeOAuthAuthwith a default of'oauth', or special-casingto_snowflake_kwargs()to injectauthenticator='oauth'whenself.authis aSnowflakeOAuthAuth.
def to_snowflake_kwargs(self) -> dict[str, Any]:
kwargs = self.model_dump(
exclude={
"additional_properties": True,
},
exclude_none=True,
)
auth_fields = kwargs.pop("auth", {})
kwargs.update(auth_fields)
kwargs.update(self.additional_properties)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JulienArzul
approved these changes
Apr 7, 2026
Collaborator
JulienArzul
left a comment
There was a problem hiding this comment.
You've checked that it works right?
From what I remember, we flatten the attributes within the auth objects, meaning that the token argument will be passed directly to the Snowflake connect method
Member
|
@JulienArzul yes, it's tested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
SnowflakeOAuthAuth