Closed co-dh closed 6 years ago
cc: @StephenTaylor-Kx
Care to make that a PR?
I guess this should be a PR for KxSystems/docs.
@co-dh - your example looks good and I think is worthwhile to be included in the docs together with some prose. Note that in Python 3, instead of h(q('"1 + 1"'))
, you can simply do h(b'1+1')
. I would also include a more practical example of inserting data to a table on the server:
>>> h = q.hopen('::9900')
>>> h(b'trades:flip`size`price!()')
k('::')
>>> h(('.q.upsert', 'trades', (10, 50.3)))
k('`trades')
>>> h(('.q.upsert', 'trades', (20, 55.3)))
k('`trades')
>>> h('trades').show()
size price
----------
10 50.3
20 55.3
Looking forward to seeing the PR.
I'm looking forward to you both adding documentation. Seems a tough one.
Closing. Documentation issues should be reported to KxSystems/docs.
Just curious if this had been raised to KxSystems/docs? Can't find any documentation on it.
I am currently seeing that any non-numeric values are all getting passed as symbols across the handle, is the expectation that the function should handle the types when passing parameters? example function below.
h(('runFunc',('tradeData'),('2018.07.26,10055285,ORD_ID')))
@dirwin15 If you pass argument as Python string, it will be casted into symbol, which is expected. If you would like to pass arguments with a different type, you should either pass their Python equivalent (i.e for date — use datetime.date
, for int pass int.
>>> from datetime import date
>>> from pyq import kp, K
>>> K.date(date(2018, 10, 31))
k('2018.10.31')
>>> K.string("string")
k('"string"')
>>> kp("string")
k('"string"')
>>> K.int(123)
k('123i')
>>> K.float(3.14159)
k('3.14159')
So you might want to modify your call in order to receive expected types:
h(('runFunc',('tradeData'),(K.date(date(2018, 7, 26)), K.long(10055285), K.string('ORD_ID'))))
Documentation is available at code.kx.com
Please add some document on how to use ipc. I figured it out by seach hopen in the repo