Dhanuushri
Dhanuushri

Reputation: 33

KX refinery connection and get data from tables

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

Upvotes: 0

Views: 181

Answers (1)

SeanHehir
SeanHehir

Reputation: 1593

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.

Upvotes: 2

Related Questions