Skip to content

Querying, filtering, and transforming data with the Snowpark library

Snowpark provides native language APIs (Python, Java, Scala) for building data transformation pipelines that execute directly inside Snowflake's compute engine using DataFrame-style operations. Code is pushed down and translated into SQL executed on Snowflake virtual warehouses, avoiding data movement to external systems. It supports UDFs, UDTFs, stored procedures, and DataFrame transformations for complex ETL/ELT logic.

1 · Learn the must-know

  • Snowpark DataFrame operations are lazily evaluated and only executed when an action (e.g., collect(), show(), write) is called, allowing query optimization via pushdown to Snowflake SQL.
  • Snowpark supports creating User-Defined Functions (UDFs), User-Defined Table Functions (UDTFs), and stored procedures directly from Python/Java/Scala code, which run inside Snowflake's secure sandboxed environment.
  • The Snowpark API includes session management via a Session object (analogous to a connection), which must be created before building or executing DataFrames.
  • Snowpark supports vectorized UDFs using pandas API for Python, improving performance for row-wise operations by batching data as pandas Series/DataFrames.
  • Snowpark ML and Snowpark-optimized warehouses exist to support machine learning feature engineering and training with higher memory allocation, but core Snowpark transformations run on standard virtual warehouses.
  • Because Snowpark pushes down operations to SQL, not all third-party Python/Java/Scala libraries are supported unless explicitly available in Snowflake's Anaconda-integrated package channel or uploaded as a stage-based dependency.

3 · Keep going