Grafana Node Graph with SQL-Tables

Dear Grafana Community,

I would like to create a Node Graph based on two SQL-Tables: I already created the SQL-tables and connected the database to Grafana. One table includes the data for the Nodes and the other table the data of the Edges, as described within the Node Graph documentation:

I have problems to find the correct SQL-query in order to illustrate the Node graph.

With the following query, I can illustrate the data at least in a Table format in Grafana.


SELECT TOP (1000) [id-N0000] as id
,[Title-Location] as title
,[subTitle-BatchNumber] as subTitle
,[mainStat-PowderMass]as mainStat
,[secondaryStat-Sieving grad] as secondaryStat
,[arc__] as arc__1
] as arc__2
FROM [OPC_UA].[dbo].[ALM_Powder_Node]

Edge Data:

SELECT TOP (1000) [id-E0000] as id
,[source-N0000] as source
,[target-N0000] as target
,[mainStrat-PowderMass] as mainStat
,[secondaryStat] as secondaryStat
,[detail__*] as detail__1
FROM [OPC_UA].[dbo].[ALM_Powder_Edge]

However I dont know, how to combine the two queries and how to say to Grafana, which data parameter to use for the Nodes and which ones to use for the edges.

I am looking forward to some support.

Thanks in advance. Best regards, Andreas

Create two queries as you have and use them. Make sure your SQL server returns correct aliases (for example redshift AS subTitle returns subtitle column; node graph panel is case sensitive for those column names). Recent Grafana version has also a problem:

Node Graph is still beta and it is used mainly for tracing visualizations, so I would say there can be still more problems with SQL datasources.

Dear Jangaraj,

thank you for your feedback. I have inserted the queries in Grafana as you described. I see the node data table in the table view. The lower and upper case is also consistent with the documentation. In the graph view I see “No Data” unfortunately. Do you notice an error?

Best regards,

As I said, don’t use recent Grafana versions because NodeGraph: Accept valid data frames even if visualization type isn't set · Issue #45986 · grafana/grafana · GitHub - I would say this should be working with Grafana 8.3.5. You have never specified which Grafana version are you using, so this is blind guess: you are using too new Grafana.

Dear Jangaraj,

your blind guess was correct :slight_smile: I was using Grafana Version 8.3.6 that´s why it did not work. After using 8.3.5 the problem seems to be solved.

Thanks and best regards, Andreas

Let’s wait for more improvements of node graph panel - NodeGraph: Make dataframe selection more permissive · Issue #47019 · grafana/grafana · GitHub

I’m trying to do the same, but than with an SQLite database as source.
But still i’m not getting anyting on the screen.
Is X-Ray the only working source? or are there other known working sources.