faketables offers dbWriteTable() as a
convenient way to write modified data back to a data source.
In the below example, dbConnect() and
dbDisconnect() should produce a DBI Connection
Object and disconnect from that database, respectively. The database
connection and disconnection is not required to be within the observe
statement; the only requirement is that the connection passed to
dbWriteTable be an active DBIConnection
object.
f_tab <- faketables::faketable()
ui <- shiny::fluidPage(
  shiny::actionButton('db_write', 'Write to DB')
)
server <- function(input, output, session) {
  f_tab <- faketables::faketablesServer(f_tab)
  
  shiny::observe({
    con <- dbConnect()
    faketables::dbWriteTable(con, 'table_name', f_tab)
    dbDisconnect(con)
  }) |>
    shiny::bindEvent(input$db_write)
}A more complete example using the same Favorite Pizza Places app can be found here.
