Skip to content

Commit 59df340

Browse files
authored
Merge pull request #263 from sshanks-kx/symwp
fix examples, add links to symfiles white paper
2 parents e71bc49 + c752ce4 commit 59df340

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/wp/symfiles.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ within the `.Q` namespace that will do the enumeration for us: `.Q.en` and
130130

131131
### `.Q.en`
132132

133-
`.Q.en` will enumerate to the sym domain by default. The arguments for
133+
[`.Q.en`](../ref/dotq.md#en-enumerate-varchar-cols) will enumerate to the sym domain by default. The arguments for
134134
`.Q.en` are the directory path that the sym file will be stored in and the
135135
table itself.
136136

@@ -141,7 +141,7 @@ variable in memory are created.
141141
q)t:([]col1:`AAPL`IBM`GE`GOOG;col2:4?100.;col3:(string 4?`2))
142142
q)`:db/t/ set .Q.en[`:db] t
143143
`:db/t/
144-
q)system"ls ~/db"
144+
q)system"ls db"
145145
"sym"
146146
,"t"
147147
```
@@ -181,7 +181,7 @@ Modifying the example in `.Q.en`:
181181
```q
182182
q)t:([]col1:`AAPL`IBM`GE`GOOG;col2:4?100.;col3:(string 4?`2))
183183
//Splay table, rsync sym to backup dir, output same as .Q.en
184-
q)qenBackup:{[backupdir]`:db/t/ set .Q.en[`:db;t];systemrsync db/sym ,backupdir;(),`t}
184+
q)qenBackup:{[backupdir]`:db/t/ set .Q.en[`:db;t];system"rsync db/sym ",backupdir;(),`t}
185185
// Backup to a tmp dir for example
186186
q)qenBackup”/tmp/bkup/”
187187
,`t
@@ -197,7 +197,7 @@ q)get`:/tmp/bkup/sym
197197
Updating the table and splaying again:
198198

199199
```q
200-
q)`t upsert `col1`col2`col3!(`FB;23.1;”xq”)
200+
q)`t upsert `col1`col2`col3!(`FB;23.1;"xq")
201201
q)qenBackup”/tmp/bkup/”
202202
,`t
203203
```
@@ -212,13 +212,13 @@ q)get`:/tmp/bkup/sym
212212

213213
## `.Q.ens`
214214

215-
`.Q.ens` allows enumeration against a domain other than sym. It takes the
215+
[`.Q.ens`](../ref/dotq.md#ens-enumerate-against-domain) allows enumeration against a domain other than sym. It takes the
216216
same arguments as `.Q.en` as well as the name of the domain to enumerate
217217
to, i.e. `.Q.ens[dir;table;enum]`.
218218

219219
```q
220220
q)`:db/t/ set .Q.ens[`:db;t;`symt]
221-
q)system"ls ~/db"
221+
q)system"ls db"
222222
"symt"
223223
,"t"
224224
q)get `:db/symt
@@ -232,8 +232,8 @@ Depending on the system setup, it could be beneficial to enumerate data
232232
against multiple sym files within the one process, i.e. within one
233233
database there could be two tables, each with their own sym files.
234234

235-
This functionality is provided using the aforementioned `.Q.ens` and
236-
`.Q.dpfts`. `.Q.dpfts` functions the same as `.Q.dpft`, except we can specify
235+
This functionality is provided using the aforementioned [`.Q.ens`](../ref/dotq.md#ens-enumerate-against-domain) and
236+
[`.Q.dpfts`](../ref/dotq.md#dpfts-save-table-with-symtable). `.Q.dpfts` functions the same as [`.Q.dpft`](../ref/dotq.md#dpft-save-table), except we can specify
237237
the domain we want to enumerate to.
238238

239239
```q
@@ -331,7 +331,7 @@ q)count get`:db1/sym
331331
### Updating data and enumerations on disk
332332

333333
When adding a column of type symbol to a database we must enumerate this
334-
column to prevent a type error when writing to disk. The `dbmaint.q`
334+
column to prevent a type error when writing to disk. The [`dbmaint.q`](https://github.com/KxSystems/kdb/tree/master/utils)
335335
script makes this very easy for developers, as it already has predefined
336336
functions that consider the type of the column being added.
337337

@@ -372,7 +372,7 @@ sym file, you will not be able to write to the sym file. A _no append
372372
to zipped enums_ error is displayed if this occurs.
373373

374374
```q
375-
q)-19!(`:db/sym;`:db/sym;17;2;6)
375+
q)set[(`:db/sym;17;2;6);`:db/sym]
376376
`:db/sym
377377
q)t:([]col1:`FB`MSFT`AMZN`WFC;col2:4?100.;col3:(string 4?`2))
378378
q)get `:db/sym
@@ -428,7 +428,7 @@ vectors and take 2.5 times less storage (16 per instead of 40 per).
428428

429429
### Encoding/decoding
430430

431-
The functions `.Q.j10` and `.Q.x10` (encode/decode binhex) and `.Q.j12` and `.Q.x12`
431+
The functions [`.Q.j10`](../ref/dotq.md#j10-encode-binhex) and [`.Q.x10`](../ref/dotq.md#x10-decode-binhex) (encode/decode binhex) and [`.Q.j12`](../ref/dotq.md#j12-encode-base-36) and [`.Q.x12`](../ref/dotq.md#x12-decode-base-36)
432432
(encode/decode base64) return a string encoded or decoded against
433433
restricted alphabets. The main use of these functions is to encode long
434434
alphanumeric identifiers (CUSIP, ORDERID, etc.) so they can be quickly

0 commit comments

Comments
 (0)