Inserting parameter into Presto Query running into R

Hello my dear friends , coaches
i have a Query that running at Presto through R
All what i need is that i need to put parameters in the SQL Query.
the code as follows

install.packages("RODBC",dependencies = TRUE)
install.packages("sqldf",dependencies = TRUE)
install.packages("plyr",dependencies = TRUE)
install.packages("reshape",dependencies = TRUE)
install.packages("DBI",dependencies = TRUE)
install.packages("dplyr")
install.packages("RPresto",dependencies = TRUE)
install.packages("utils",dependencies = TRUE)

library(RODBC)
library(sqldf)
library(plyr)
library(reshape)
library(DBI)
library(dplyr)
library(RPresto)
library(utils)

con = dbConnect(   RPresto::Presto(),  
                   host = '.........',
                   port = .........,  
                   user = "........",
                   schema = '........',  
                   catalog = '......' )

Query<-paste0("/*Hady.Shaaban*/
select * from customers where date between cast('2018-10-01' as timestamp) and cast('2018-10-15' as timestamp) 
  ")


QueryOutput<- dbGetQuery(conn=con,statement=Query)
View(QueryOutput)

i need your usual support to make this Query dynamic to be used for shinyApp
Thanks :slight_smile:

Hi,

You are looking for additional arguments from params. See the doc
here and the exemple on the same page for the usage of the ?.

Regards,

jm

2 Likes