reactivity based on database changes

I am currently building a shiny app and where all the data comes from a mySQL database. If it was only queries it would be fine, but user are also able to make new entries into the database based on forms they fill out and submit.

Now i have the following problem: The content is not changing when the user is committing any changes to the database (e.g. INSERT), the database does not tell shiny that a change has been made. The only way I found to circumvent this is via putting the original query inside a reactive environment together with invalidateLater(). This seems to be a rather costly circumvention if you query a whole table every second or so. Is there any better way to do this? E.g. a change flag that the pool can query frequently and build reactivity based on that.

Best

Have you tried with reactivePoll()?

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

3 Likes

thank you for the hint, together with this thread one can come up with a cost efficient solution: https://stackoverflow.com/questions/307438/how-can-i-tell-when-a-mysql-table-was-last-updated

1 Like

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