cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning QDictionary in qpython to kdb

powerpeanuts
New Contributor III

This might not be directly relevant to kdb/q, as qpython is a third-party library. Let's say we have a QDictionary qdict in python. How can we send this dictionary to kdb?

https://qpython.readthedocs.io/en/latest/type-conversion.html#dictionaries

pseudo code:

 

qdict = QDictionary(qlist(numpy.array([1, 2], dtype=numpy.int64), qtype=QLONG_LIST),
                    qlist(numpy.array(['abc', 'cdefgh']), qtype = QSYMBOL_LIST))
with qconnection.QConnection(host = 'localhost', port = 5000) as q:
q('mydict:', qdict)

 

1 ACCEPTED SOLUTION

rocuinneagain
Contributor III
Contributor III

You want to store it in a global variable in q?

Then you can use a lambda and :: or set 

 

q('{`mydict set x}', qdict)

q('{mydict::x}', qdict)

 

 

View solution in original post

2 REPLIES 2

rocuinneagain
Contributor III
Contributor III

You want to store it in a global variable in q?

Then you can use a lambda and :: or set 

 

q('{`mydict set x}', qdict)

q('{mydict::x}', qdict)

 

 

Perfect, thanks!