Monitoring Snowflake with Streamlit-in-Snowflake (SiS)
This post and content was co-authored with Nikhil Kolur Sales Engineer @ Snowflake
This post builds on the dashboard examples built using Snowsight but now utilizing new capabilities in Streamlit in Snowflake (SiS). In late September Snowflake announced SiS in public preview on AWS (here). SiS gives our customers the ability to create applications without the need for multiple languages. Snowflake customers can now use Python to create visualizations and utilize standard Snowflake security to share these apps with different roles. All content is housed within the secure walls of the Snowflake platform.
If you haven’t used the previous example in Snowsight please see here.
Some key areas we have focused on with the Streamlit version vs. Snowsight:
Ease of use: there is no manual work needed to recreate the dashboard it is quite literally copy & paste and you can get started
Code Examples: Utilize our examples for visualizing data in Streamlit while also utilizing components such as a date picker to manipulate date
Portability: Easily manipulate this template to use with other tables or sources within your Snowflake account
Application Sample Output
Github Repo: https://github.com/nkolur2/streamlit-usage-app/blob/main/app.py
Setting up the Application
Important Prerequisites:
- You must have access to the SNOWFLAKE database and ACCOUNT_USAGE Schema. You can access with the ACCOUNTADMIN role or have your admin grant access via the following process here.
- You must have privileges to create a Streamlit application. Please reference the following documentation here for the process to get access and other Streamlit in Snowflake prerequisites.
- Create a database or identify a database where the Streamlit application will be hosted
Following the prerequisites to get started please utilize the steps below:
- Login to Snowflake.
- Navigate to the Streamlit tab within the Snowisght UI.
3. Click the + Streamlit App button at the top right of the screen to create your Streamlit-in-Snowflake (SiS) app.
4. Enter your desired application name. You will also be prompted to select a database and schema where this application lives. Either create a new database or add this to an existing database and schema. Click Create after adding the details.
5. You will be greeted with sample code and a sample application. Please delete all text within the left editor. This is where we will write the application code.
6. Click the Packages dropdown and add in plotly by searching in the search bar.
7. Copy and paste the application code hosted here. Click Run and you are all set to go!
The first version of this app was created October 2023. As more views are added to Snowflake we will continue to add new versions hosted in this Github repository. If you experience any issues or there are details missing please don’t hesitate to put it in the comments below!
Hope you all enjoyed the post!
Fun Fact: Snowflake announced it would acquire Streamlit in March of 2022. This post just 1 year later is possible due to the great work done to integrate this into the Snowflake platform.