How do I visualize data from Snowflake in Streamlit?

57 viewsStreamlit

How do I visualize data from Snowflake in Streamlit?

Daniel Steinhold Asked question September 14, 2023

To visualize data from Snowflake in Streamlit, you can use the following steps:

  1. Follow the steps above to access the data from Snowflake in Streamlit.
  2. Use the Streamlit visualization tools to create a graph, chart, or other visualization of the data.

Here are some examples of how to visualize data from Snowflake in Streamlit:

  • To create a bar chart, you can use the st.bar_chart() function.
  • To create a line chart, you can use the st.line_chart() function.
  • To create a pie chart, you can use the st.pie_chart() function.
  • To create a scatter plot, you can use the st.scatter_plot() function.

You can also use the Streamlit st.plotly_chart() function to create a more complex visualization using Plotly.

Here is an example of how to create a bar chart of the number of employees in each department from a Snowflake table:

import snowflake.connector as sf
import streamlit as st

# Get the user credentials from the secrets file
with open(".streamlit/secrets.toml") as f:
    secret_data =
    credentials = toml.load(secret_data)

# Connect to Snowflake
conn = sf.connect(

# Run a query
df = conn.execute("SELECT department, COUNT(*) AS num_employees FROM employees GROUP BY department")

# Create a bar chart
st.bar_chart(df, x="department", y="num_employees")
Daniel Steinhold Changed status to publish September 14, 2023