# Passing Parameters Between Snowflake Notebooks: A Complete Guide

DevFeed: [Passing Parameters Between Snowflake Notebooks: A Complete Guide](<https://devfeed.tech/articles/passing-parameters-between-snowflake-notebooks-a-complete-guide-88060.md>)

Original publisher: [Read original article](<https://medium.com/snowflake/passing-parameters-between-snowflake-notebooks-a-complete-guide-b95cb5249338?source=rss----34b6daafc07---4>)

Author: Swati Goel

Published: 2026-10-15T19:01:01Z

Content type: tutorial

Language: en

Sources: [Snowflake Builders](<https://devfeed.tech/sources/snowflake-builders.md>)

Topics: [Snowflake streaming data architecture](<https://devfeed.tech/topics/snowflake-streaming-data-architecture.md>), [etl](<https://devfeed.tech/topics/etl.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-pipeline](<https://devfeed.tech/tags/data-pipeline.md>), [jupyter-notebook](<https://devfeed.tech/tags/jupyter-notebook.md>), [pipelines](<https://devfeed.tech/tags/pipelines.md>), [python](<https://devfeed.tech/tags/python.md>), [snowflake](<https://devfeed.tech/tags/snowflake.md>)

## AI overview

This Snowflake tutorial compares ways to pass parameters between notebooks, including shared in-memory variables with %run and return values passed through Task DAGs. It also covers static task configuration, multiple predecessors, and operational pitfalls such as malformed JSON arguments and deploying notebook changes to update a Code Bundle.

## Source excerpt

How to build production notebook pipelines with parameter passing across every workspace type and execution mode. Full working code for all scenarios is available in the GitHub repo. This guide covers every scenario with working examples you can copy into your own account. Understanding the Landscape:Workspace TypesExecution Modes This distinction matters for every pattern below. Terminology: This guide uses Code Bundle (formerly Notebook Project Object/NPO). Snowflake renamed the object; the legacy NOTEBOOK PROJECT SQL grammar is still supported. See Snowflake Code Bundles.Scenario 1: %run -- Shared Variables in Memory Best for: Sequential notebooks in the same workspace. The simplest approach. How it works: The %run executes another notebook in the same Python process. All variables, functions, and imports are shared. Architecture The sender sets variables in its last cell: OUTPUT_TABLE = f'{TARGET_DB}.{TARGET_SCHEMA}.ORDER_SUMMARY' ROW_COUNT = session.sql(f'SELECT COUNT(*) AS C FROM {OUTPUT_TABLE}').collect()[0]['C'] STATUS = 'SUCCESS' The orchestrator calls both and can gate between them: %run data_prep.ipynb assert STATUS == 'SUCCESS', f"Data prep failed: {STATUS}" %run report.ipynb The receiver reads the variables directly -- no imports, no parsing: print(f"Reading from: {OUTPUT_TABLE}") # Already in memory report_df = session.sql(f"SELECT * FROM {OUTPUT_TABLE}") Full notebook code: GitHub repo / scenario-1-run Scenario 2: Task DAG with SYSTEM$SET_RETURN_VALUE Best for: Independent notebooks running as separate production units. Each notebook is its own Code Bundle. A Task DAG chains them. The first task sets a return value, the second reads it and passes it as ARGUMENTS. The sender sets a pipe-delimited return value (not JSON -- see Gotcha #4): return_payload = f"{OUTPUT_TABLE}|{ROW_COUNT}|{RUN_DATE}|{STATUS}" try: session.sql(f"SELECT SYSTEM$SET_RETURN_VALUE('{return_payload}')").collect() except Exception as e: if 'must be called from within a task' in str(e):