Skip to content

authenticator paremeter in ChatSnowflakeCortex #144

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

grepinsight
Copy link

Summary of Changes

This PR introduces the support for an optional authenticator parameter in the ChatSnowflakeCortex class, allowing for more flexible authentication methods when connecting to Snowflake. This is necessary to enable MFA token caching (https://docs.snowflake.com/en/user-guide/security-mfa#:~:text=to%20authenticator%20%3D-,username_password_mfa,-.)

The changes include:

  1. Added snowflake_authenticator Field:

    • snowflake.py: A new field snowflake_authenticator is added to the ChatSnowflakeCortex class. This field allows specifying an authentication method such as 'snowflake', 'username_password_mfa', 'oauth', etc. It can be automatically inferred from the SNOWFLAKE_AUTHENTICATOR environment variable.
  2. Connection Parameter Updates:

    • snowflake.py: The authenticator parameter is conditionally added to the Snowflake connection parameters if provided.
  3. Integration Tests:

    • Tests in test_snowflake.py have been added to ensure the correct handling and precedence of the authenticator parameter both when set explicitly and as an environment variable.
  4. Unit Tests:

    • Comprehensive unit tests have been added to check:
      • The correct setting of the authenticator parameter.
      • The behavior when only environment variables are used.
      • Scenarios when no authenticator is provided.
      • Handling of the authenticator alias value.

Include an optional field for Snowflake authenticator in ChatSnowflakeCortex class. Automatically infer from `SNOWFLAKE_AUTHENTICATOR` environment variable, allowing values like 'snowflake', 'username_password_mfa', 'oauth', etc. Update connection parameters to handle the authenticator.
Add unit tests for ChatSnowflakeCortex to verify correct handling of the authenticator parameter, including its derivation from environment variables and support for various authenticator methods and aliases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant