Hi,

We plan to use Re:dash to visualize data for around 500 users. Each of those users shall be restricted to some part of dataset, that could be defined by WHERE conditions. We allready have a table that defines these restrictions. The only problem for now is that we don’t know how to determine current username within an SQL query. Can we use some keyword, like {{current_user}} within SQL that will be replaced with a username in the runtime?

Thank you!

3 Likes

Currently unless it’s a scheduled query execution, parameters are inserted into the query in the frontend. In the long term I plan to move parameters resolution to the backend, then we can have some predefined parameters of the current environment (current user, data source, etc).

1 Like

currently I’m facing the same problem. Have you find any working solution for this. kindly, share your solution.

Have you found any solution to get current username inside query. Please share your update on this.

Hi,
I have a similar situation. I have seen that Apache Superset uses JinjaSQL to resolve this. It works! I just wondered if it would be possible to do something like with Redash. That would be very good!
Any idea?
Tks,
Ronald

2 Likes

Hi,
Is there any solution to this problem? Or it’s not possible?

Hi @tandelDipak, welcome to the forum! I haven’t seen any movement on adding this feature to Redash.

@arikfr Can someone from redash team update us on this? I am ready to contribute to this feature.

Hi @tandelDipak, thanks for offering to contribute! You are welcome to implement this and open a pull request with the functionality.

1 Like

Hi @jesse

If I define one parameter USER_NAME and initialize it when the user logged in, will that work?

Also, I want to know how does redash stores parameters? Does it have any table in database?

@tandelDipak were you able to work this?

Hello, could you please let me know if anyone found a solution to this.

It hasn’t been implemented. Parameters are local to the query (stored in its options field). There are no global variables at present.

Still happy to review a pull request implementing this. However it seems some of the discussion has moved closer to a credential-passthrough model where the “current user” is actually known by the database rather than needing to be passed in by Redash.

Do we know if credential passthrough is still a priority?