My Grafana dashboard includes ~15 panels. All panels should be visible at the same time. Every panel uses complex long SQL. All SQLs are very similar, the only difference is the value in WHERE clause, for example in one SQL I have:
WHERE state = 'CA' and city= 'LA'
In another SQL:
WHERE state = 'FL' and city= 'Miami'
etc …
Question: how to avoid typing the same SQL as many times as many panels I have? How to reuse the same SQL by passing the different params values (state and city in my case) into WHERE clause? I think one approach is to use the database stored procedure, but may be exists pure Grafana solution?
I know that there are Grafana variables, which will be visible as drop-down list, but I think it does not work for my case, because all panels should be visible at the same time.