publish data to kdb uisng qpython

https://learninghub.kx.com/forums/topic/publish-data-to-kdb-uisng-qpython

  1. how to push data to KDB using qpython?

  2. is there any script to push data to HDB? assume I have lots of dated trade data, how can I push data to kdb by setting trade date as the data of HDB.

 

thanks

  1. Doing this via qpython is no different from those via other interfaces (including q itself): you open a connection (e.g. to tickerplant, assuming a tp+rdb+hdb setup) and call a function that will get your data persisted (e.g. .u.upd[`trade; data]).

 

  1. Generally speaking, backpopulating historical data in a right way isn’t straightforward: it could be done as simple as splaying data using set, one for each partition (date), if you have complete data to write; if you’ve got partial data to write (e.g. trades for a new instrument type), you may have to re-sort the combined data and re-apply attributes wherever needed. The q language itself is short of higher-level APIs that handles the nuances, but I find TorQ has a good collections of those, which makes the task easier.

An example data publisher is included in documentation https://qpython.readthedocs.io/en/latest/usage-examples.html#data-publisher

 

For going straight to HDB you can write a custom .u.upd yourself to write direct

Or use a file based batch load approach to backfill.

Articles:

 

Documentation: