JuliaDB.jl
JuliaDB.jl copied to clipboard
Add row to loaded table
trafficstars
Cannot add a row to a loaded table:
using JuliaDB
t = table((x = [1], y = [2]))
save(t, "tmp.jdb")
t = load("tmp.jdb")
push!(rows(t), (x = 3, y = 4))
ERROR: cannot resize array with shared data
I noticed that recreating the table before the push solves this:
using JuliaDB
t = table((x = [1], y = [2]))
push!(rows(t), (x = 3, y = 4))
save(t, "tmp.jdb")
t = load("tmp.jdb")
t = table(t, pkey = t.pkey) # <--- THIS
push!(rows(t), (x = 3, y = 4))