What are stored procedures and scripting in BigQuery, and when would you reach for them?

Quick Overview

Asks what BigQuery scripting and stored procedures are and when a data team should use them. Tests knowledge of variables, control flow, error handling, transactions and parameters in BigQuery SQL, and judgment about when to use a dedicated orchestration tool.

What are stored procedures and scripting in BigQuery, and when would you reach for them?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

What are stored procedures and scripting in BigQuery, and when would you reach for them? ```hint Picture a nightly job Think of a job that deletes one day of summary rows, rebuilds them from raw events and records how many rows it wrote. What do you need beyond a single query, and what happens if the second step fails? ``` ### What a Strong Answer Covers - What scripting adds to plain SQL: variables, control flow, error handling, and several statements in one request - How stored procedures are defined, called and parameterized - Concrete cases where they are a good fit - When set-based SQL or a dedicated orchestration tool is the better choice ### Follow-up Questions - The delete succeeds and the insert fails. How do you keep the summary table consistent? - How does the cost of a script add up when a loop runs one query per iteration? - How would you run a procedure every night, and at what point would you move the pipeline to Dataform or Airflow?

Overview: Asks what BigQuery scripting and stored procedures are and when a data team should use them. Tests knowledge of variables, control flow, error handling, transactions and parameters in BigQuery SQL, and judgment about when to use a dedicated orchestration tool.

PracHub logo
General
Nov 24, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

What are stored procedures and scripting in BigQuery, and when would you reach for them?

What a Strong Answer Covers Guidance

  • What scripting adds to plain SQL: variables, control flow, error handling, and several statements in one request
  • How stored procedures are defined, called and parameterized
  • Concrete cases where they are a good fit
  • When set-based SQL or a dedicated orchestration tool is the better choice

Follow-up Questions Guidance

  • The delete succeeds and the insert fails. How do you keep the summary table consistent?
  • How does the cost of a script add up when a loop runs one query per iteration?
  • How would you run a procedure every night, and at what point would you move the pipeline to Dataform or Airflow?