0

In examples provided by https://code.kx.com/q4m3/11_IO/#1113-serializing-and-deserializing-q-entities

I found that I can use \l to load back a table, but cannot load back a list. Am I missing something, or does \l only support loading back data of certain types?

table

`:/tmp/data/t set ([] c1:`a`b`c; c2:10 20 30)
get `:/tmp/data/t
\l /tmp/data/t  / OK

list

`:/tmp/data/L set 10 20 30
get `:/tmp/data/L
\l /tmp/data/L  / 'type
kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80

2 Answers2

2

You can load the list into memory by loading the directory in which it lies

q)`:/tmp/data/L set 10 20 30
`:/tmp/data/L
q)\l /tmp/data/
q)L
10 20 30
Cathal O'Neill
  • 2,522
  • 1
  • 6
  • 17
1

I believe this may be a genuine bug, from the documentation \l should load in any q serialized file. However I would advise against using \l to load in files, for the following reasons

  • When loading enumerated partition table, it's very easy to not load the associated sym file and then have no symbols (see the example below)
  • Files are loaded in with the name of the file, which can overwrite objects, it's much better to use get
q)t:.Q.en[`:tmp;([] c1:`a`b`c; c2:10 20 30)]
q)`:/tmp/data3/t/ set t
`:/tmp/data3/t/
q)\\

C:\Users\cbiggs\Documents>q
KDB+ 4.0 2020.05.04 Copyright (C) 1993-2020 Kx Systems
w64/ 8(16)core 16227MB cbiggs lptp633 192.168.56.1 EXPIRE 2021.05.18 cbiggs@kx.com KOD #4170988

q)\l /tmp/data3/t
`t
q)t
c1 c2
-----
0  10
1  20
2  30
Callum Biggs
  • 1,539
  • 5
  • 13