I think I’m using Merge wrong or at least I’m very confused by it!
What Grafana version and what operating system are you using?
Ubuntu with Grafana in container. It’s the latest image.
What are you trying to achieve?
I have four tables. Let’s say they’re called A (id of B and C), B (id, name, age), C (colour, make) and D. A is basically a many-to-many lookup table so that B and C both have an ID field in it. Let’s also say that B has a many-to-one relationship with D.
I ensure that the name of the id fields matched so that B ID was called PersonId and C ID was called CarId. I made sure the id field in B and C reflected this too.
I’m trying to merge those tables into a single view like you’d be able to do with SQL. Unfortunately, I’m using the JSON Infinity Plugin which pulls from four different APIs.
How are you trying to achieve it?
I’ve been trying to use the Merge transform. This seems to work to join two of the queries together but not all.
I’ve also tried using the Config from Query transform but that’s a bit messy if there’s multiple columns in each table.
What happened?
The tables did not merge. I hid two of the tables and then it successfully joined. Unhiding them made it not work again.
What did you expect to happen?
The tables to join.
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
It’s possible to join using a transformation provided that the two data frames have a field in common. There’s a blog about this with screenshots showing you how:
Broadly, “merge” just glues two data frames together and is best when the two data frames have exactly the same schema and you just want to “add more records to the bottom of the result set”. Join by ID is much more like a SQL join.
Note that while Grafana can do a number of SQL like operations, if you can do it in the underlying database you are always going to be better off doing it there, that is, write a more complex SQL query and return one frame.
Hey, thank you I’ve seen this page before. It doesn’t really solve my issue though because like in my example I want to glue multiple tables together on different variables. Is there a way to do multiple joins?