'Shiny not updating SQL value
I am using the following function in R to update values in my remote MariaDB table:
update_row <- function (table_name, column_name, id, value) {
query <- sqlInterpolate(pool,
paste0(
"UPDATE ", table_name,
" SET ", column_name, "=", "'",value,"'",
" WHERE id", " = ", id))
dbExecute(pool, query)
}
using this function outside of Shiny works fine. However, integrating this function into shiny does not work.
Here is a minimal example:
ui <- fluidPage(
actionButton("go", "Go")
)
server <- function(input, output) {
eventReactive(input$go, {
update_row("table", "first_name", "1", "Jesus")
})
}
shinyApp(ui, server)
When I run this shiny app and push the action button the sql table does not get updated. I also tried using observeEvent with the same result.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
