Creating a query programmatically

I have a Data Connection. I could create a Data Query “foo” in the UI and then call grok.data.callQuery(“foo”, …). Say I want instead to create a temporary Data Query in my JS app using the existing Data Connection, call this query, get a DataFrame from it, and forget about the query. I guess it has to do with DG.DataQuery. Would you help me with a snippet?

Right now it’s not possible in JS.
You need to manually create a DataQuery and save it using grok.dapi.queries.save() method.
Then, you cal run it with ad-hoc: true parameter, so it won’t log query call.

I’ll make a task to implement and ability to construct ad-hoc query in JS and run it as you described.