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