UNION transformation for some data source

In the table panel I use 2 queries from two different data sources (postgresql).
I want to display this data as a single set of data (as the UNION operator does).
I couldn’t choose the appropriate transformation method…
I get this result

I want to get this result.

In a real task, queries return more than one record from each data source.

Welcome @igormorshakov to the Grafana forum.

Have you tried this transformation?
image

or this one (which is apparently the same):
image

My data (two separate queries as you have), but without a transformation:

and the same two queries with the Series to Rows transformation:

I tried this transformation (Series to rows and Reduce) but it doesn’t solve my problem.
I need to union two (or more) result sets, each containing several tens or hundreds of rows. This data needs to be displayed “as is” in one table.
If this data were in the same data source, the solution would be the “union” operator

I believe Merge transformation is the right transformation for you.
BTW if you have cross DB access then you can do UNION on the SQL level.

Thanks !
My task is solved by the merge transformation method!

My first attempt at using a merge transformation was unsuccessful.
The result I got was similar to a join transformation .

The key point is that for the merge transformation method work correctly in each query, the columns must be named the same.

1 Like