Reading/Writing to SQLite Database in Streamlit App

Hi there! I want to create an app that can read/write data from a SQLite database. The database file is stored in the root of my GitHub repo. When running the Streamlit app locally, reads and writes to the database work perfectly fine. However, when deploying to Streamlit Cloud, there is an error saying the table in my database does not exist.

Python version: 3.11
Streamlit version: latest
link to the public app here
link to the GitHub repo here

ERROR MESSAGE - DatabaseError: Execution failed on sql 'SELECT * FROM races': no such table: races

I could very easily use a csv file to store all this data, but I was also interested in practicing my SQL skills. Would be cool if this was possible, and any help would be appreciated!

I’ll note that I did find this article, but it seems this is out of date because copy/pasting the sample code for basic connection to a SQLite database is causing errors too.

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