Bird
0
0

Which of the following is the correct way to filter late-arriving data in a dbt SQL model?

easy📝 Syntax Q12 of 15
dbt - Incremental Models
Which of the following is the correct way to filter late-arriving data in a dbt SQL model?
AWHERE event_date < current_date - interval '1 day'
BWHERE event_date > current_date + interval '1 day'
CWHERE event_date = current_date
DWHERE event_date IS NULL
Step-by-Step Solution
Solution:
  1. Step 1: Understand filtering late data by date

    Late-arriving data is usually older than the current date minus a buffer (like 1 day), so we filter for dates less than that.
  2. Step 2: Check each option's logic

    WHERE event_date < current_date - interval '1 day' filters for event_date before yesterday, which captures late data. WHERE event_date > current_date + interval '1 day' filters future dates, which is incorrect. WHERE event_date = current_date filters only today's data, ignoring late data. WHERE event_date IS NULL filters nulls, unrelated to late data.
  3. Final Answer:

    WHERE event_date < current_date - interval '1 day' -> Option A
  4. Quick Check:

    Filter dates before yesterday = WHERE event_date < current_date - interval '1 day' [OK]
Quick Trick: Late data usually has older dates than today minus buffer [OK]
Common Mistakes:
MISTAKES
  • Filtering future dates instead of past dates
  • Filtering only current date data
  • Filtering null dates instead of late data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes