Knowledge Drop

What happened to the Clients Module in the Python looker_sdk? -- (ImportError: cannot import name 'client' from 'looker_sdk')

  • 7 July 2021
  • 0 replies
  • 96 views

Userlevel 4
Badge

Last tested: Apr 2, 2020
 

In the older version of the looker_sdk, clients was one of the modules imported to run functions like the init function.)

EG:

from looker_sdk import client, models

 

sdk = client.setup("../looker.ini")

 

With the latest versions methods31 and methods40 are used instead dependent upon the version of the API you want to use 3.1 or 4.0.

You will most likely see this error if you try to use client:
ImportError: cannot import name 'client' from 'looker_sdk'

 

4.0 API

from looker_sdk import models, methods40

sdk = looker_sdk.init40() # or init40() for v4.0 API

# and away you go

my_user = sdk.me()

print(my_user)
 

3.1 API

from looker_sdk import methods31, models

sdk = looker_sdk.init31()

# and away you go

my_user = sdk.me()

print(my_user)

 

For docs go here: https://pypi.org/project/looker-sdk/

Or
Here: https://github.com/looker-open-source/sdk-codegen/tree/master/python#basic-usage

 

 

This content is subject to limited support.                

 

 


0 replies

Be the first to reply!

Reply