Make sure these boxes are checked before submitting your issue - thank you!
0.28.1
Have the possibility to create charts from SQL statements without returned data.
Alternatively allow "mocking" of jinja function, filter_values in this case.
When working on a custom SQL query in Sql Lab that includes a jinja expression that returns values given by a filter_box, it is not possible to create a Chart from that query.
A minimal example is:
SELECT * FROM "people" WHERE "country" in ({{ "'" + "','".join(filter_values('country')) + "'" }})
That query, while valid in a dashboard when filters are selected, returns _"The query returned no data"_ in Sql Lab. Without a result, the query cannot be "explored" and therefore a slice cannot be created.
There are workarounds for simple examples like the one mentioned, but for more complicated statements (nested selects) it would be nice to be able to develop in Sql Lab and have the possibility to create a chart even if the result would be empty without a filter provided.
Another option would be if the parameters button could be used to inject values to the filter_values function.
Execute
SELECT * FROM "people" WHERE "country" in ({{ "'" + "','".join(filter_values('country')) + "'" }})
in Sql Lab. Try to display as a chart (on a dashboard).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I had the exact same problem but it seems like development isn't very active on this front. The behaviour of filter_values is extremely buggy and not well documented, which makes developing anything other than the simplest visualizations extremely hard.
Most helpful comment
I had the exact same problem but it seems like development isn't very active on this front. The behaviour of filter_values is extremely buggy and not well documented, which makes developing anything other than the simplest visualizations extremely hard.