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(
RMySQL::MySQL(),
dbname = "database",
host = "...",
username = "user",
password = "password"
)
pool::poolClose(db)
###QUERIES
autoInvalidate <- reactiveTimer(10000,session = NULL)
data_query <- reactive({
autoInvalidate()
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({
autoInvalidate()
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())
})