KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb Insights Given error in views but not in queries

  • Given error in views but not in queries

    Posted by cperezln on September 7, 2023 at 12:00 am

    Hi there,

    I am currently working with KX Insights Enterprise and I am having a problem.

    I have the following code to display and work with some tables:

    foo: {[id; d1; d2; size; handle] 
    d_f:(`table`startTS`endTS`filter`groupBy`agg)!(`table_test; date1; date2;(("="; `sym; id); ("="; `side; "0"); ("="; `size; size)); enlist `time; enlist (`avgprice`avg`price));
    t_f: handle(`.kxi.getData; d_f; `;()!()); 
    t_f 
    } 
    h: hopen`$":some_dir:4000";
    res: foo[id; date1; date2; ;h] each 500000 1000000 10000000 res 
    hclose h;

    so, this code will call the foo function which receives an id, two dates and a handle, in order to query a table from a database. I am trying to call this method several times using an iterator, for different sizes.  This code is actually working when I use a query, and I run the scratchpad, giving me the actual tables I am asking for. Instead, when I use it as a data source, I got the rank error, and I cannot figure out what it is actually happening.

     

    Some advice?

     

    Kind Regards!

     

    cperezln replied 3 months, 2 weeks ago 2 Members · 3 Replies
  • 3 Replies
  • megan_mcp

    Administrator
    September 11, 2023 at 12:00 am

    Hi  !

    This isn’t a valid query for the qsql endpoint. The difference between Query and View is that a view would be calling '/servicegateway/qe/qsql' whereas the query goes via Scratchpad.

    If you have any more questions feel free to reach out.

    Thanks,

    Megan

  • cperezln

    Member
    September 15, 2023 at 12:00 am

    Why is not a valid query for qsql endpoint?

     

    Thanks,

    Cristian

  • megan_mcp

    Administrator
    September 20, 2023 at 12:00 am

     

    It looks like you are trying to send an IPC query from the database to the database which is not supported. It is unclear where you are running it.

    If that is a data source in a dashboard, that code is getting shipped to a DAP and then it is trying to query itself, which is not supported.
    Megan

Log in to reply.