External Database

Hello, I am working on a project in which I would need to code for sensors to start and stop data collection then once that is complete, there would be a pop-up to name the file then export it to a database in which a separate streamlit app could pull from those files. Does anyone have any tips at where to get started with the whole database idea? is it possible?

You can use connections to connect to external data sources: Connections and databases - Streamlit Docs.

Here’s a tutorial using Supabase: Connect Streamlit to Supabase - Streamlit Docs

1 Like

Thanks for the help! I created a Supabase account and did the pip install for it on my intergrated terminal and copied the Supabase URL and key. Im not sure I understand what the .streamlit/secrets.toml file is. I tried creating a new file with the code Streamlit provides but it is saying connections is not defined.

# .streamlit/secrets.toml
[connections.supabase]
SUPABASE_URL = "xxxx"
SUPABASE_KEY = "xxxx"

Could you share a code snippet showing how you are trying to initialize the connection in the app, and the traceback?

I haven’t added any code to initialize the connection because I wasn’t sure what I needed to add. What exactly am I supposed to do to link my Streamlit app code up with the Supabase project I created? I am not the best with coding :rofl:

This should help: Connect Streamlit to Supabase - Streamlit Docs