Skip to main content
InterviewHubPRO
Section Overview
Q4

Question 4 of 50

Part 1: dbt Core Concepts & Fundamentals (Junior / Entry-Level)

8%
dbt Analytics Engineering (50 Qs)•Part 1: dbt Core Concepts & Fundamentals (Junior / Entry-Level)

What is the `source()` function and how does Source Freshness work?

junior LevelCode Exampledbtdbt Core Concepts

In Simple Words: While ref() references other dbt models, source('source_name', 'table_name') references raw, untransformed tables loaded into the warehouse by ingestion tools (Fivetran, Airbyte, Kafka).

Source Definition & Freshness Checks:

yaml
# models/staging/src_stripe.yml
version: 2
sources:
  - name: stripe
    database: raw_data
    schema: stripe_payments
    freshness:
      warn_after: {count: 12, period: hour}
      error_after: {count: 24, period: hour}
    loaded_at_field: _loaded_at
    tables:
      - name: charges

Running dbt source freshness inspects _loaded_at and fails if ingestion pipelines have stalled.