How to query from PostgreSQL data source?

Because you only have 2 columns in that table that is to be expected. You have no metric name column in that table

If I use the Builder option then the output has the Query name, but not if I use the Code option. Also, the Builder option adds 2 more columns, realtime_start and realtime_end.

The metric name should come from the Query name, which is how it works in the Builder option.

What you are showing here is not the query you originally showed us
select * ftom maxros.def
Now you are showing us an api call

The above screenshot is with the Builder option, which works and I get the Query name as the table outputs (see the drop-down list). But that is not the case when I use the Code (SQL) option, shown in this screenshot - How to query from PostgreSQL data source? - #10 by usrcosmicglow

Does the additional info to your query resolve the confusion?

Turns out, grafana overrides the table name with the value column header for time-series data. So I do not need to change anything.

1 Like