liveBook · Manning

Lazy evaluation

As explained in Snowflake Data Engineering

Lazy execution is an evaluation strategy that postpones running data operations until a triggering operation requires their results.

Lazy evaluation postpones Snowpark data-frame operations until an action requires results. Batching transformations lets the server execute them together, reducing data transferred to the client and generally improving performance. section 6.5

Trigger execution with an action such as:

  • collect(), which materializes rows for inspection. section 6.5
  • count() or show(), which request computed results. section 6.5
  • save_as_table(), which persists the data frame to Snowflake. section 6.5

Inspecting and saving a data frame

Construct a data frame from holiday_flags with an explicit day and holiday_flg schema. print(df) alone produces no data; print(df.collect()) executes the pipeline for inspection. Then use df.write.mode("overwrite").save_as_table("DIM_DATE") to persist it.

How Snowflake Data Engineering covers it

How deep it goes
Explains execution triggers, batching, and client-transfer effects, but does not detail internal query planning.
Examples
Demonstrates holiday_flags, collect(), DIM_DATE, and save_as_table("DIM_DATE") in a Snowpark pipeline.
What it assumes
Requires a Snowflake connection, a Snowpark session, and data-frame schemas for constructed data.
What you can do after
Apply it via Snowpark by batching data-frame operations and triggering execution with collect(), count(), show(), or save_as_table().
How it connects
Connects data frames with Snowpark, server-side execution, actions, and client-server data transfer.

Also explained in

Compare how 13 books explain lazy evaluation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.