Refreshing SQL database from Shiny


I am trying to use Shiny to add some patients data to a MySQL Workbech database. The first step is to check if the patient is already registered in the database and, if not, adding him/her to it. After that, I need to upload test results related to those patients.

All the information is in a .xlsx file so the shiny app reads it and transfers the data to the database.

The first part is working ok but I have some problems uploading the results if the patient is a new one. I realized that the information in the database isn't updated until I close the app and manually refresh the tables in the database. Because of this, the new patient info can't be found by the app so it's impossible to upload results related to it.

Any idea to solve this? I don't know if it's something that can be fixed from Shiny or if I need to change something in MySQL Workbench.

Sorry if the explanation is not very clear.

Many thanks!

1 Like

can you show us the syntax of how you are writing to the database? In particular, what type of connection and what the syntax is you are using to write. Are you then closing the connection? Possibly you need to commit after the write?

It's hard to know without seeing your actual R syntax.

1 Like

I don't know if I understand correctly, but maybe you are not refreshing the data fetched by your app from the database, maybe you want to check reactivePoll() function, for tracking changes on your database.

1 Like

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