RStudio Connect updating from Database

I have a Shiny Dashboard uploaded to RStudio Connect. The dashboard data comes from a connection to a company database. It was my understanding / assumption that the dashboard would update the data when it was opened in Connect however it has not updated unless I publish from RStudio. In the dashboard settings, it says that because it is an interactive document, it will update whenever it is run.
Could someone help me understand what the process is and if it is possible to have the dashboard updated upon opening it in Connect?

1 Like

I think this depends on how your Shiny app works. Even with a connection to a database, an app might load all data on deployment. In this set-up, that database query stage is only handled once, and updating or adding data requires redeploying. Based on your description of your problem, that sounds like what's happening here.

One option: If this is an interactive document, you can use RStudio Connect to schedule a regular re-running, updating your data in the process and saving older versions of the report (scheduling R Markdown documents in Connect).

Another option is to update how your shiny-app interacts with data. Shiny applications can be written to dynamically pull data from a SQL database or other API. Intro doc on this, "Shiny - Database basics - dplyr and DBI".

The shiny packpage pool might help

I think @EconomiCurtis's pointers are fantastic! I also think you may want to check out the reactivePoll function. It allows you to specify a checkFunc that is lightweight to determine if/when the data has changed. When the output of checkFunc changes, then valueFunc will get updated (and new data pulled into your application.

https://shiny.rstudio.com/reference/shiny/latest/reactivePoll.html

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