File system

0 console read0 0: File Text read/write chars¹ 1 stdout read1 1: File Binary read/write bytes¹ 2 stderr 2: Dynamic Load load shared object ? Enum Extend

get set read/write or memory-map a data file¹

hopen hclose open/close a file¹

hcount file size hdel delete a file or folder hsym symbol/s to file symbol/s¹

save load a table rsave rload a splayed table dsave tables

¹ Has application beyond the file system.

Kdb+ communicates with the system, file system, and with other processes through connection handles and the operators File Text, File Binary, Dynamic Load, and Enum Extend. Keywords cover important use cases.

Setting and getting

Keywords set and get write and read the values of files in the filesystem. (Also variables in memory.)

q)`:data/foo`:data/bar set'(42;"thin white duke")
`:data/foo`:data/bar
q)get `:data/foo
42
q)get `:data/bar
"thin white duke"

Writing and reading

  text bytes
write hopen hclose
write with handle
hopen hclose
write with handle
0: Save Text 1: Save Binary
read read0 read1
0: Load CSV
0: Load Fixed
1: Read Binary

Writing with handles

File Text operator

Operator form Prepare Text represents a table as strings; Key-Value Pairs interprets key-value pairs.

Tables

Kdb+ uses files and directories to represent database tables. Partitioning a table divides its rows across multiple directories. Splaying a table stores each column as a separate file.

Relative filepaths

Relative filepaths are sought in the following locations, in order.

  1. current directory
  2. QHOME
  3. QLIC