Automating Looker Queries

I am very new to Looker, and am considering using it to replace a very old web service. 

Part of the service has users running database queries via a web interface, for which Looker is perfect.

The other part supports web service queries that are called by various automations throughout our company to obtain information from the same database, which is then processed to determine further automated actions needed.

Does the Looker instance support remote, automated queries via some kind of web service to return query results (via xml, json, etc.) directly to a caller without having somebody there to click on a web page? I’ve looked at the API section, but can’t quite determine if that will do the trick.

Of course, those apps could get accounts on the database and do their queries directly, but I’m hoping to leverage Looker to facilitate the migration and minimize the other systems’ development.

0 3 480
3 REPLIES 3

Hey Brian!

Definitely API will do the trick. We have some sdks in several languages that use API for common tasks: https://docs.looker.com/reference/api-and-integration/api-sdk

For example, if you have a query that you want to run in Looker, and you use python sdk, it will handle the authentication and you can use “Run Query” part here https://github.com/looker-open-source/sdk-codegen/blob/main/python/looker_sdk/sdk/api40/methods.py to get the response - and then use it for further processing

Has anyone generated a Java SDK? That’s most likely what most of our automated services will need.

I looked at how to create a custom SDK, and seems quite complicated to me.

We have a Kotlin SDK you can generate from the codegen repo. It is not one of our supported SDKs, but here are the general steps I use. 

Clone this git repo.

Run yarn install.

Then run yarn build.

Make sure Kotlin is installed by running:
sudo snap install --classic kotlin

Finally, run yarn gen kotlin.

Success!