Way to include current user ID in SQL table names?
![Marlan](https://us.v-cdn.net/6038231/uploads/lithium_attachments/n5296i8F6B67FE68128A4A.jpg)
Hello all,
Does anyone know of a way to automatically include the current user ID in SQL table name. I've seen references in the documentation to the variable dssUserLogin so I thought the following might work:
${projectKey}_${dssUserLogin}_TABLENAME
However this variable is not recognized in SQL recipes.
I also tried creating a user property but this didn't work either:
${projectKey}_${userProperty:user_id}_TABLENAME
Note that I am on version 8.02 so maybe one of these might work on version 10?
I realize I could create an instance variable but I can't see how I could set this to the current user when the user logs into DSS. I could set it at the beginning of a flow in a Python recipe but that would be pretty awkward and painful to do for every project.
Any ideas?
Thanks,
Marlan
Operating system used: Linux
Answers
-
Manuel Alpha Tester, Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 193 ✭✭✭✭✭✭✭
Hi Marlan,
What are you really trying to achieve?
If you are looking to enable some sort of concurrency between users of the same flow, you should look into Dataiku Applications, which instantiates copies of the same flow and achieve a similar result to what you describe.
I hope this helps.
-
Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 318 Neuron
Thanks @Manuel
.Good idea about Applications. They could be part of the picture.
It's kind of an esoteric situation and actually not clear what exactly we'll need. We are transitioning to Snowflake and will have this unique permissions set up for one of the databases that a lot of our analysts use where only the user who created tables initially will be able to drop them. The concern is being able to refresh data in tables when the creator of the tables are absent. Scenarios actually may provide most of what we need.
Thanks!
Marlan
-
I have a similar question. I would like to add an audit_stamp to all rows in our most important tables in order to log who made the change and when it was made. We are using an Oracle database and primarily working with SQL Code recipes.
Obviously, I can use 'sysdate' to obtain the current date/time for the timestamp. However, I have been unable to obtain the Dataiku userID in my SQL recipe. I tried the Oracle 'user' attribute but it contains the service account connected to Oracle (and is, therefore, the same for all users). What I would really like is to capture the Dataiku userID of the person who initiated the transaction.
Any suggestions?