What you will be able to do
- Explain how Snowpark DataFrames are evaluated lazily and pushed down to run inside Snowflake
- Describe how Snowpark code becomes UDFs and stored procedures, and when Snowpark-optimized warehouses suit it
- Choose between Snowflake Notebooks, Streamlit in Snowflake and Snowpark for a given development task
- Describe how Notebooks and Streamlit apps live in a schema and are governed by roles
Key concept
Code runs where the data is — Snowpark, Snowflake Notebooks and Streamlit in Snowflake all run your Python logic on Snowflake compute against data that stays in Snowflake, so no external cluster or extra copy of the data is needed. Choosing between them comes down to the job: a transformation pipeline, an exploration workspace, or an app for other people.
1.Snowpark DataFrames: lazy, pushed-down transformations
Snowpark is a client library for writing data processing in a general-purpose language that runs inside Snowflake. Snowflake ships Snowpark libraries for three languages: Java, Python and Scala. You can write the code in local tools such as Jupyter, VS Code or IntelliJ. Snowpark pushes every operation down to Snowflake, so the data never has to travel to the machine running your script. Compare that with the Snowflake Connector for Spark or a pandas job: there, you run and size a separate cluster yourself. With Snowpark, Snowflake handles scale and compute.
The API offers language constructs that build SQL statements for you. You call a select method with column objects instead of concatenating a 'select column_name' string. That gives you code completion and type checking, and the result is still a SQL statement that Snowflake executes.
The DataFrame is the central Snowpark abstraction. It describes a set of data: which columns, which row filter, which joins. Building a DataFrame retrieves nothing. Snowpark runs lazily: transformations pile up until you call an action, and at that point Snowpark sends the combined SQL to Snowflake. Batching many steps into one statement means less data moves between client and server, and the pipeline runs faster. One practical consequence is that a typo in a column name often surfaces only at the collect() line, not where the bad select was written.
>>> # Create a DataFrame with the "id" and "name" columns from the "sample_product_data" table.
>>> # This does not execute the query.
>>> df = session.table("sample_product_data").select(col("id"), col("name"))
>>> # Send the query to the server for execution and
>>> # return a list of Rows containing the results.
>>> results = df.collect()Checkpoint 1 of 7· Fill the gap
The first statement only describes a query. Which method sends the query to Snowflake and returns the result rows?
>>> # Create a DataFrame with the "id" and "name" columns from the "sample_product_data" table.
>>> # This does not execute the query.
>>> df = session.table("sample_product_data").select(col("id"), col("name"))
>>> # Send the query to the server for execution and
>>> # return a list of Rows containing the results.
>>> results = df. ? ()Snowpark DataFrames are lazy. Transformations such as select, filter and sort only add to the query description. An action such as collect() makes Snowpark generate the SQL and send it to Snowflake, then returns a list of Rows.
Source: docs.snowflake.comCheckpoint 2 of 7· Exam question
An engineering team wants to write DataFrame-style transformation logic in Python that compiles down to SQL and executes entirely inside Snowflake's compute, avoiding data movement to an external Spark or pandas cluster. Which technology fits this requirement?
Correct answer: A — Snowpark, whose Python DataFrame API translates transformation operations into SQL that runs on Snowflake virtual warehouses without moving data out.
- A. Snowpark is correct because its Python DataFrame API mirrors pandas-style syntax while lazily compiling operations into SQL that Snowflake executes on its own compute, so data never leaves the platform.
- B. Streamlit in Snowflake focuses on rendering interactive UI elements from query results; it is a presentation layer, not a DataFrame transformation engine.
- C. Notebooks are an execution surface for running code, including Snowpark code, but the DataFrame-to-SQL translation capability itself belongs to the Snowpark API, not the notebook interface.
- D. Cortex AI SQL functions expose LLM-backed operations like summarization or translation as SQL functions; they do not offer a general DataFrame transformation API.
Sources1
2.From Snowpark code to UDFs and stored procedures
Some logic can't be written as a DataFrame expression, such as a Python function applied to every row. For that, Snowpark lets you define user-defined functions (UDFs) inline, often as a Python lambda or a Scala anonymous function. Snowpark automatically pushes the UDF's code to the Snowflake engine. Calling the UDF from client code runs it on the server, next to the data, and Snowflake parallelizes it across rows. A stored procedure is a different kind of object: a UDF is applied to values inside a query, while a stored procedure is code you invoke on its own, with CALL or session.call, and it receives a Snowpark session so it can run its own queries to load, transform and write data. sproc is the Snowpark function (also usable as a decorator) that registers a Python function as a stored procedure, the way udf registers a UDF. Register a named procedure when you want to call it later by name. Registered UDFs and procedures are schema-level objects, which places them in the object hierarchy: organization > account > database > schema > objects alongside tables and views.
>>> from snowflake.snowpark.types import IntegerType
>>> add_one = udf(lambda x: x+1, return_type=IntegerType(), input_types=[IntegerType()], name="my_udf", replace=True)The warehouse type matters once a procedure has to hold a whole dataset in memory. A Python stored procedure can load and transform data with Snowpark, then pull it into the procedure's own memory to train a model on a single node. That workload belongs on a Snowpark-optimized warehouse, the memory-heavy type described with the other warehouse types and sizes (Gen1, Gen2, Snowpark-optimized). The trained model can be saved to a stage and used to build UDFs for inference.
Checkpoint 3 of 7· Check yourself
A data engineer registers a Python lambda with udf() and then calls it from client code on a column of a 500-million-row Snowflake table. Where does the lambda's logic run?
Snowpark automatically ships the UDF's code to Snowflake. Calling it runs the code on the server where the data is, so no rows go to the client and no external cluster is needed.
“When you call the UDF in your client code, your custom code is executed on the server (where the data is).”Source: docs.snowflake.com
3.Snowflake Notebooks: cell-based exploration in Snowsight
Snowflake Notebooks are an interactive, cell-based development environment in Snowsight. They support Python, SQL and Markdown cells. A data scientist can write a SQL cell to profile a table, add a Python cell to plot the result, and then a Markdown cell explaining what the chart shows, all in one document and run cell by cell. Notebooks are designed for exploratory analysis, model development and data engineering work.
A notebook is stored as an object inside a database and schema. When you create it, you choose its role, warehouse, database and schema. When it runs, it uses that role and that warehouse, in the context of the schema that contains it. Python cells reach Snowflake data through Snowpark by fetching the active session. Switching to a role that lacks privileges on the notebook's warehouse or schema makes the queries that depend on them fail.
from snowflake.snowpark.context import get_active_session
session = get_active_session()Beyond exploration, notebooks connect to Git for version control and can run on a schedule to automate pipelines. They can show embedded Streamlit visualizations and charts from Altair, Matplotlib or seaborn. Role-based access control lets other users with the same role view the notebook and collaborate on it. The original experience has been renamed Legacy Notebooks, and Notebooks in Workspaces, which adds Jupyter compatibility, is its next generation.
Checkpoint 4 of 7· Check yourself
Your team is evaluating Snowflake Notebooks in Snowsight for exploratory work. Which claim about them is FALSE?
Snowflake Notebooks are cell-based, and Python, SQL and Markdown cells can sit in the same notebook. One document can profile data in SQL, plot it in Python and explain the result in Markdown. The other three statements are documented notebook capabilities.
“offers an interactive, cell-based programming environment for Python, SQL, and Markdown”Source: docs.snowflake.com
Checkpoint 5 of 7· Exam question
A data scientist wants to explore a sales table with Python, SQL, and Markdown cells side by side, run the code against a Snowflake virtual warehouse, and keep the exploration artifact as a schema-level object that teammates can open in Snowsight. Which capability should they use?
Correct answer: A — Snowflake Notebooks, which provide an interactive cell-based interface for Python, SQL, and Markdown stored as a first-class object under a database and schema.
- A. Snowflake Notebooks are correct because they give an interactive, cell-based environment mixing Python, SQL, and Markdown, run on a virtual warehouse (or container runtime), and are stored as schema-level objects visible to teammates in Snowsight.
- B. Streamlit in Snowflake builds deployed interactive applications with widgets and charts, not a notebook-style exploratory environment with mixed SQL/Python/Markdown cells, so it does not fit this exploration task.
- C. A Snowpark stored procedure runs a single packaged Python handler on demand or on a schedule; it has no interactive cell interface for iterative mixed-language exploration.
- D. Classic Snowsight worksheets accept SQL only, without Python execution or Markdown documentation cells, so they cannot deliver the mixed-language exploratory workflow described.
4.Streamlit in Snowflake: data apps under RBAC
Streamlit is an open-source Python library for building web apps for data science and machine learning. Its widgets include sliders, buttons and charts. Streamlit in Snowflake lets you build, deploy and share these apps on Snowflake, and the apps process data without moving it or the app code to an external system. Snowflake manages the underlying compute and storage for the app. You choose between a warehouse runtime and a container runtime. In Snowsight, a side-by-side editor and live preview let you change the code and see the result immediately.
The app is itself a Snowflake object. Its source code and environment configuration are stored in a securable object governed by RBAC, created in a schema. The app runs with owner's rights. The app owner and the schema owner decide which roles may use it, and those users see exactly what the owner sees, except that they can't open edit mode. That is the real difference from a notebook. A notebook is an analyst's working document, while a Streamlit app is a finished interface that business users open in Snowsight without installing anything. Apps can also call Snowpark code, UDFs and stored procedures, and they work with the Snowflake Native App Framework.
| Privilege | Object | Notes |
|---|---|---|
| CREATE STREAMLIT | Schema where you create the Streamlit object | Always required |
| READ | Stage from which you copy the Streamlit app source files | Always required |
| USAGE | Warehouse used by the Streamlit app | Always required |
| USAGE | Compute pool used by the Streamlit app | Only if the app uses a container runtime |
Checkpoint 6 of 7· Check yourself
An analyst wants to give 40 regional sales managers an interactive dashboard with a region slider over sales tables in Snowflake, and decides to deploy it with Streamlit in Snowflake. Which statement describes how the app is hosted and how access is controlled?
Streamlit in Snowflake stores the app as a securable object in a schema, and roles granted access to it can use it under RBAC. Snowflake supplies the compute and storage, so no data or code goes to an external system. Because the app runs with owner's rights, users see what the owner sees and don't need their own SELECT grants on the tables.
“Snowflake stores your source code and environment configuration within a Snowflake object that uses Role-based Access Control (RBAC) to manage access to your Streamlit app.”Source: docs.snowflake.com
Checkpoint 7 of 7· Exam question
A developer needs to publish an internal dashboard with sliders, buttons, and charts driven by live Snowflake data, and wants business users to open it directly from Snowsight without installing anything locally. Which service is designed for this?
Correct answer: A — Streamlit in Snowflake, which lets a Python app with interactive widgets run and render inside Snowsight as a deployed schema-level object.
- A. Streamlit in Snowflake is correct because it runs Python apps with interactive widgets and charts natively inside Snowsight, deployed as a schema-level object that business users can open with no local install.
- B. Notebooks are built for interactive, cell-by-cell exploration and documentation, not for packaging a polished widget-driven app for non-technical business users to consume.
- C. Snowpark UDFs execute logic invoked from SQL statements; they have no UI layer and cannot render sliders, buttons, or charts on their own.
- D. Snowsight dashboard tiles display results of saved queries or charts but do not support custom interactive widget logic written in Python.
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Snowflake currently provides Snowpark libraries for three languages: Java, Python, and Scala.”
↩︎ Snowpark DataFrames: lazy, pushed-down transformations“The Snowpark API provides programming language constructs for building SQL statements.”
↩︎ Snowpark DataFrames: lazy, pushed-down transformations“The core abstraction in Snowpark is the DataFrame, which represents a set of data and provides methods to operate on that data.”
↩︎ Snowpark DataFrames: lazy, pushed-down transformations“Snowpark automatically pushes the custom code for UDFs to the Snowflake engine.”
↩︎ From Snowpark code to UDFs and stored procedures“No requirement for a separate cluster outside of Snowflake for computations. All of the computations are done within Snowflake.”
↩︎ Key concept“Snowpark operations are executed lazily on the server”
↩︎ Exam trap 1“The data isn’t retrieved when you construct the DataFrame object.”
↩︎ Prediction“When you call the UDF in your client code, your custom code is executed on the server (where the data is).”
↩︎ Checkpoint - 2.
“you can create and register a named stored procedure”
↩︎ From Snowpark code to UDFs and stored procedures“Call the sproc function in the snowflake.snowpark.functions module, passing in the definition of the anonymous function.”
↩︎ From Snowpark code to UDFs and stored procedures - 3.https://docs.snowflake.com/en/developer-guide/snowpark/python/python-snowpark-training-mlOfficial docs
“A Python stored procedure can run nested queries, using the Snowpark API for Python, to load and transform the dataset”
↩︎ From Snowpark code to UDFs and stored procedures“Snowpark-optimized warehouses make it possible to use Snowpark stored procedures to run single-node ML training workloads directly in Snowflake.”
↩︎ From Snowpark code to UDFs and stored procedures“The trained model can be uploaded into a Snowflake stage, and can be used to create UDFs to perform inference.”
↩︎ From Snowpark code to UDFs and stored procedures - 4.
“an interactive, cell-based programming environment for Python, SQL, and Markdown”
↩︎ Snowflake Notebooks: cell-based exploration in Snowsight“Run your notebook on a schedule to automate pipelines.”
↩︎ Snowflake Notebooks: cell-based exploration in Snowsight“Notebooks in Workspaces is the next generation of Snowflake Notebooks, providing Jupyter compatibility and full integration with Workspaces.”
↩︎ Snowflake Notebooks: cell-based exploration in Snowsight“offers an interactive, cell-based programming environment for Python, SQL, and Markdown”
↩︎ Checkpoint - 5.
“in the context of the database and schema that contain the notebook”
↩︎ Snowflake Notebooks: cell-based exploration in Snowsight - 6.
“you can build applications that process and use data in Snowflake without moving data or application code to an external system”
↩︎ Streamlit in Snowflake: data apps under RBAC“Snowflake stores your source code and environment configuration within a Snowflake object that uses Role-based Access Control (RBAC)”
↩︎ Streamlit in Snowflake: data apps under RBAC“You can choose between a warehouse and container runtime.”
↩︎ Streamlit in Snowflake: data apps under RBAC“Snowflake stores your source code and environment configuration within a Snowflake object that uses Role-based Access Control (RBAC) to manage access to your Streamlit app.”
↩︎ Checkpoint - 7.
“Users have the same view of the app as the owner does except that they can’t access the edit mode.”
↩︎ Streamlit in Snowflake: data apps under RBAC“Streamlit apps use a permission model that is based on owner’s rights.”
↩︎ Exam trap 2