In dbt, why is it recommended to create exactly one model for each source table?
Think about how isolating transformations helps when you want to find errors or test data.
Having one model per source table keeps transformations clear and isolated. This makes debugging and testing easier because each model corresponds directly to one source table.
Given this dbt model SQL code that selects all columns from a source table, what will be the output schema?
select * from {{ source('sales_db', 'orders') }}
The source() function references the source table directly.
The model selects all columns from the 'orders' source table, so the output schema matches the source table's columns.
Assume the source table 'customers' has 1000 rows. A dbt model applies a filter to select only customers from 'USA'. If 300 rows match, how many rows will the model output have?
Filters in SQL reduce the number of rows returned.
The model filters the source table to only include customers from USA, so the output has 300 rows.
Which problem arises if you create multiple dbt models that transform the same source table independently?
Think about what happens if you have different versions of the same data.
Multiple models on the same source table can cause duplicated data and inconsistent results, making maintenance harder.
You have three source tables: 'orders', 'customers', and 'products'. You want to build a sales report model that combines data from all three. According to the one model per source table rule, how should you organize your dbt models?
Think about modularity and reusability in dbt models.
Following the rule, each source table gets its own model. Then a separate model combines them for the report. This keeps transformations clear and modular.