Skip to main content
InterviewHubPRO
Section Overview
Q33

Question 33 of 50

Part 3: Enterprise Scale, Performance & CI/CD Pipelines (Senior / Staff)

66%
dbt Analytics Engineering (50 Qs)•Part 3: Enterprise Scale, Performance & CI/CD Pipelines (Senior / Staff)

How do you refactor legacy stored procedures into modern dbt models?

senior LevelMost AskedFormsPerformancePipes

In Simple Words:

  1. Break down 2,000-line monolithic stored procedures into CTEs.
  2. Separate business logic from ingestion: extract raw loading into staging models.
  3. Replace temporary tables (#temp_table) with modular intermediate models.
  4. Replace procedural loops (WHILE / CURSOR) with set-based SQL joins and Jinja macros.
  5. Add automated generic tests to ensure parity between old and new outputs.