SnowPro Associate: Platform Question 88
Single answer● Visualize data using StreamlitA data analyst is building an internal dashboard in Streamlit in Snowflake to help regional sales managers explore monthly revenue trends. The dashboard must let managers choose a region from a dropdown and then display a chart of revenue by month for that region. The analyst wants the solution to use Snowflake-managed visualization capabilities without moving data outside Snowflake. Which approach best meets this requirement?
- A
Create a Streamlit in Snowflake app that uses a Snowpark session to query the sales table based on the selected region, then render the results with a Streamlit chart component such as st.line_chart.
- B
Export the sales data from Snowflake to a local CSV file, load it into a standalone Streamlit app running on a developer laptop, and display the chart there.
- C
Use a Snowflake task to generate monthly chart images and store them in an internal stage, then ask managers to download the images manually instead of using Streamlit.
- D
Build a Python UDF that directly renders interactive charts in a worksheet result pane, replacing the need for a Streamlit app.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to build a Streamlit in Snowflake application that queries Snowflake data dynamically and visualizes the results with Streamlit components. This is the intended pattern for interactive dashboards that stay within Snowflake's governed environment. Streamlit in Snowflake allows developers to create apps using Python and Streamlit while leveraging a Snowpark session to access Snowflake data directly. Best practice is to filter and aggregate data in Snowflake, then return only the needed results to the app for display. This approach supports interactivity, avoids unnecessary data export, and matches Snowflake guidance for native app-style data visualization inside the platform.
- A. Correct.
Correct. Streamlit in Snowflake is designed for building interactive data apps that run within Snowflake. A common pattern is to use the Snowpark session available to the app, execute a query filtered by user input such as a selected region, and then visualize the returned data with Streamlit components like st.line_chart or other supported charting methods. This keeps data in Snowflake and aligns with the requirement to use Snowflake-managed visualization capabilities.
- B. Incorrect.
Incorrect. Although Streamlit can run outside Snowflake, exporting data to CSV and running the app on a local machine moves data outside Snowflake. That violates the stated requirement and introduces unnecessary data handling and governance concerns.
- C. Incorrect.
Incorrect. Tasks can automate SQL or procedural work, but generating static chart images for manual download does not provide the requested interactive dashboard experience. It also misuses tasks for a problem that Streamlit in Snowflake is intended to solve more directly.
- D. Incorrect.
Incorrect. Python UDFs in Snowflake are for data processing and returning values, not for rendering interactive dashboard visualizations in worksheets. They do not replace Streamlit for building user-facing, interactive applications.