File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,30 @@ When `dir` is a symbol handle, the function
538538
539539 !!! warning "Locking ensures two processes do not write to the sym file at the same time"
540540
541+ The following example uses ` .Q.en ` to enumerate to both the in-memory and disk ` sym ` domain, while
542+ saving the table output using [ ` set ` ] ( get.md#set ) :
543+ ``` q
544+ q)t1:([]col1:`a`b`c;col2:1 2 3)
545+ q)`:/tmp/db/t1/ set .Q.en[`:/tmp/db;t1];
546+ q)sym / contents of in-memory sym populated from symbols in table
547+ `a`b`c
548+ q)get `:/tmp/db/sym / on-disk sym same as in-memory sym
549+ `a`b`c
550+ q)get `:/tmp/db/t1/col1 / col1 enumerated against sym domain
551+ `sym$`a`b`c
552+ ```
553+ Providing a new or updated table against an existing `sym` domain will read the existing on-disk sym domain before updating.
554+ Both the in-memory and on-disk version are updated to reflect the new state. Continuing with the same example shows the
555+ existing `sym` domain being altered:
556+ ```q
557+ q)t2:([]col1:`a`d`e;col2:1 2 3)
558+ q)`:/tmp/db/t2/ set .Q.en[`:/tmp/db;t2]; / enumerate additional table against existing sym domain
559+ q)sym / in-memory sym now contains additional symbols
560+ `a`b`c`d`e
561+ q)get `:/tmp/db/sym / on-disk sym same as in-memory sym
562+ `a`b`c`d`e
563+ ```
564+
541565When `dir` is a generic null (since 4.1 2025.01.17), the function
542566
543567- does not read/write/lock the `sym` file
You can’t perform that action at this time.
0 commit comments