DBT-ANALYTICS-ENGINEERING practice question 8 of 35
True or False: In a modular dbt project, using the {{ source() }} function to reference raw data sources helps adhere to DRY principles.
Full set: 409 questionsDomain Source & staging data
The statement is true. The {{ source() }} function in dbt is a core component for building modular and maintainable data projects that adhere to the "Don't Repeat Yourself" (DRY) principle. By defining raw data tables (including their database and schema) in a central sources.yml file, you create a single source of truth for these upstream dependencies. Downstream models then use the {{ source() }} function to reference these tables instead of hardcoding their full paths. If the location of a raw data table changes, the update only needs to be made in the single sources.yml file, rather than in every model that references it, thus avoiding repetition and reducing the risk of errors.
The statement is not false because the primary architectural benefit of the source() macro is to abstract and centralize the definition of raw data locations. Hardcoding the full path of a source table (e.g., raw.jaffleshop.orders) in multiple models would be a direct violation of the DRY principle, as the location information is repeated in each model. The source() function is designed specifically to prevent this repetition.
1. dbt Labs Official Documentation
"Sources": "By declaring sources in dbt
you can then select from source tables in your models using the {{ source() }} function... This provides a single place for you to define your source data
and all downstream models can reference it." This directly describes the centralization of information
which is the core of the DRY principle.
Source: dbt Labs Documentation
dbt Core > dbt-core fundamentals > Sources.
2. dbt Labs Official Documentation
"How we structure our dbt projects": This best practice guide emphasizes creating a clean interface between raw data and the rest of the dbt project. It states
"The purpose of [staging] models is to be representations of the source data... Each staging model should correspond to one source table." This one-to-one mapping and clean referencing is enabled by the source() function
promoting a modular and DRY structure.
Source: dbt Labs Documentation
Best practices > How we structure our dbt projects > Staging: preparing our raw data for modeling.
3. dbt Labs Official Documentation
"source function": The documentation for the function itself explains its role in referencing pre-defined sources. "The source function is the primary way to reference a source table in a model." This reinforces its role as the standardized method for referencing
which is essential for a DRY implementation.
Source: dbt Labs Documentation
Jinja & macros > Functions > source.
Keep practicing
Take the free DBT-ANALYTICS-ENGINEERING practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DBT-ANALYTICS-ENGINEERING practice questions
- Question 1What is the purpose of the --resource-type argument in the dbt ls command?
- Question 2Select the valid methods for configuring incremental models in dbt. (Select all that appl…
- Question 3When fixing a dbt model issue, it is acceptable to skip the testing process in a separate…
- Question 4You want to run tests on only the models that have been modified since your last dbt run.…
- Question 5You discover that a dbt model is directly referencing a raw object in the database withou…
- Question 6What is the purpose of the dbt deps command in the dbt workflow?
