Interview practice question
Same logic copied in many models
Data Engineering · dbt · Beginner
You notice the same 20-line CASE statement for mapping country codes is copied into eight models. How do you clean this up?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Move the logic into one place, either a macro or a mapping table.
- A seed or reference table is better for pure lookups.
- A macro fits if it's logic, not just mapping.
- Replace copies and verify outputs didn't change.
- Future changes now happen in one place.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.