'How do I insert dynamic parameters when importing query results?
I want to import the value by putting parameters when loading the query itself.
SELECT *
FROM my_table
WHERE date = {{date}}
When getting results from a big query, I would like to change the part {{date}} above by selecting it from the filter.
Superset imported all the data to filter the data, which is not good for bigquery's performance.
So I want to reduce the range by entering parameters before importing the result itself.
And I want to manipulate that parameter by adding a filter from the dashboard.
In conclusion, I would like to receive the query itself by dynamically converting the parameters.
Solution 1:[1]
Take a look to Preset User's Corner youtube channel, they have made some videos about how to use Jinja Template parameter to filter your virtual datasets created using SQLLab queries.
As this have been modernize in recent versions of Superset, check that you have at least version 1.0 (better if you have 1.1)
Solution 2:[2]
First of all, you need to activate Jinja templating if you have not done this before. To do this, you should add another element to the FEATURE_FLAGS
dictionary in your superset_config.py
. Element’s key will be ENABLE_TEMPLATE_PROCESSING
, and the value will be True. Here is how it will look like:
FEATURE_FLAGS = {
... # your existing flags
"ENABLE_TEMPLATE_PROCESSING": True,
}
After that, you need to restart your Superset script or container and utilise the power of Jinja templates.
Source: https://medium.com/geekculture/interactive-dashboards-in-apache-superset-ec4a3bf9bc82
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ana GH |
Solution 2 | Praytic |