Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

LendingHome/looker-python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Looker SDK for Python

A Python library for Lookers's HTTP-based APIs.

Setup

You can install this package by cloning this directory and running:

$ python setup.py install

Getting Looker API keys

Within your Looker, navigate to admin, manager users, then either create a new API user or get the token and secret associated with an existing API user.

Using the Looker Python SDK

from looker.client import LookerClient

# instantiate LookerClient
client = LookerClient('<token>',
                      '<secret>',
                      'https://<company_name>.looker.com')

# create a query object
query1 = client.query(dictionary = 'thelook',                               # this is the model
                      query = 'orders',                                     # this is the base view
                      fields = ['orders.count', 'users.count'],             # dimensions and measures
                      {'users.state': '-%New%',
                       'orders.created_date': '90 days'})                   # filters as key-value pairs

# create another query object
query2 = client.query('thelook', 'orders', 
                      ['orders.count'],
                      {'users.created_date': '90 days'})
query2.add_filters({'orders.created_date': '90 days'})                      # you can add filters post query build

print query1.run()
print query2.run()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages