Code Monkey home page Code Monkey logo

lookr's Introduction

LookR

This is an SDK for using the Looker API with the R programming language. Our priority is to add support for the endpoints that are most useful to data scientists and analysts working in R (the ones that get data from Looker) but eventually the goal is to add support for every endpoint in the Looker API.

For more information about the Looker API's capabilities and for details about what each endpoint does, see the Looker API reference documentation.

Important!

LookR used to be based on rJava, but this caused problems with reliability and many users struggled to get it to work. To fix this, we've rewritten a new SDK in native R. The versions have been reset as well.

All of the old code is available on the old-lookr branch, so if you want to continue using it, you an install from that branch by setting ref to old-lookr:

devtools::install_github("looker/lookr", ref = "old-lookr")

Install

Use devtools to install from this repository:

devtools::install_github("looker/lookr")
library(lookr)

Configure

First, make sure that you have your API credentials and the URL to your Looker host in a file called looker.ini. LookR uses the information in this file to authenticate. See below for a sample of what looker.ini should look like:

looker-sample.ini

[Looker]
# API version is required
api_version=3.0
# Base URL for API. Do not include /api/* in the url
base_url=https://<your-looker-endpoint>:19999
# API 3 client id
client_id=your_API3_client_id
# API 3 client secret
client_secret=your_API3_client_secret
# Optional embed secret for SSO embedding
embed_secret=your_embed_SSO_secret
# Optional user_id to impersonate
user_id=
# Set to false if testing locally against self-signed certs. Otherwise leave True
verify_ssl=True

Make sure that this file is not checked into version control.

Connect

All of the endpoints are accessed from methods contained in an instance of the LookerSDK class, which is implemented in R6. To start using LookR, create an instance of that class:

sdk <- LookerSDK$new(configFile = "looker.ini")

If you're using a version of RStudio that includes the Connections Pane, you can also use that to create a new connection to Looker.

Whether you use the Connection Pane to create the connection or not, you will be able to browse your projects, models, and explores in the Connections Pane as long as your API user has access to them.

Query

You can use LookR to fetch the results of a saved Look by calling runLook:

data <- sdk$runLook(lookId = 1337)

You can also use a new query by calling runInlineQuery. model, view, and fields are mandatory arguments:

data <- sdk$runInlineQuery(model = "model_name",
                           view = "my_awesome_explore",
                           fields = c("id", "count"))

and you can optionally supply filters, sorts, limit, and queryTimezone:

data <- sdk$runInlineQuery(model = "model_name",
                           view = "my_awesome_explore",
                           fields = c("id", "count"),
                           filters = list("field_name" = "filter_expression",
                                          "another_field" = "filter_expression"),
                           limit = 500,
                           queryTimezone = "America/Los_Angeles")

lookr's People

Contributors

githoov avatar thekenz avatar dmarcotte avatar maxcorbin avatar tynesjo avatar marrlooker avatar nigel-brown avatar etheleon avatar

Watchers

James Cloos avatar  avatar

Forkers

asobacloud

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.