英文:
KX refinery connection and get data from tables
问题
我需要连接到Kx炼油厂并获取表格数据。
表格名称:stock
我尝试使用:
\c `:host:port //输出结果为25 80i
getTicks[`stock;startDate;endDate] //不起作用,显示在getTicks附近的错误
英文:
I need to connect to Kx refinery and get the table data .
Table Name : stock
I tried to use:
\c `:host:port //gives output as 25 80i
getTicks[`stock;startDate;endDate] //does not work ,shows error near getTicks
答案1
得分: 2
这是你要翻译的内容:
在你的示例中有几个问题,我认为可以通过阅读IPC文档来解决:https://code.kx.com/q/basics/ipc/。
首先,\c
用于设置虚拟控制台显示的大小限制。你看到的 25 80
只是控制台的大小(高度和宽度)。
所以假设这是一个标准的 q 进程,你想要连接到它(例如 rdb、hdb、gateway),那么你应该能够通过以下方式打开端口:
q)h:hopen`:host:port
请注意,这假定不需要用户名或密码,如果需要的话,应该是
q)h:hopen`:host:port:username:password
然后,如果 getTicks
是远程进程上定义的函数,你可以运行类似以下的代码来执行一个同步(阻塞)请求,以调用你的函数并传递所需的参数:
q)res:h(`getTicks;`stock;startDate;endDate)
英文:
There's several issues in your example that I think could be solved by reading the IPC docs: https://code.kx.com/q/basics/ipc/.
First and foremost \c
is used for setting a limit on the size of the virtual console display. The 25 80
you see is just the size of the console (height and width)
So assuming this is a standard q process you're trying to connect to (e.g rdb, hdb, gateway) then you should just be able to open the port via:
q)h:hopen`:host:port
Note that this assumes there's no username or password required, in which case it would be
q)h:hopen`:host:port:username:password
Then, if getTicks is a function defined on the remote process you can run something like:
q)res:h(`getTicks;`stock;startDate;endDate)
to perform a synchronous (blocking) request to the server to call your function with your required arguments.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论