Is there a way to limit the number of rows in the output from IPC query

I want to find a way to crop/limit the number of rows in the output when querying my IPC connection using a namespace function.

Using pykx, I am calling result = connection(*params) with example usage connection(‘getTrades’, np.datetime64(‘2025-07-04’), ‘APPL’) where getTrades is a function and the date and sym are parameters.

I want to impose a limit (e.g. of 1000 rows) on my q output so that conversion to a pandas df is not too slow. The functionality would be similar to calling 1000 sublist getTrades[np.datetime64(‘2025-07-04’); ‘APPL’].

Is there a way to do this?

Thanks

You can wrap the function call in a lambda and use sublist to limit the rows:

connection('{1000 sublist getTrades[x;y]}', np.datetime64(‘2025-07-04’), 'APPL')

If the server does not allow you to make that custom call then you may be forced to pull the data over and truncate it locally:

connection('getTrades', np.datetime64(‘2025-07-04’), 'APPL')[0:1000]

I ended up doing something very similar.

Using dynamic function and parameter inputs which complicated slightly.

Thanks for your help