Reputation: 29
I have used google translator, so excuse me if something looks weird.
I have superset on an Ubuntu virtual machine. I have downloaded a Superset OpenSource and I have version 1.1.0 of Superset. I am trying to do SQL queries with parameters to be able to create parameterized charts, however, in the SQL Lab section I do not see the 'parameters' button.
I have tried to create a parameter in the configuration of a dataset, in the section 'template parameters' with the syntax: {"parameter": "value"} And then use the parameter as follows: {{parameter}} but it throws me wrong.
I have set the value of "ENABLE_TEMPLATE_PROCESSING" to True in the config.py file I have also modified the superset_config.py file as per the official superset documentation.
Do I have to configure something else? Could it be that my changes to the configuration files are not being applied? I have tried to relaunch the following commands to see if they helped with the latter: superset db upgrade superset init
Upvotes: 0
Views: 2430
Reputation: 11
We just had the same issue.
Yes - this is turned off by default as mentioned here (11172) https://github.com/apache/superset/blob/master/UPDATING.md
In our case we were adding the ENABLE_TEMPLATE_PROCESSING in the wrong place in the superset_config.py file, which meant the "parameters" option did not appear.
It has to be added against the FEATURE_FLAG dictionary like this - for this to work a designed :
FEATURE_FLAGS = {"ALERT_REPORTS": True, "ENABLE_TEMPLATE_PROCESSING": True}
Upvotes: 1
Reputation: 1700
Probably, you don't want parameters in the SQL Lab, but in the Dashboard you are using to view the results of your SQL Lab query, in that case, you build the query in SQL Lab without parameters, save it as a virtual dataset and afterwards, you create a Chart and a Filter Box over that virtual dataset and use them in the Dashboard.
But if you really need to parametrize your query, look for information about Jinja Template in the documentation and in Superset User's channel in Youtube. Beware, the concept of Virtual Dataset was introduced quite recently, so information a few months old is a bit different. The same with Jinja Template, it's a bit different now I think.
Upvotes: 0