how can I create a list of strings/values by using a “SELECT” statement or any other “query”? Needed for a Grafana requirement.
My purpose is to get multiple rows from a value list e.g (10,22,31,42,51),(‘a’,‘b’,‘c’,‘anything’) and so on; but it has nothing to do with any “measurement”.
I’m using latest version of InfluxDB which is 1.2.4
You could use sample and a wildcard regex matcher. This will return a pseudorandom set of real values from every measurement in the target database, unless you use a more restrictive regex or just name a specific measurement.
> select sample(*, 1) from /.*/ slimit 1
name: ctr
time sample_a1 sample_a2 sample_a3 sample_n
---- --------- --------- --------- --------
1498148711505548911 295
name: r
time sample_a1 sample_a2 sample_a3 sample_n
---- --------- --------- --------- --------
1498164480080645858 1 2 3
I’m sorry that my word “random” here has created the confusion. I’ll edit the question.
What i meant is that I’ll give the values as some kind of list in the query, the result should output the values as a table, like result of a general SELECT query.
For example, something like this.
sql> select * as name from dummy where name in ("foo", "bar", "spam");
+---------+
| name |
+---------+
| foo |
| bar |
| spam |
+---------+
3 rows in set (0.00 sec)