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?
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).
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
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.