Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Use user secrets in an SQL Script Recipe

NN
Neuron
Neuron
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 

0 Kudos
3 Replies
Marlan
Neuron
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

 

NN
Neuron
Neuron
Author

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.

0 Kudos
Marlan
Neuron
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

0 Kudos