get_sql: Get underlying sql for a Looker query.

Description Usage Arguments Details Value Examples

Description

This function assumes that you have set the environment variables LOOKER_URL, LOOKER_ID, and LOOKER_SECRET.

Usage

1
get_sql(model, view, fields, filters = list(), limit = 1000)

Arguments

model

character. The model parameter of the query.

view

character. The view parameter of the query.

fields

character. The fields parameter of the query.

filters

list or character. Either a named list, or a character vector using colons as separators each vector describing one of the filters of the query.

limit

numeric. The limit parameter of the query.

Details

The function will not allow the query to proceed unless you specify a model, a view, and at least one field.

Value

a simple string containing the SQL query.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
  query <- get_sql(model = "thelook",
                view = "orders",
                fields = c("orders.count", "orders.created_month")
                filters = list("orders.created_month" = "90 days", "orders.status" = "complete")
  )

  query <- get_sql(model = "thelook",
                view = "orders",
                fields = c("orders.count", "orders.created_month")
                filters = c("orders.created_month: 90 days", "orders.status: complete")
  )

## End(Not run)

avantcredit/looker3 documentation built on May 11, 2019, 4:06 p.m.