Converting Reactive SQL Output to Data Frame R Shiny for DataQualityR package


I am trying to run checkDataQuality function on a data frame created from a reactive SQL Query in R shiny.

sqlOutput1 <- eventReactive(input$pick_tablenames,({

      sqlInput1 <- paste("select *
                         from ",input$pick_tablenames," a left join ",outputDataMart()," b on a.trade_oid=b.trade_oid where b.FEED_SRC=","'",input$pick_feedsrc,"'",
                         "and b.SRC_FILE=" ,"'",input$pick_srcfile,"'"," and b.DT= ","'",input$pick_dt,"'","limit 50",

      dbGetQuery(con, sqlInput1)

    sample1 <- reactive({
      sample1 = data.frame(sqlOutput1)
num.file <- paste(tempdir(), "/dqr_num.csv", sep= "")
cat.file <- paste(tempdir(), "/dqr_cat.csv", sep= "")
checkDataQuality(data= sample1, out.file.num= num.file, cat.file)

I am facing issues trying to create the dataframe sample1. Could you please help me with this?


Hi, not sure if you've read this article yet:, it covers how to create Shiny apps that have a database back end. This section covers your specific question:


Thanks for your response.
The issue I am facing is with large dataset the query hangs.
Another alternative is to use ETLUtils and ff package.

readDataForFreq<- reactive(
query<- paste("select *
from ",input$pick_tablenames," a left join ",outputMart()," b on a.oid=b.oid where b.FEED=","'",input$pick_feed,"'",
"and b.SRC=" ,"'",input$pick_src,"'"," and b.DT= ","'",input$pick_dt,"'","limit 50",
y<- read.jdbc.ffdf(query,dbConnect.args = list(drv = oc_drv, url = "jdbc:netezza:/" ,
dbname='', user ='', password ='',first.rows = 1000,next.rows = 1000))

  return (y)


The error I am getting with this is:-

Warning: Error in ff: vmode 'character' not implemented