Reputation: 649
I have a standard tickerplant set up with my rdb on port 5011 and hdb on port 5012. Is there an elegant way handle queries to a union of today and historical data? I am open to a union process that maintains connections to both 5011 and 5012.
Upvotes: 2
Views: 752
Reputation: 4491
Say this function lives on the an independant q instance and you want all columns, for a day d + today for sym s... notice the column rearrangement.
mergeFun:{[d;s]
rdb:hopen`::5011;
hdb:hopen`::5012;
t:hdb({[d;s] `time`sym xcols delete date from select from table where date=d, sym=s};d;s),rdb({[s] select from table where sym=s};s);
hclose each rdb,hdb;
t
}
Upvotes: 1
Reputation: 13572
A gateway/union process would be a good solution. See examples in Michael McClintocks whitepaper: http://www.firstderivatives.com/lecture_series_pp.asp?downloadflyer=q_for_Gods_May_2013
Though the whitepaper possibly goes into more detail than you need, even the most basic setup from the paper would suffice. Essentially just queries rdb (and adds "missing" date col) and queries hdb and then combines the result.
Upvotes: 1