Snowflake-Labs/schemachange

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.

nk-reichenbach-fall opened this issue · 0 comments

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