Bug? I'm having an issue with grafana filters when the table is empty

So I’m using filters which are filled dynamically from what’s in the mysqldb. When the table is filled with data, there is no issues here, the filters work fine.

When the customer first installs though, it breaks the sql query as there is nothing for this line to select.
and region in ($v_Region)

With $v_Region being my working filter when we have data. Here is the error that shows up when there is nothing in the table:
graf

Is there a way around this error as I would like the customer not to see errors on install of our product. Or am I possibly doing something the wrong way?

Thanks !

Taylor

Off the top of my head, your best bet might be to modify your SQL query so it behaves sanely if that template variable is blank. I’m not a SQL expert, but something “hacky” like a CASE statement would probably do the trick.

You can also see if any of the advanced variable interpolation options will lead to a better result, but at a quick glance I don’t see any silver bullets there.