Skip to content

Commit

Permalink
fix small bugs in get private key
Browse files Browse the repository at this point in the history
Signed-off-by: HH <hhcs9527@gmail.com>
  • Loading branch information
hhcs9527 committed Sep 27, 2023
1 parent 8346fb9 commit 62f9170
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions flytekit/types/structured/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ def get_private_key():

import flytekit

pk_string = flytekit.current_context().secrets.get(SNOWFLAKE, "private_key")
pk_string = flytekit.current_context().secrets.get(TASK_TYPE, "private_key", encode_mode="rb")
p_key = serialization.load_pem_private_key(pk_string, password=None, backend=default_backend())

return serialization.load_pem_private_key(pk_string, password=None, backend=default_backend())
pkb = p_key.private_bytes(
encoding=serialization.Encoding.DER,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption(),
)

return pkb


def _write_to_sf(structured_dataset: StructuredDataset):
Expand Down

0 comments on commit 62f9170

Please sign in to comment.