cancel
Showing results for 
Search instead for 
Did you mean: 

Load schema dynamically from ticker plant

rtrader
New Contributor
Is there any easy way to dynamically load the schema from a tickerplant by a client? I thought this was done by doing the .u.sub call but appears like it doesn't. 
1 REPLY 1

pauljloughran
New Contributor
Hi,

.u.sub will only return a two item list of table name and empty schema. You need to use these to define the schema locally (that's what happens in the RDB in kdb+ tick).

Below is an example of how you might do this.

Regards,
Paul

q)/ open handle to tp
q)h:hopen `::6000:tickerplant:pass
q)/.u.sub returns list of (tablename;schema)
q)h(`.u.sub;`trade;`)
`trade
+`time`sym`price`size`stop`cond`ex!(`timestamp$();`g#`symbol$();`float$();`in..
q)/ use set to define the schema locally
q).[;();:;]. h(`.u.sub;`trade;`)
`trade
q)/ trade is now defined
q)trade
time sym price size stop cond ex
--------------------------------
q)