Skip to content

load, rload

Load binary data from a file or directory


Load binary data from a file

Syntax: load x, load[x]

Loads binary data from the filesystem and returns the name of the table loaded.

q)t:([]x: 1 2 3; y: 10 20 30)
q)save`t             / save to a binary file (same as `:t set t)
q)delete t from `.   / delete t
q)t                  / not found

q)load`t             / load from a binary file (same as t:get `:t)
x y
1 10
2 20
3 30

If x is a directory, a dictionary of that name is created and all data files are loaded into that dictionary, keyed by file name.

q)\l sp.q
q)\mkdir -p cb
q)`:cb/p set p
q)`:cb/s set s
q)`:cb/sp set sp
q)load `cb
q)key cb
q)cb `s
s | name  status city
--| -------------------
s1| smith 20     london
s2| jones 10     paris
s3| blake 30     paris
s4| clark 20     london
s5| adams 30     athens


Load a splayed table from a directory

Syntax: rload x, rload[x]

Where x is the table name as a symbol, the table is read from a directory of the same name. rload is the converse of rsave.

The usual, and more general, way of doing this is to use get, which allows a table to be defined with a different name than the source directory.

q)\l sp.q
q)rsave `sp           / save splayed table
q)delete sp from `.
q)rload `sp           / load splayed table
s  p  qty
s1 p1 300
s1 p2 200
s1 p3 400
q)sp:get `:sp/        / equivalent to rload `sp

save, rsave
.Q.dsftg (load process save), .Q.fps (streaming algorithm), .Q.fs (streaming algorithm), .Q.fsn (streaming algorithm), .Q.v (get splayed table)
File system