# Read the private key with open(private_key_path, 'rb') as key_file: private_key_data = key_file.read()
# Load the private key with passphrase private_key = serialization.load_pem_private_key( private_key_data, password=private_key_passphrase.encode() )
# Convert the key to the expected format pkb = private_key.private_bytes( encoding=serialization.Encoding.DER, format=serialization.PrivateFormat.PKCS8, encryption_algorithm=serialization.NoEncryption() )
# Establish a connection to Snowflake conn = snowflake.connector.connect( account=account, user=user, private_key=pkb, warehouse=warehouse, database=database, schema=schema )