In a dbt project, the 'models' directory is a key folder. What is its main purpose?
Think about where you write the SQL code that builds your data models.
The 'models' directory contains SQL files that define how raw data is transformed into clean, usable tables or views in your warehouse.
Given a dbt project, what is the main role of the dbt_project.yml file?
Think about where you set project-wide settings in dbt.
The dbt_project.yml file sets configurations that apply to the whole project, such as where models live and how they build.
Suppose your dbt project has this 'models' folder structure:
models/ āāā staging/ ā āāā customers.sql ā āāā orders.sql āāā marts/ ā āāā sales.sql ā āāā inventory.sql āāā README.md
How many SQL model files will dbt compile and run?
Count only the .sql files inside the 'models' folder and its subfolders.
dbt compiles all .sql files inside the 'models' directory and its subdirectories. Here, there are 4 SQL files.
You have this dbt_project.yml snippet:
name: my_project version: '1.0' model-paths: ['sql_models']
But your models are inside a folder named models. What is the cause of the problem?
Check if the folder path matches the actual folder name.
The model-paths setting tells dbt where to look for models. If it points to a folder that doesn't exist, dbt won't find any models.
You want to add custom data quality tests using SQL in your dbt project. Where should you place these test files?
Think about where dbt expects test files to be stored.
Custom test SQL files should be placed in the 'tests' directory at the root of the project. This keeps tests organized and separate from models.