Global environment variables set dynamically at project level without scenario
Hi,
For security needs on project creation on Design node (not automation, no scenario), I would like to use a global variable that is updated at project opening.
For example, a user opens a project, go to a snowflake dataset, create a prepare recipe and run it.
I would like to pass user informations on query tag : {"projectKey": ${projectKey}, "userName":${userName}, ........ }
${projectKey} is ok as its a system variable, but I would like to update other environment variable in DSS settings.
Is there a way to do such thing ? Thanks in advance.
Operating system used: linux aws
Best Answer
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,166 Neuron
You should look at setting up the Snowflake connection to use per-user credentials instead:
The way you want to do things is not going to work. Project variables are not isolated from different users. You can easily have one user overwrite another user's variable in the same project.
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,166 Neuron
Why do you need to do this? What is the actual requirement you are trying to achive?
-
In the snowflake cloud environment I need to report for each query : who, when, why, from which tool, from which group, which recipe, etc.
Such "query tags" works with variables in DSS connection settings. So my variables needs to be dynamically updated.
Exactly like the builtin ${projectKey} variable. You can use it everywhere in the recipes. I'm trying to create per users variables, per groups variables, etc.
An equivalent to .bashrc : a python script that will run at project opening and set the values of a couple of environment variables.
Thanks.
-
Ok, I understand what you mean. Its like having two people working on the same project and one checkout on a dev branch. The other will switch too.
One project share all the ressources to all the people.
I will look for a DSS way.
The solution with Snowflake connection is interesting. It will be quite different as i have SSO.
Thanks a lot.
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,166 Neuron
This might be a better without changing the authentication of the Snowflake connection:
https://doc.dataiku.com/dss/latest/connecting/sql/snowflake.html#switching-role-and-warehouse
You can pass a Snowfloke role from a user property. I wonder if oyu can use this to identify who the user is.