jupysql
jupysql copied to clipboard
Snowflake Private file support in
Hi Team, We use private key to connect to snowfake however, there is no option at the moment
Workaround, I uses --creator getcon option however, it would be great if it supports out of the box
https://docs.snowflake.com/en/user-guide/python-connector-example.html#using-key-pair-authentication-key-pair-rotation
seems like you need a few functions calls to make this work, so I'm unsure how this could work out of the box. can you provide more detail? how are you calling --creator and how do you think this would work out of the box?
@edublancas thanks for taking a look
This is my set up now
-
create a dns.ini file with snowflake setting
-
Create a function which returns connection def getcon(): ctx = snowflake.connector.connect( user='
', account='<account_identifier>', private_key=pkb, warehouse=WAREHOUSE, database=DATABASE, schema=SCHEMA ) return con -
create a connection %load-ext sql %sql --select DB_CON_CONFIG1 --creator getcon
-
You can run snowflake query now
Note: dns.ini file does not support "private_key" parameter as it is using generic URL function instead of snowflake library
from snowflake.sqlalchemy import URL
makes sense. I'm unsure what you mean by out of the box, how would you expect this to work?
I would like to have a feature to provide a private file in dns.ini file instead of writing custom function. Also, it would be great if we have a GUI extension to enter credential and save at server side instead of creating ini file manually.
Example,
[DB_CONFIG_1] drivername=snowflake host=my.remote.host port=443 database=mydatabase username=myuser private_key =<abs_path>
GUI menu to generate above file instead of manually creating.
