DBT-ANALYTICS-ENGINEERING practice question 5 of 35

You discover that a dbt model is directly referencing a raw object in the database without using the {{ source() }} function. What potential risks does this pose to the project?

Full set: 409 questions

Domain Environments & deployments

Answer options
A: Reduced execution time
B: Increased complexity and poor maintainability
C: Dependency management issues
D: Both increased complexity and poor maintainability and dependency management issues Correct answer
Correct Answer:
D. Both increased complexity and poor maintainability and dependency management issues
Explanation

Bypassing the {{ source() }} function and directly referencing raw database objects breaks two core dbt principles. First, it severs the dependency link between the model and its raw data source within dbt's Directed Acyclic Graph (DAG). This prevents dbt from tracking lineage, running source-specific commands (e.g., dbt test source:), and checking for data freshness. Second, it harms maintainability. If the location or name of the raw data changes, developers must manually find and replace every hardcoded reference across the project. Using source() centralizes this definition in a single sources.yml file, making updates simple and reliable.

Why Incorrect

A. Reduced execution time: The source() function is a compile-time Jinja macro; it has no material impact on the final query's execution performance.
B. Increased complexity and poor maintainability: This is correct but incomplete, as it omits the critical issue of dependency management and lineage.
C. Dependency management issues: This is also correct but incomplete, as it overlooks the significant negative impact on project maintainability.

References

1. dbt Labs Official Documentation

"Sources": This document explains that using the source function is the standard way to refer to raw data. It states

"dbt builds the DAG of your project by parsing all of the ref and source calls in your models." By not using source()

the dependency is omitted from the DAG

leading to dependency management issues. The document also highlights benefits like testing and freshness checks

which are lost without proper source declaration.

Source: dbt Labs Documentation

docs/build/sources

Section: "Referring to sources".

2. dbt Labs Official Documentation

"Best practices": The guide on structuring dbt projects explicitly states that raw data should be declared as sources. This practice promotes maintainability by abstracting the raw table names and schemas into configuration files

preventing hardcoded values that are difficult to manage.

Source: dbt Labs Documentation

best-practices/how-we-structure/1-guide-overview

Section: "Sources".

3. dbt Labs Official Documentation

"source function": This page details how the source function renders a relation into your compiled SQL. It is the mechanism that allows dbt to understand the upstream dependencies of a model on raw data

which is fundamental for building the project's lineage graph.

Source: dbt Labs Documentation

reference/dbt-jinja-functions/source.

Scroll to Top