Home > Blockchain >  Sql query to create graph from a table of events
Sql query to create graph from a table of events

Time:12-26

I have a plain old table in SQL Server like so:

JOB    Step     Timestamp
----------------------------------
1      begin    12/25/2021 1:00 AM
1      foo      12/25/2021 1:01 AM
1      bar      12/25/2021 1:02 AM
1      end      12/25/2021 1:03 AM

It is a list of steps, that transition from one to the other, and the transition is determined by the timestamp. I would like to render it as a graph of events, so am trying to query it with results like:

JOB    Source    Target   Timestamp
--------------------------------------------
1      begin     foo      12/25/2021 1:01 AM
1      foo       bar      12/25/2021 1:02 AM  
1      bar       end      12/25/2021 1:03 AM

This is not a SQL Server graph table but I'd like it to behave like one in this case.

This is ultimately going to be rendered in PowerBI using S1

  • Related