Hello, I want to use <SnowflakeQuery> Task against...
# ask-community
g
Hello, I want to use SnowflakeQuery Task against Snowflake configure with Okta SSO and MFA enable. Based on the documentation on Snowflake connector documentation I would have to pass
authenticator
to the connect method (which doesn't seams to be possible at the moment in the task). Is my assumption correct or is there a magic env variable I can use? If not is it a change I can request or implement my self in the repository?
I did a workaround manually on
env/lib/python3.9/site-packages/prefect/tasks/snowflake/snowflake.py
file by adding
"authenticator":"externalbrowser"
so the parameter could be easily implemented if needed.
a
@Gaylord Cherencey I may overlook something, but as far I understand, you have SSO and MFA enabled on your Snowflake account, correct? But for queries from Prefect, you need a database user rather than an account user. You could use CREATE USER within your accountadmin query editor as follows: https://gist.github.com/anna-geller/ee83be689dd5033a2fe6187582f69808 But if you need to subclass the SnowflakeQuery task and add your own method of authentication, feel free to do so, too.
g
Thank you for the answer @Anna Geller. Indeed we have SSO and MFA enable on our Snowflake account and all the physical users are stored in our Okta tenant (it is different for service account). For security reason we cannot use service account when interacting locally with Snowflake but rather use our user account with MFA. This is why I need to set
authenticator
to
externalbrowser
instead of passing the
password
option. I surely can implement it in a python
@task
function but I would rather leverage what exist in the tool. I think that adding this parameter as optional would be beneficial for a large amount of Snowflake users.
k
It sounds you already have a solution coded up? Would you be interested in making a PR?
g
Sure thing
a
thanks for contributing! 👍