使用 qpython 和 python3.6 查询 kdb

query kdb using qpython and python3.6

我正在使用 qpython 与我的 kdb(tickdb) 服务器通信。 我有这个简单的脚本


q = qconnection.QConnection(host = 'host', port = 789)
q.open()
print(q)
print('IPC version: %s. Is connected: %s' % (q.protocol_version, q.is_connected()))
data = q('{`int$ til x}', 10)

以这个异常结束 qpython.qtype.QException: b'not an api call'

QException 是一个 q 错误,而不是 python 或 qPython。正如 Sean 所建议的那样,您似乎没有连接到 vanilla kdb 设置,并且 q 进程中必须有逻辑来阻止自由格式的用户查询。

我可以通过更新同步消息处理程序来强制错误.z.pg

/ basic example if a symbol isn't received by the q process will return an error from the q process
q).z.pg:{if[not -11h~type x;'"not an api call"];value x}

python test2.py

:localhost:789
IPC version: 3. Is connected: True
Traceback (most recent call last):
....................................
    raise QException(self._read_symbol())
qpython.qtype.QException: b'not an api call'