Question

Generating Client SDKs for the Looker API

  • 16 August 2016
  • 65 replies
  • 2094 views


Show first post

65 replies

This problem is also found when building for Java.

Userlevel 7
Badge +1

David, which problem are you referring to? This is a long thread with a bunch of examples of things people have bumped into 😄.

I’m trying to use the swagger code-gen SDK for Looker API version 3.1 built in Java. It’s unable to deserialize [‘vis_config’][‘series_types’]. The SDK expects a string for the value, but series_types is a hashmap.

Userlevel 7
Badge +1

Replied over here:


Userlevel 2

I know one of our devs was able to successfully generate a Python SDK for 3.1 recently, but it was definitely a struggle.

May I suggest : https://github.com/looker-open-source/sdk-codegen/tree/master/python it’s managed by Looker

Userlevel 2

That’s what we used – my main point was that it still took a fair amount of futzing around to get everything for the 3.1 SDK working correctly, even after starting with the official Looker tool. Nothing deeply technical, at the end of the day, but just chasing around various config issues that needed to be cleaned up, etc.


(Also, to be clear, we were using the code-gen for 3.1 very soon after it was released for any public consumption at all, and clearly labeled as “not-yet-official”. A lot of those the little issues we ran into have hopefully been addressed in the meantime.)

Userlevel 2

Aaaand…Looker 6.22 Release Notes

Thanks for releasing the updated python SDK officially.


Do you have a sample that uses environment variables rather than the python.ini. I do not see how to setup the client.


Do I simply do


sdk = client.setup()

Userlevel 7
Badge +1

I think that would be a question for @jax. After a quick test it looks like after setting env variables (make sure to name them properly like LOOKERSDK_BASE_URL, for example), you can just run it with no args and it will capture the environment variables.

Will the new SDK only work with python 3.7? I have python 3.6 and receiving the following.


Any suggestions


venv/lib/python3.6/site-packages/looker_sdk/rtl/serialize.py", line 31, in <module>
from typing import ( # type: ignore
ImportError: cannot import name 'ForwardRef'

Hi Greg,


Yes, the SDK requires python 3.7. We suggest using pyenv if you want to manage multiple python versions on your system. See https://github.com/looker-open-source/sdk-codegen/tree/master/python for more details.

Userlevel 2

A new API (3.0) is now released, but the swagger file still doesn’t appear to work without heavy modification: https://github.com/looker-open-source/sdk-examples/issues/45

Userlevel 7
Badge +1

Mirroring @john.kaster’s comment from github:



If you are on Looker 7.2 or later, I highly recommend using the API 4.0 version of the swagger file. API 4.0 was explicitly started to resolve these issues for strongly typed languages like C#, Kotlin, and Swift. I also recommend using the legacy option for the SDK Code generator project, and point the looker.ini to the API 4.0 version.




I haven’t tested the legacy option in a few merges, so feel free to log an issue in sdk-codegen if you have a problem with it and I’ll look into it.


Hi, any chance this could be done for JAVA language?

Reply