looker-open-source / lookr

An R library for the Looker API (4.0)
MIT License
77 stars 29 forks source link

R SDK don't seem to have the look() method and can't find another way to run a look with a different filter #40

Open alan-krumholz opened 4 years ago

alan-krumholz commented 4 years ago

R SDK don't seem to have the look() method and can't find another way to run a look with a different filter

In Python and Ruby we ca do that using:

Python:

look = sdk.look(16)

request = create_query_request(
    query=look.query,
    filters={'track_motivations.track_id':'256'})

sdk.run_inline_query(
    'csv',
    request,
    cache=False)

Ruby

look = sdk.look(16)
output = sdk.run_inline_query(
    "png",
    {
        "model" => look.query.model,
        "view" => look.query.view,
        "fields" => look.query.fields,
        "pivots" => look.query.pivots,
        "fill_fields" => look.query.fill_fields,
        "filters" => {
            'track_motivations.track_id' => '255'},
        "sorts" => look.query.sorts,
        "limit" => look.query.limit,
        "column_limit" => look.query.column_limit,
        "total" => look.query.total,
        "row_total" => look.query.row_total,
        "subtotals" => look.query.subtotals,
        "dynamic_fields" => look.query.dynamic_fields,
        "query_timezone" => look.query.query_timezone,
        "vis_confif" => look.query.vis_config
    })

but we need a way to do the same using the R SDK. Is it possible?

Thanks

scrane-amplify commented 4 years ago

This package is not maintained (see issue 38). I suggest trying over at the official Looker SDK project: https://github.com/looker-open-source/sdk-codegen

drstrangelooker commented 3 years ago

It actually isn't too hard, though there is not a wrapper to make it easy.

sdk$refresh()
data <- sdk$userSession$lookApi$look(6, config = sdk$oauthHeader)$content
data$title
[1] "Simple Look"

data$query$fields
[[1]]
[1] "user.count"

[[2]]
[1] "history.source"

[[3]]
[1] "history.completed_date"