Examples with no database access

Roland Stevenson

2017-11-08

library(whisker)
library(condusco)

Simple Example

This example shows how to simply swap out a value using the whisker library. A common use case is two users working on a the same logic, but wanting to keep their datasets separate. A namespace can be provided for each user with {{table_prefix}}, and the swap can be set in a user-specific configuration file, thereby allowing users to separate the logic of the pipelines from the user-specific configuration variables. They can commit changes to the logic in which the commits are free of their specific variables.

run_pipeline(
  #the pipeline
  function(params){
    query <- "SELECT result FROM {{table_prefix}}_results;"
    whisker.render(query,params)
  },
  #the swap
  data.frame(
    table_prefix = c('batman', 'robin')
  )
)
## [1] "SELECT result FROM batman_results;"
## [2] "SELECT result FROM robin_results;"