6

I am aware of this resource. But it does not spell out what parameters .u.upd takes and how to check if it worked.

This statement executes without error, although it does not seem to do anything:

.u.upd[`t;(`$"abc";1;2;3)]

If I define the table beforehand, e.g.

t:([] name:"aaa";a:1;b:2;c:3)

then the above .u.upd still runs without error, and does not change t.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user443854
  • 7,096
  • 13
  • 48
  • 63

2 Answers2

5

.u.upd has the same function signature as insert (see http://code.kx.com/q/ref/qsql/#insert) in prefix form. In the most simplest case, .u.upd may get defined as insert.

so: .u.upd[`table;<records>]

For example:

q).u.upd:insert
q)show tbl:([] a:`x`y;b:10 20)
   a b
   ----
   x 10
   y 20
q).u.upd[`tbl;(`z;30)]
   ,2
q)show tbl
   a b
   ----
   x 10
   y 20
   z 30
q).u.upd[`tbl;(`a`b`c;1 2 3)]
   3 4 5
q)show tbl
   a b
   ----
   x 10
   y 20
   z 30
   a 1
   b 2
   c 3
Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
MdSalih
  • 1,978
  • 10
  • 16
3

Documentation including the event sequence, connection diagram etc. for tickerplants can be found here: http://www.timestored.com/kdb-guides/kdb-tick-data-store

enter image description here

.u.upd[tableName; tableData] accepts two arguments, for inserting data to a named table. This function will normally be called from a feedhandler. It takes the tableData, adds a time column if one is present, inserts it into the in-memory table, appends to the log file and finally increases the log file counter.

John at TimeStored
  • 1,305
  • 7
  • 9