but additionally I’d like to have this behaviour: if you’re the first user opening the app, i.e. no one has given the database url and therefore get_big_database() hasn’t been called before, then display a bunch of widgets like text input for entering database URL and a button that is connected to get_big_database(). Otherwise I want to display something like “Database already loaded: {URL}”.
Is there an easy way to do this? i.e. I’m looking for something like a global_state instead of session_state
Hi @milad, we actually have something like global_state on the roadmap! The next frontier for Streamlit For now, the best alternative, if you’re running your app on Streamlit Cloud you could use a lightweight third-party database for keeping track of something like this – here are some options to consider Connect to data sources - Streamlit Docs
If you’re working locally, or on a permanent machine that you control, you could do something as simple as saving a little file to your disk that keeps track of whether the database has been loaded.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.