Hi all, I noticed that the only available functions for SQL Runner via API are “Get SQL Runner Query” and “Create SQL Runner Query”. Is it thus not possible to run a SQL Runner query and get its results?
This is not possible at the moment. You can create a SQL runner query task, but there is no API to fetch the results of that query.
We have a case opened with Engineering in order to add this in upcoming releases.
Please let us know in case you have any further question.
That’d be great, thanks Diego!
Was there any further action to this?
Hey @awmatheson, we don’t have a release date for this feature but it has had a good bit of interest. I’ll let the engineering team know you’re also looking to have this functionality as well.
My workaround here is that from SQL runner I click “Explore” and then I get slug id from link and run it from API using query_for_slug and then run_query
Once a SQL runner query task has been made, is there any API link (maybe using the slug?) to get the results from that query?
@Joanna_Kochel Which Looker API were you using and what parameter did you put into run_query? I tried getting the slug and then run_query with a python API (https://github.com/llooker/python_sdk) and slug ID as well as the SqlQuery object (https://github.com/llooker/python_sdk/blob/master/docs/SqlQuery.md) to no avail =’(
Hey grace_gee & marcoppenheimer,
Thanks for voicing your feedback and questions on this topic! This is something that has a lot of interest which our engineers are aware of and I have let them know your feedback on this!
Joanna’s approach is a great way to go in the meantime, what I would suggest and Joanna can correct me if she has an easier approach is the following:
- Generate your query using SQL runner
- Select the cog button beside ‘Run’ and choose ‘Explore’
- This will open up your query/results in an explore page
- Copy the string after the url param ‘qid=’ in your URL
- Open up the Looker API and click on ’ [Query : Run and Manage Queries]’
- Open up [SDK][query_for_slug(slug)] and paste in the copied url param string where it asks for slug. This will generate a response body and the first line should be an ID like this example:
( "id": 120164,)
- Open up [SDK][run_query(query_id, result_format)] and add the ID in
query_idparam and then in the
result_formatyou can add csv.
Here are screenshots of some dummy data in my SQL Runner explore and then the same data in the API after following the above steps!
Hope this helps guys!