I have a database that I am reading a reactive table from it. I want the table to update its values when the data changes in the database. I am currently using this but am not satisfied with it. Kindly assist
restock <- reactive({
invalidateLater(2000,session)
db <- dbConnect(SQLite(), dbname="db.sqlite")
data1 <- dbReadTable(db, "restock_df")
data2 <- data1 %>% select(-row_id, -brand, -location , -comment,-date)%>%
group_by( product) %>%
summarise_all(sum)
data2
})
I have decided to make it reactive to inputs that do the CRUD operations
restock <- reactive({
### make reactive to inputs example the submit input
input$submit
data1 <- dbReadTable(db, "restock_df")
data2 <- data1 %>% select(-row_id, -brand, -location , -comment,-date)%>%
group_by( product) %>%
summarise_all(sum)
data2
})