Something goes wrong with accessing SQLite Table after deployment to server

I’m doing exactly what is told in article - and the code creates SQLite table, inserts values and fetches the data in df and show it on my tables.py page. → This is good and work as expected on my local machine. As soon as, I deploy the code to Community Cloud → On click of button it created table, I can see an empty df on screen with table headers.

But every insert statement that I run succesfully → nothing gets fetched in df and the table shown on screen is always empty. Because the same code work on local machine → I can’t pin point what is going on when I deploy this code. Is it not inserting the values in table or if it is why is it not fetching the values and show it to me on page?

Can you help?

Is there a way I can check the table properties and values on the deployed folder on the community cloud server?

Thanks and Regards,
Ninad

Can anyone please help with my above question - I’m stuck.

I have used exact steps to create SQLite DB, table and insert statement. The code wroks on my local machine doesnt retrieve values when deployed - i can only see empty table.

Have a look on updating file in community cloud.

According to my understanding @Ninad_Jagtap , after the writing the insert command , have you committed and close the connection before going to next part of the code??

yes I do - commit the changes after insert - just as explained in article. The code works fine on my local machine.

Sorry @ferdy i didnt understand your reply. I have a very simple requirement where I use SQLite to capture some very basic information like question. I really dont need a fully SQL DB for it so decided to go for SQLite. It works on my local machine but doesnt when deployed on Azure or Streamlit cloud - tried on both.

I can see my table created beacuse it show me empty df, but when I perform insert operation successfully (no error returned) it still shows me empty df.

When our app is deployed in community cloud, it is put in a container where updating the sqlite, csv, etc. files are not supported. Well updating via github is different.

Reading the existing file is fine. But adding entries, deleting entries, updating entries to data files are not supported. This is because anything can happen in a container, Streamlit may reboot it, update system files, change container, etc. If this thing happens, Streamlit just pulls the app files from our github repository and sets the app to run again. We might occasionally able to save the data from time to time, but the state of sqlite, csv, etc. files would revert back to what it was in the github repository.

For deployed apps in the cloud, streamlit provides some guidance on how to connect to data sources.

For running streamlit apps locally, no issue there we can do whatever we want on the data file.

1 Like

Understood - that for clarifying that. I have changed my strategy to store data :slight_smile:

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