Essential cookies keep authentication working. With your permission, we also use analytics cookies to understand and improve the product. Read our Privacy Policy

DataEngPrep.tech
QuestionsPracticeAI CoachDashboardPricingBlog
ProLogin
Home/Questions/General/Other/How do you handle passing parameters between notebooks?

How do you handle passing parameters between notebooks?

General/Othereasy2 min read

Reviewed by Aditya Kumar · Last reviewed 2026-08-08

Parameters can be passed between notebooks using environment specific utilities like Databricks widgets, programmatic execution tools like Papermill, or external orchestrators such as Airflow. For…

🤖 Analyze Your Answer
Frequency
Low
Asked at 1 company
Category
243
questions in General/Other
Difficulty Split
151E|43M|49H
in this category
Total Bank
1,863
across 7 categories
Asked at these companies
TCS
Key Concepts Tested
airflow

Why This Question Matters

This easy-level General/Other question appears frequently in data engineering interviews at companies like TCS. While less common, it tests deeper understanding that distinguishes strong candidates. Mastering the underlying concepts (airflow) will help you answer variations of this question confidently.

How to Approach This

Start by clearly defining the core concept being asked about. Interviewers want to see that you understand the fundamentals before diving into implementation details. Structure your answer with a definition, then explain the practical application with a concise example. The expert answer includes a code example that demonstrates the implementation pattern.

Expert Answer
372 wordsIncludes code

Parameters can be passed between notebooks using environment-specific utilities like Databricks widgets, programmatic execution tools like Papermill, or external orchestrators such as Airflow. For more complex data, shared storage like files or tables can also serve as an intermediary.

Methods for Parameter Passing

* Notebook-Specific Utilities (e.g., Databricks Widgets): Databricks offers dbutils.widgets for creating interactive input fields or defining job parameters. These are retrieved using dbutils.widgets.get("param_name"). For direct notebook-to-notebook execution, the %run magic command passes parameters as environment variables, e.g., %run ./notebook $param=value, which the target notebook accesses. This is ideal for interactive development and simple job parameterization within Databricks.

* Programmatic Execution Tools (e.g., Papermill): Papermill enables parameterizing and executing notebooks programmatically, often used in automated pipelines. It injects parameters into a notebook and executes it, saving the output. For example: papermill input.ipynb output.ipynb -p param_name value. This provides reproducible execution and parameterization independent of the notebook environment.

* Shared State (Cloud Storage or Tables): For passing larger datasets, complex objects, or state that persists across different jobs, writing to a shared location is effective. This could be a file on cloud storage (e.g., DBFS, S3, ADLS) or a table in a data warehouse (e.g., a Delta Lake table). The producing notebook writes the data, and the consuming notebook reads it. This method is suitable when parameters are themselves data or require persistence.

* Orchestrators (e.g., Airflow, Azure Data Factory): Workflow orchestrators are designed to manage dependencies and pass parameters between tasks, including notebooks. Airflow operators (e.g., DatabricksSubmitRunOperator) can accept parameters, often using Jinja templating, which are then passed to the notebook task. This centralizes parameter management and ensures consistent execution across complex workflows.

Key Trade-offs and Example:
Choosing the right method depends on interactivity needs, data volume, and orchestration complexity. For interactive Databricks development, widgets are convenient. For automated, reproducible execution, Papermill or an orchestrator are preferred. Shared state is best for data-intensive parameter passing or persistent state.

# Databricks widget example in the receiving notebook
dbutils.widgets.text("report_date", "2023-01-01", "Report Date")
report_date = dbutils.widgets.get("report_date")
print(f"Generating report for: {report_date}")

In the interview, also mention:
Always document parameters, validate their inputs for correctness and security, and provide sensible default values for local development to ensure robustness and ease of use.

⚡
Pro Tip

Pro-Move: 'We use widgets for interactive; Airflow passes date/env to job notebooks. Validated with assert in first cell.'

Want all answers as a PDF for offline study?
Seven focused volumes with 750+ in-depth answers — Answer Vault →

Related General/Other Questions

hardHave you worked on Data Warehousing projects?FreemediumHow would you read data from a web API? What steps would you follow after reading the data?FreehardRetrieve the most recent sale_timestamp for each product (Latest Transaction).FreehardWhat is the difference between OLTP and OLAP?FreemediumWhat is the difference between SQL and NoSQL databases?Free

Level up your prep

Recommended
Educative
Educative Unlimited

800+ hands-on courses — Grokking System Design, Coding Patterns, and AI mock interviews for your DE loop.

Start learning →

Some links below are affiliate links. If you buy through them we may earn a small commission at no extra cost to you — it helps keep DataEngPrep free.

According to DataEngPrep.tech, this is one of the most frequently asked General/Other interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.

← Back to all questionsMore General/Other questions →
Categories
All QuestionsSQLSpark / Big DataPython / CodingSystem DesignCloud / ToolsBehavioral
By Company
AmazonGoogleDatabricksSnowflakeAWSAzureMicrosoftNetflixUberTCS
Interview Guides
All GuidesTop SQL QuestionsTop Spark QuestionsPySpark QuestionsTop Python QuestionsTop System DesignKafka QuestionsAirflow QuestionsSQL Window FunctionsETL QuestionsData Modeling
Products
AI Interview CoachAnswer AnalyzerSQL PlaygroundResume AnalyzerAnswer Vault PDFsPricing
Company
About & Editorial PolicyContact UsAI DisclosureDisclaimerTerms of ServicePrivacy Policy
© 2026 DataEngPrep.tech. All rights reserved.
AboutBlogContactDisclaimer