Skip to content
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

Need a feature where we can pull the private key directly from os.environ["SNOWFLAKE_PRIVATE_KEY"], instead of having an option where it should be in a file only. #252

Open
nk-reichenbach-fall opened this issue May 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nk-reichenbach-fall
Copy link

Is your feature request related to a problem? Please describe.
Sometimes we don't want to store the keys in file and we directly want to use them. Current implementation, doesn't allows it.

Describe the solution you'd like
we can pull the private key directly from os.environ["SNOWFLAKE_PRIVATE_KEY"]

elif os.getenv("SNOWFLAKE_PRIVATE_KEY"):
    SF_PK = os.environ["SNOWFLAKE_PRIVATE_KEY"]
    
    key = str.encode(SF_PKB)
    
    with BytesIO(key) as pp_key:
        p_key = serialization.load_pem_private_key(
            pp_key.read(), password=None, backend=default_backend()
        )
    
    pkb = p_key.private_bytes(
                encoding = serialization.Encoding.DER,
                format = serialization.PrivateFormat.PKCS8,
                encryption_algorithm = serialization.NoEncryption())
    
    self.conArgs['private_key'] = pkb

Describe alternatives you've considered
NA

Additional context
NA

@nk-reichenbach-fall nk-reichenbach-fall added the enhancement New feature or request label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant