I am trying to create a flow map and have 5000 nodes and millions of edges. I've used
SELECT StartID, DestID, Weight,
make_line(a.geometry, b.geometry)
FROM edges
JOIN nodes a ON edges.StartID = a.ID
JOIN nodes b ON edges.DestID = b.ID
WHERE a.ID != b.ID
which I found on https://anitagraser.com/2019/05/04/flow-maps-in-qgis-no-plugins-needed/.
Not surprisingly with known performance issues with virtual layers in QGIS, QGIS keeps crashing as it can't handle the large dataset.
I'm looking for ways I can create and export this using just python.
How can I do this?