How to turn a complicated graph into Json Graph Format?
0
votes
0
answers
112
views
So having such normalized Postgres 13/14 graph of item joins:
CREATE TABLE items (
item_id serial PRIMARY KEY,
title text
);
CREATE TABLE joins (
id serial PRIMARY KEY,
item_id int,
child_id int
);
INSERT INTO items (item_id,title) VALUES
(1,'PARENT'),
(2,'LEVEL 2'),
(3,'LEVEL 3.1'),
(4,'LEVEL 4.1'),
(5,'LEVEL 4.2'),
(6,'LEVEL 3.2');
INSERT INTO joins (item_id, child_id) VALUES
(1,2),
(2,3),
(3,2),
(3,5),
(2,6);
How to turn it into a JSON Graph Format document containing item columns as fields?
Asked by Blender
(75 rep)
Jul 23, 2021, 10:59 AM
Last activity: Jul 25, 2021, 10:16 PM
Last activity: Jul 25, 2021, 10:16 PM