I would like to visualise the column data lineage of some sql codes.
So far I have the next graph in graphviz:
digraph {
graph[splines = ortho,
rankdir="LR",
layout = dot,
ranksep=1
]
node [shape = rectangle, style = filled, fillcolor = "blanchedalmond"]
edge[color = black, arrowhead=vee, minlen = 1]
# add clusters
edge [style=invis]
subgraph cluster_1 {
label = "Meta";
style=dotted
{
rank=same
"col_6" -> "col_5" -> "col_4" -> "col_3" -> "col_2" -> "col_1"
}
}
subgraph cluster_2 {
style=dotted
label = "prep.sql";
{
rank=source
"prep_col_6" -> "prep_col_5" -> "prep_col_4" -> "prep_col_3" -> "prep_col_2" -> "prep_col_1"
"prep_col_6" [style=invis]
}
}
subgraph cluster_3 {
label = "some.sql";
style=dotted
node [style=filled]
{
rank=min
"some_col_6" -> "some_col_5" -> "some_col_4" -> "some_col_3" -> "some_col_2" -> "some_col_1"
// "some_col_1" "some_col_2" "some_col_3" "some_col_4" "some_col_5" "some_col_6"
"some_col_5" [style=invis]
"some_col_6" [style=invis]
}
}
/***********************************************
define nodes before defining edges - to keep sequence as desired
***********************************************/
# draw lines
edge[constraint=false style=solid] //added
# from survey data to inpu
col_1 -> prep_col_1 [constraint=true]
col_2 -> prep_col_2
col_3 -> prep_col_2
col_3 -> prep_col_2
col_4 -> prep_col_2
col_5 -> prep_col_3
col_6 -> prep_col_4
col_6 -> prep_col_5
# from input to cleaning
prep_col_1 -> some_col_1 [constraint=true]
prep_col_2 -> some_col_2
prep_col_3 -> some_col_3
prep_col_4 -> some_col_3
prep_col_5 -> some_col_4
prep_col_1-> prep_col_3 [color=red];
prep_col_1-> prep_col_5 [color=red];
}
It gives some result but not the best: Online graphviz.
What I missed possibility to show red edges inside cluster.
Means possbility to allign nodes horizontally in all clusters.
But give to nodes freedom to move inside cluster on any vertical possition .
Something like this:
excalidraw
Is it possible with Graphviz?