JuliaDB.jl icon indicating copy to clipboard operation
JuliaDB.jl copied to clipboard

Add row to loaded table

Open yakir12 opened this issue 6 years ago • 1 comments
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

yakir12 avatar Apr 30 '19 12:04 yakir12

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))

yakir12 avatar Apr 30 '19 12:04 yakir12