Skip to content

Commit

Permalink
Add node_id column to Node table
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Feb 19, 2024
1 parent b0a5aa8 commit 9820b73
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 76 deletions.
4 changes: 2 additions & 2 deletions core/src/graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and data of edges (EdgeMetadata):
[`EdgeMetadata`](@ref)
"""
function create_graph(db::DB, config::Config, chunk_sizes::Vector{Int})::MetaGraph
node_rows = execute(db, "SELECT fid, type, subnetwork_id FROM Node ORDER BY fid")
node_rows = execute(db, "SELECT node_id, type, subnetwork_id FROM Node ORDER BY fid")
edge_rows = execute(
db,
"SELECT fid, from_node_type, from_node_id, to_node_type, to_node_id, edge_type, subnetwork_id FROM Edge ORDER BY fid",
Expand All @@ -33,7 +33,7 @@ function create_graph(db::DB, config::Config, chunk_sizes::Vector{Int})::MetaGra
graph_data = nothing,
)
for row in node_rows
node_id = NodeID(row.type, row.fid)
node_id = NodeID(row.type, row.node_id)
# Process allocation network ID
if ismissing(row.subnetwork_id)
allocation_network_id = 0
Expand Down
6 changes: 1 addition & 5 deletions core/src/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,8 @@ function get_nodetypes(db::DB)::Vector{String}
return only(execute(columntable, db, "SELECT type FROM Node ORDER BY fid"))
end

function get_ids(db::DB)::Vector{Int}
return only(execute(columntable, db, "SELECT fid FROM Node ORDER BY fid"))
end

function get_ids(db::DB, nodetype)::Vector{Int}
sql = "SELECT fid FROM Node WHERE type = $(esc_id(nodetype)) ORDER BY fid"
sql = "SELECT node_id FROM Node WHERE type = $(esc_id(nodetype)) ORDER BY fid"
return only(execute(columntable, db, sql))
end

Expand Down
Loading

0 comments on commit 9820b73

Please sign in to comment.