Use user secrets in an SQL Script Recipe
Hi Dataiku Team,
Is there any way that i can use a Secret/Key in a SQL Script Recipe without having to hardcode it in the code ?
I believe the User -secrets only works in Python/R.
https://doc.dataiku.com/dss/latest/security/user-secrets.html
What i am trying to do is pass an s3-Key and Secret to an SQL script recipe running on a snowflake connection.
Any suggestions are welcome.
Thanks
Answers
-
Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 319 Neuron
Hi @NN
,Are you hoping to do this without using Python?
I don't know of way to do this other than to use a Python recipe. Maybe others will have better ideas.
If you were to use Python, you could probably use the partial recipe functionality described here to execute the SQL once you had added the user secrets. Or for more flexibility, you might use query_to_df with side effects (see above link for more info) to execute the query.
Marlan
-
Hi @Marlan
Thank you for the suggestion.
The challenge i had was that the secrets or keys i was passing were ending up in the Log.
as the sql query passed to snowflake was getting printed to the log .Anyway i found a snowflake document which helped to create variables.
https://docs.snowflake.com/en/sql-reference/session-variables.html#setting-variables-on-connection
This has helped me for now. -
Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 319 Neuron
Hi @NN
, I didn't know about the ability to set variables connections in Snowflake. Nice find! Yeah seems like a great solution for this problem.Marlan