How to (row) append two JuliaDB tables together?

How do I (row) append two JuliaDB tables togehter?

In DataFrames.jl [data1;data2] is sufficient, but the same syntax doesn’t work in JuliaDB. Also How do I append table 2 to table 1 by modifying table 1?

See MWE

using DataFrames, IterableTables, JuliaDB

df = DataFrame([[1:3...],[4:6...]],[:a,:b])
df1 = DataFrame([[1:3...],[4:6...]],[:a,:b])

[df;df1] # works

rs_db = table(df)
rs_db1 = table(df)

[rs_db;rs_db1] # doesn't works

merge(rs_db, rs_db1)

IndexedTables can have primary keys and appending them may not respect those which is why is not implemented ATM. OTOH, rows(rs_db) behaves pretty much like an Array of NamedTuple, so any sensible Array operation work on it. For example:


julia> append!(rows(rs_db), rows(rs_db1))
6-element IndexedTables.Columns{NamedTuples._NT_a_b{Int64,Int64},NamedTuples._NT_a_b{Array{Int64,1},Array{Int64,1}}}:
 (a = 1, b = 4)
 (a = 2, b = 5)
 (a = 3, b = 6)
 (a = 1, b = 4)
 (a = 2, b = 5)
 (a = 3, b = 6)
3 Likes