0

I have a requirement where in i want to run a python script from a Linux server (AWS sandbox), the purpose of the script is to connect to snowflake database and do some stuff, for connecting to snowflake via a python script i do not want to hard code the password in the script and want the script to get the password from a restricted file.

i know how i did it in windows - i used the credentials manager to store the password and the scripts gets the password from there, i am looking for a similar kind of solution for Linux.

Vivek
  • 1

1 Answers1

0

connecting to snowflake via a python script i do not want to hard code the password in the script

Instead of storing passwords, you can use key pair authentication:

https://docs.snowflake.com/en/user-guide/python-connector-example.html#using-key-pair-authentication

Gokhan Atil
  • 9,278
  • 2
  • 11
  • 24
  • Thanks @gokhan - will try this – Vivek Jun 12 '20 at 10:31
  • Hi Gokan, i tried this solution and generated the keys.. not sure how do i use it, when i use the passphrase in connection , do i need to type the passphrase or i need to save it in env variable ? – Vivek Jun 23 '20 at 09:48
  • You need to store the keys in a file, and you also update rsa_public_key for your user. Could you check the sample source code in that page? – Gokhan Atil Jun 23 '20 at 10:19
  • i did that gokan, used the code mentioned in the docs. also updated it with the path of the file and the username account everything, stored the PRIVATE_KEY_PASSPHRASE in an environment variable. i am getting the error as ProgrammingError: 251006: Password is empty – Vivek Jun 23 '20 at 10:41