How I set and visualize id array in Grafana?

Hello everybody!
I need help displaying array of data. Have a next table:

time id name price title views

id - is identification of advert; it’s dynamic value

I’m try to get array of id’s from grafana to influxdb:

SELECT * FROM olx WHERE id = [id] ORDER BY time DESC;

but I have no data(
Please help create true request to db (Influxdb 1.8)
Thanks!

Can you rephrase your question? I don’t get what you are trying to do…

also, provide the necessary info to understand the query:

  • measurement structure
  • current query

I have next tables in influxdb

> select * from olx
name: olx
time                id        name      price title                                                     views
----                --        ----      ----- -----                                                     -----
1638445619723411611 726553615 "Alex"    2000  SSD M2 Samsung 250Gb PRO                                  125
1638445652184178827 723134335 "Человек" 600   ОЗУ SK Hynix 4gb DDR-4 2666                               81
1638445682003754288 728372625 "Alex"    500   Комутатор Ubiquiti UniFi Switch 8 (US-8) (все не рабочие) 233
1638445716856633795 723268384 "Человек" 4555  MIDI-клавиатура Novation LAUNCHKEY 49                     407
1638445747457026240 723259840 "Alex"    1200  Графический планшет Wacom PTH-450 ( без пера )            159
1638445784823900344 723260301 "Alex"    1200  Графический планшет Wacom PTK-440 ( без пера )            129
1638445810871590032 723248702 "Alex"    5000  Ubiquiti Unifi USG-4-PRO                                  172
1638445835927006304 723134975 "Alex"    300   Точка доступа D-Link DWL-2600AP                           121

Current request from grafana to influxdb:
SELECT views FROM olx WHERE id=723268384 ORDER BY time DESC;

It’s working, but for one advert. I need one request in db for array (id).

I don’t know how to create 1 request for the entire array, so as not to make one request for each id because the id often changes (ads are removed / added)
It’s my question

To filter multiple values you can just use OR, something like (id=1 OR id = 2)`, but since you don’t have a fixed set of values you can’t just put some static ids in there… This will be true for any system, not just InfluxDB.

you might get something that works using Grafana Template Variables as that will allow you to filter by a list, and use that filter wherever you want without actually writing fixed values in your query… if this is suitable I can’t tell, as it’s up to the use case

Ok, thanks for you reply Giovanni_Luisotto
If I choose mongodb for example, does the solution work?

I don’t think so… if I understand it correctly no system will actually allow you to do so in a flexible way…

I will use an example to explain myself… let’s say you want to get a list of products…

| Category | Product |
|----------|---------|
| A        | 1       |
| A        | 2       |
| A        | 3       |
| B        | 4       |

you can logically write a query that does WHERE Product IN (1,2,3) to fetch the products, but it won’t “scale”, if any product gets moved/deleted/added you will have to keep editing it… which is just madness… what you want to do is use WHERE Category = 'A' as it will always work no matter what, without any need for editing unless the logic changes.
The problem is, you need an attribute to do so, in the case above I’ve used category, in your case I don’t any suitable attribute to filter those data…

if you actually explain what you want to achieve in the end I might understand something more about your requirement

I want not to do it with my hands every time
SELECT views FROM olx WHERE id = 723268384 ORDER BY time DESC;

Instead, I want the id to be automatically substituted into the expression.
Maybe need a while for loop, either in code or in a query.

Something like:
SELECT views FROM olx WHERE id = [id ... n] ORDER BY time DESC;

Then see

that’s the grafana way of doing that

Hello!
I’m try do it but graph not visualize
What I do:

  1. see example Grafana
  2. try construct my queries
    SELECT “title” FROM “autogen”.“olx” WHERE (“name” =~/^$title$/) AND $timeFilter

without context, I can’t help you.
Also, the Grafana playground can’t be “saved” therefore I just see the standard “InfluxDB Group By Variable” sample…

  • are the names correct?
  • are you fetching at least one field? (without fields no data is returned)
  • which kind of editor are you using? the “normal” or “raw” one?

I need similar task and similar table
Convert a table to graph or time series on Grafana - Stack Overflow
But nobody asked a real solution…

I suggest you create a new post, with proper info to explain your problem:

  • sample data
  • expected result
  • what you did so far and how It looks (queries/charts/etc…)

Otherwise, nobody will be able to help.
That question on StackOverflow is not that helpful either… what do you have in common with that?
Are you using mixed data sources? do you have unsorted data?

please create a new post with all the necessary info.