Search code examples
kdb+

KDB meta of all tables with table name displayed


Is there a way to display meta of all tables in tables[] along with table name? I tried the following which displays all columns without table names.

raze meta each tables[]
c t f a
time t s
sym s g
col1 s
col2 p
col3 s
col4 b

Is there a way to have table name displayed along with the meta of all?

Thanks


Solution

    • You need to unkey before you raze using 0! as meta returns keyed tables
    • Add the table name in as a column update tab:x from
    • xcols allows you to push the tab column to the left
    q)t:([] a:1 2 3)
    q)t1:([]b:4 5 6.0)
    q)t2:([] c:``b`;c:("tf";"jj";"kk"))
    
    q)`tab xcols raze {0!update tab:x from meta x}each tables[]
    tab c  t f a
    ------------
    t   a  j
    t1  b  f
    t2  c  s
    t2  c1 C