Updating database from MySQL in shiny app

Hi, it's my first time here. I am having troubles to refresh the database in the shiny App. I connected MySQL to R, but not sure how to get my queries are refrehing every certain seconds.

I have some renderplots which work with the queries. I deployed the shiyn app to AWS server, but the data it's static. Can someone help me please? I read something about autoInvalidate() and reactivePoll() but not found how to apply to the queries.

Thank you so much in advance

db <- dbConnect(
  dbname = "database",
  host = "...",
  username = "user",
  password = "password"



autoInvalidate <- reactiveTimer(10000,session = NULL)

data_query <- reactive({
dbGetQuery(db, "select * from database where date = curdate()")
colnames(data_query()) <- c("table","name","currency", "status", "time")
data_query_dt <- as.data.table(data_query_order())


data_query_2 <- reactive({
  dbGetQuery(db, "select * from database2  where DATE(last_update)=curdate()")
colnames(data_query_2()) <- c("name2","id", "id1")
data_query_2_dt <- as.data.table(data_query_2())


I would not use a reactiveTimer() but rather invalidateLater. Have a look at this example:


This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.