How do I append/add data in JuliaDB table?

juliadb

#1

I am trying to append arrays to a table JuliaDB

using JuliaDB
t = table([], [], names=[:x, :y]);

I tried to do that by the following command

push!(rows(t), (x = 5, y = 9))

but I want something like:

d1 = [5,6,7];
d2 = [9,2,8];
push!(rows(t), (x = d1, y = d2))

Obviously these vectors will be huge, but for simplicity I just put this limited size.


#2

In that case you’d want append!:

julia> t = table(Int[], Int[], names=[:x, :y])
Table with 0 rows, 2 columns:
x  y
────

julia> append!(rows(t), (x=[1,2,3], y=[4,5,6]));

julia> t
Table with 3 rows, 2 columns:
x  y
────
1  4
2  5
3  6

WARNING: JuliaDB doesn’t check that the sorting of your primary key(s) are still valid here. If you have a primary key, use merge with two tables