EBoisseauSierra opened a new issue #18937:
URL: https://github.com/apache/superset/issues/18937


   ## **Is your feature request related to a problem? Please describe.**
   
   I want to create multiple dashboards that are identical except for one 
parameter — say, the country/client they report on. It means that all the 
charts would be identical but for a variation in the `WHERE client = 
<client_name> ` clause in the SQL query.
   
   This use case is similar to the one [recently described on 
Slack](https://apache-superset.slack.com/archives/CCKHMGRRB/p1645567619308879)
   
   ## **Describe the solution you'd like**
   
   I would like to be able to retrieve the `<client_name>` attribute from the 
dashboard's JSON metadata, using Jinja templating.
   
   I.e. I would be able to define my query/virtual dataset using a syntax 
similar to:
   
   ```sql
   WHERE client = {{ dashboard_metadata(['jinja_param', 'client_name']) }}
   ```
   with the dashboard's JSON metadata read something like:
   
   ```json
   {
     "jinja_param": {
       "client_name": "ACME Co.",
       "foo": "bar",
     },
   }
   ```
   
   ## **Describe alternatives you've considered**
   
   * Using Jinja templating, an alternative could be to use URL parameters… but 
it's not very secure (or implementing a security check to verify that 
`current_user_id()` has access to `url_param('client_name')` would be too much 
hassle).
   * Specifying a “frozen” filter, which value to retrieve using `{{ 
filter_values() }}`… but again not very clean.
   * As suggested by James Jeffrey on Slack, solving my XY problem (i.e. 
multiple similar dashboards) by “Save As” a dashboard that would clone the 
underlying virtual dataset as well (that I could then modify later on). 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to